2009-10-30 44 views
1

雖然嘗試編譯猞猁,我用了「有-dmalloc」配置選項。但是編譯中止,產生這個錯誤:程序配置爲使用dmalloc紓困爲由頭文件中的錯誤

 /usr/include/dmalloc.h:460: error: expected identifier or '(' before '__extension__' 
> /usr/include/dmalloc.h:484: error: expected identifier or '(' before '__extension__' 
> make[1]: *** [HTParse.o] Error 1 
> make[1]: Leaving directory `/tmp/lynx2-8-8/WWW/Library/Implementation' 
> make: *** [all] Error 2 

這就是出錯的行dmalloc.h保持:


> Line 460: char *strdup(const char *string); 
> Linu 484: char *strndup(const char *string, const DMALLOC_SIZE len); 

的文件也可以在http://www.filewatcher.com/p/dmalloc-5.5.2.tbz.467309/include/dmalloc.h.html

發展上dmalloc觀看了幾乎停下來,所以並沒有真正期望從上游獲得修復。任何幫助?

回答

0

我遇到過這樣的事情,發現這是由dmalloc.h造成危害例如被列入<unistd.h> et。人如此,從dmalloc.h宏標識符錯位的聲明爲真正的valloc/realloc的/ memdup等

難道這是你所看到的?

2

我面臨着類似的問題,而在Fedora 21 x86_64的安裝dmalloc:

- 432 | extern 
- 433 | char *strndup(const char *string, const DMALLOC_SIZE len); 

+ 432 | #undef strndup 
+ 433 | extern 
+ 434 | char *strndup(const char *string, const DMALLOC_SIZE len); 

源:

dmalloc-5.5.2]$ make 
rm -f dmalloc.h dmalloc.h.t 
cat ./dmalloc.h.1 dmalloc.h.2 ./dmalloc.h.3 > dmalloc.h.t 
mv dmalloc.h.t dmalloc.h 
rm -f arg_check.o 
gcc -g -O2 -DHAVE_STDARG_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 - DHAVE_UNISTD_H=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_SYS_TYPES_H=1 - DHAVE_W32API_WINBASE_H=0 -DHAVE_W32API_WINDEF_H=0 -DHAVE_SYS_CYGWIN_H=0 - DHAVE_SIGNAL_H=1 -I. -I. -c arg_check.c -o ./arg_check.o 
In file included from /usr/include/string.h:634:0, 
      from arg_check.c:33: 
dmalloc.h:484:7: error: expected identifier or ‘(’ before ‘__extension__’ 
char *strndup(const char *string, const DMALLOC_SIZE len); 
^
Makefile:362: recipe for target 'arg_check.o' failed 
make: *** [arg_check.o] Error 1 

通過改變dmalloc-5.5.2/dmalloc.h.3解決它智慧:https://dev.openwrt.org/browser/packages/devel/dmalloc/patches/400-undef-strndup.patch?rev=31253