2015-03-02 28 views
1

我第一次嘗試在運行./configure的crosstool-NG是這樣的:嘗試編譯的crosstool-NG-1.20.0

iMac:crosstool-ng-1.20.0 rand$ ./configure --prefix=/opt/local 
--with-libtool=/opt/local/bin/glibtool 
--with-libtoolize=/opt/local/bin/glibtoolize 
--with-objcopy=/opt/local/bin/gobjcopy 
--with-objdump=/opt/local/bin/gobjdump 
--with-readelf=/opt/local/bin/greadelf 
--with-awk=/opt/local/bin/gawk    
--with-sed=/opt/local/bin/gsed 
--with-automake=/opt/local/bin/automake 
--with-wget=/opt/local/bin/wget 
--with-gcc=/opt/local/bin/gcc-mp-4.3 
--with-binutils=/opt/local/bin 

然後喇嘛喇嘛喇嘛...

checking for wget... no 
configure: error: missing required tool: wget 

當然,crosstool-ng確實需要wget。但這很奇怪,因爲我擁有它!

iMac:crosstool-ng-1.20.0 rand$ ls -l /opt/local/bin |grep wget 
-rwxr-xr-x 1 root admin 499672 Mar 1 00:39 wget 

好的,製作了符號鏈接到/ usr/bin,並做了訣竅。我沒有刪除wget前綴,只是爲了看看它是否在其他地方發出警告......而我是對的。

configure: WARNING: unrecognized options: --with-wget, --with-gcc, --with-binutils 

所以我刪除了所有無法識別選項...

iMac:crosstool-ng-1.20.0 rand$ ./configure --prefix=/opt/local 
--with-libtool=/opt/local/bin/glibtool 
--with-libtoolize=/opt/local/bin/glibtoolize 
--with-objcopy=/opt/local/bin/gobjcopy 
--with-objdump=/opt/local/bin/gobjdump 
--with-readelf=/opt/local/bin/greadelf 
--with-awk=/opt/local/bin/gawk    
--with-sed=/opt/local/bin/gsed 
--with-automake=/opt/local/bin/automake 
checking build system type... x86_64-apple-darwin14.1.0 
checking host system type... x86_64-apple-darwin14.1.0 
checking for a BSD-compatible install... /usr/bin/install -c 
checking for grep that handles long lines and -e... /usr/bin/grep 
checking for egrep... /usr/bin/grep -E 
checking for a sed that does not truncate output... (cached) /opt/local/bin/gsed 
checking whether sed understands -r -i -e... yes 
checking whether ln -s works... yes 
checking for gcc... gcc 
checking whether the C compiler works... yes 
checking for C compiler default output file name... a.out 
checking for suffix of executables... 
checking whether we are cross compiling... no 
checking for suffix of object files... o 
checking whether we are using the GNU C compiler... yes 
checking whether gcc accepts -g... yes 
checking for gcc option to accept ISO C89... none needed 
checking how to run the C preprocessor... gcc -E 
checking for ranlib... ranlib 
checking for gperf... gperf 
checking for absolute path to gperf... /usr/bin/gperf 
checking for bison... bison 
checking for flex... flex 
checking for makeinfo... makeinfo 
checking for cut... cut 
checking for stat... stat 
checking for readlink... readlink 
checking for wget... wget 
checking for tar... tar 
checking for gzip... gzip 
checking for bzip2... bzip2 
checking for patch... /usr/bin/patch 
checking for bash >= 3.1... /bin/bash 
checking for GNU awk... (cached) /opt/local/bin/gawk 
checking for GNU make >= 3.80... /usr/bin/make 
checking whether /usr/bin/make sets $(MAKE)... yes 
checking for make 3.81... yes 
checking for GNU libtool >= 1.5.26... (cached) /opt/local/bin/glibtool 
checking for GNU libtoolize >= 1.5.26... (cached) /opt/local/bin/glibtoolize 
checking for GNU automake >= 1.10... (cached) /opt/local/bin/automake 
checking for xz... no 
checking for lzma... no 
checking for cvs... no 
checking for svn... svn 
checking for inline... inline 
checking for ANSI C header files... yes 
checking for sys/types.h... yes 
checking for sys/stat.h... yes 
checking for stdlib.h... yes 
checking for string.h... yes 
checking for memory.h... yes 
checking for strings.h... yes 
checking for inttypes.h... yes 
checking for stdint.h... yes 
checking for unistd.h... yes 
checking for stdlib.h... (cached) yes 
checking for GNU libc compatible malloc... yes 
checking for stdlib.h... (cached) yes 
checking for GNU libc compatible realloc... yes 
checking for size_t... yes 
checking for working alloca.h... yes 
checking for alloca... yes 
checking libintl.h usability... no 
checking libintl.h presence... no 
checking for libintl.h... no 
checking ncurses/ncurses.h usability... no 
checking ncurses/ncurses.h presence... no 
checking for ncurses/ncurses.h... no 
checking ncurses/curses.h usability... no 
checking ncurses/curses.h presence... no 
checking for ncurses/curses.h... no 
checking ncursesw/curses.h usability... no 
checking ncursesw/curses.h presence... no 
checking for ncursesw/curses.h... no 
checking ncurses.h usability... yes 
checking ncurses.h presence... yes 
checking for ncurses.h... yes 
checking for library containing initscr... -lncurses 
configure: creating ./config.status 
config.status: creating Makefile 

...瞧。似乎所有的問題都沒有了(?)

iMac:crosstool-ng-1.20.0 rand$ make 
    SED 'ct-ng' 
    SED 'scripts/crosstool-NG.sh' 
    SED 'scripts/saveSample.sh' 
    SED 'scripts/showTuple.sh' 
    GEN 'config/configure.in' 
    GEN 'paths.mk' 
    GEN 'paths.sh' 
    DEP 'nconf.gui.dep' 
    DEP 'nconf.dep' 
    DEP 'lxdialog/yesno.dep' 
    DEP 'lxdialog/util.dep' 
    DEP 'lxdialog/textbox.dep' 
    DEP 'lxdialog/menubox.dep' 
    DEP 'lxdialog/inputbox.dep' 
    DEP 'lxdialog/checklist.dep' 
    DEP 'mconf.dep' 
    DEP 'conf.dep' 
    BISON 'zconf.tab.c' 
    GPERF 'zconf.hash.c' 
    LEX 'lex.zconf.c' 
    DEP 'zconf.tab.dep' 
    CC  'zconf.tab.o' 
In file included from zconf.tab.c:234: 
./zconf.hash.c:177:8: warning: implicit declaration of function 'offsetof' is invalid in C99 [-Wimplicit-function-declaration] 
     {offsetof(struct kconf_id_strings_t, kconf_id_strings_str2),    T_ON,   TF_PARAM}, 
    ^
./zconf.hash.c:177:17: error: expected expression 
     {offsetof(struct kconf_id_strings_t, kconf_id_strings_str2),    T_ON,   TF_PARAM}, 
       ^
./zconf.hash.c:178:17: error: expected expression 
     {offsetof(struct kconf_id_strings_t, kconf_id_strings_str3),    T_OPT_ENV,  TF_OPTION}, 
       ^
./zconf.hash.c:180:17: error: expected expression 
     {offsetof(struct kconf_id_strings_t, kconf_id_strings_str5),    T_ENDIF,  TF_COMMAND}, 
       ^
./zconf.hash.c:181:17: error: expected expression 
     {offsetof(struct kconf_id_strings_t, kconf_id_strings_str6),    T_OPTION,  TF_COMMAND}, 
       ^
./zconf.hash.c:182:17: error: expected expression 
     {offsetof(struct kconf_id_strings_t, kconf_id_strings_str7),  T_ENDMENU,  TF_COMMAND}, 
       ^
./zconf.hash.c:183:17: error: expected expression 
     {offsetof(struct kconf_id_strings_t, kconf_id_strings_str8),  T_OPTIONAL,  TF_COMMAND}, 
       ^
./zconf.hash.c:184:17: error: expected expression 
     {offsetof(struct kconf_id_strings_t, kconf_id_strings_str9),  T_ENDCHOICE, TF_COMMAND}, 
       ^
./zconf.hash.c:185:17: error: expected expression 
     {offsetof(struct kconf_id_strings_t, kconf_id_strings_str10),    T_RANGE,  TF_COMMAND}, 
       ^
./zconf.hash.c:186:17: error: expected expression 
     {offsetof(struct kconf_id_strings_t, kconf_id_strings_str11),    T_CHOICE,  TF_COMMAND}, 
       ^
./zconf.hash.c:187:17: error: expected expression 
     {offsetof(struct kconf_id_strings_t, kconf_id_strings_str12),  T_DEFAULT,  TF_COMMAND, S_UNKNOWN}, 
       ^
./zconf.hash.c:188:17: error: expected expression 
     {offsetof(struct kconf_id_strings_t, kconf_id_strings_str13),  T_DEFAULT,  TF_COMMAND, S_BOOLEAN}, 
       ^
./zconf.hash.c:189:17: error: expected expression 
     {offsetof(struct kconf_id_strings_t, kconf_id_strings_str14),    T_HELP,   TF_COMMAND}, 
       ^
./zconf.hash.c:191:17: error: expected expression 
     {offsetof(struct kconf_id_strings_t, kconf_id_strings_str16),    T_CONFIG,  TF_COMMAND}, 
       ^
./zconf.hash.c:192:17: error: expected expression 
     {offsetof(struct kconf_id_strings_t, kconf_id_strings_str17),  T_DEFAULT,  TF_COMMAND, S_TRISTATE}, 
       ^
./zconf.hash.c:193:17: error: expected expression 
     {offsetof(struct kconf_id_strings_t, kconf_id_strings_str18),    T_TYPE,   TF_COMMAND, S_HEX}, 
       ^
./zconf.hash.c:194:17: error: expected expression 
     {offsetof(struct kconf_id_strings_t, kconf_id_strings_str19),  T_OPT_DEFCONFIG_LIST,TF_OPTION}, 
       ^
./zconf.hash.c:196:17: error: expected expression 
     {offsetof(struct kconf_id_strings_t, kconf_id_strings_str22),    T_IF,   TF_COMMAND|TF_PARAM}, 
       ^
./zconf.hash.c:197:17: error: expected expression 
     {offsetof(struct kconf_id_strings_t, kconf_id_strings_str23),    T_TYPE,   TF_COMMAND, S_INT}, 
       ^
./zconf.hash.c:199:17: error: expected expression 
     {offsetof(struct kconf_id_strings_t, kconf_id_strings_str27),  T_OPT_MODULES, TF_OPTION}, 
       ^
fatal error: too many errors emitted, stopping now [-ferror-limit=] 
1 warning and 20 errors generated. 
make[2]: *** [zconf.tab.o] Error 1 
make[1]: *** [build-lib-kconfig] Error 2 
make: *** [build] Error 2 

現在我只是不能得到什麼錯。 Mb gcc?正因爲wget的只在/ usr/bin中得到認可,我覺得configure腳本無法識別GCC前綴也是一樣,它在/ usr/bin,其中我的默認的編譯器就是找他:

iMac:crosstool-ng-1.20.0 rand$ gcc --version 
Configured with: -- prefix=/Applications/Xcode.app/Contents/Developer/usr 
--with-gxx-include-dir=/usr/include/c++/4.2.1 
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn) 
Target: x86_64-apple-darwin14.1.0 
Thread model: posix 

但不來自/ opt/local/bin的一個

iMac:crosstool-ng-1.20.0 rand$ /opt/local/bin/gcc-mp-4.3 --version 
gcc-mp-4.3 (MacPorts gcc43 4.3.6_10) 4.3.6 
Copyright (C) 2008 Free Software Foundation, Inc. 

有什麼想法?

回答

3

這是因爲offsetof()需要在OS X上的stddef.h頭這裏有一個補丁,這將確保它包括:

https://sourceware.org/ml/crossgcc/2014-10/msg00021.html

以供將來參考,補丁是:

diff --git a/kconfig/zconf.gperf b/kconfig/zconf.gperf 
index c9e690e..d758a2a 100644 
--- a/kconfig/zconf.gperf 
+++ b/kconfig/zconf.gperf 
@@ -7,6 +7,15 @@ 
%pic 
%struct-type 

+%{ 
+# ifndef offsetof 
+# include <stddef.h> 
+# ifndef offsetof 
+# define offsetof(st, m) ((size_t)(&((st *)0)->m)) 
+# endif 
+# endif 
+%} 
+ 
struct kconf_id; 

static struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len); 

使用patch -p1申請:)