hurd 发表于 2007-9-23 23:22:37

请教达人gcc4.2问题。

我做panabit的机器同时想跑其他东西,因为感觉光跑这个太浪费了,平时cpu占用都非常低。

我在安装一些软件不成功看说明时,似乎软件不支持gcc 2.9了。
于是我在bsd 4.11下编译安装了gcc-4.2.2_20070905。请问我如何设置/etc/make.conf让gcc 4.2代替系统默认的gcc2.9编译安装ports软件?

在这里先谢谢个位热心的朋友:)

hurd 发表于 2007-9-23 23:26:31

root@pl /usr/local/bin#/usr/local/bin/gcc42 -v
Using built-in specs.
Target: i386-portbld-freebsd4.11
Configured with: ./..//gcc-4.2-20070905/configure --disable-libgomp --disable-nls --with-system-zlib --with-libiconv-prefix=/usr/local --with-gmp=/usr/local --program-suffix=42 --libdir=/usr/local/lib/gcc-4.2.2 --with-gxx-include-dir=/usr/local/lib/gcc-4.2.2/include/c++/ --disable-libgcj --prefix=/usr/local --mandir=/usr/local/man --infodir=/usr/local/info/gcc42 i386-portbld-freebsd4.11
Thread model: posix
gcc version 4.2.2 20070905 (prerelease)

我猜测在/etc/make.conf中改变 CC 等设置应该可以,但是不确定具体如何改。希望各位指点下。

hurd 发表于 2007-9-23 23:37:21

我 把 CC=/usr/local/bin/gcc42 CXX=/usr/local/bin/g++42 加到/etc/make.conf, 编译lighttpd时仍然出错误。



(cd .libs && rm -f mod_fastcgi.la && ln -s ../mod_fastcgi.la mod_fastcgi.la)
/bin/sh /usr/local/bin/libtool --tag=CC    --mode=compile /usr/local/bin/gcc42 -DHAVE_CONFIG_H -DLIBRARY_DIR="\"/usr/local/lib/lighttpd\"" -DSBIN_DIR="\"/usr/local/sbin\"" -I. -I..    -D_REENTRANT -D__EXTENSIONS__ -I/usr/include -DOPENSSL_NO_KRB5 -I/usr/local/include -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES-O -pipe -march=pentiumpro -I/usr/local/include -Wall -W -Wshadow -pedantic -std=gnu99 -MT mod_extforward.lo -MD -MP -MF .deps/mod_extforward.Tpo -c -o mod_extforward.lo mod_extforward.c
/usr/local/bin/gcc42 -DHAVE_CONFIG_H -DLIBRARY_DIR=\"/usr/local/lib/lighttpd\" -DSBIN_DIR=\"/usr/local/sbin\" -I. -I.. -D_REENTRANT -D__EXTENSIONS__ -I/usr/include -DOPENSSL_NO_KRB5 -I/usr/local/include -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES -O -pipe -march=pentiumpro -I/usr/local/include -Wall -W -Wshadow -pedantic -std=gnu99 -MT mod_extforward.lo -MD -MP -MF .deps/mod_extforward.Tpo -c mod_extforward.c-fPIC -DPIC -o .libs/mod_extforward.o
In file included from mod_extforward.c:9:
/usr/include/netinet/in.h:235: error: expected specifier-qualifier-list before 'in_addr_t'
/usr/include/netinet/in.h:287: error: expected specifier-qualifier-list before 'u_char'
In file included from /usr/include/netinet/in.h:493,
               from mod_extforward.c:9:
/usr/include/netinet6/in6.h:122: error: expected specifier-qualifier-list before 'u_int8_t'
/usr/include/netinet6/in6.h:144: error: expected specifier-qualifier-list before 'u_int8_t'
/usr/include/netinet6/in6.h:612: error: expected ';', ',' or ')' before '*' token
/usr/include/netinet6/in6.h:614: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
/usr/include/netinet6/in6.h:615: error: expected declaration specifiers or '...' before 'u_int8_t'
/usr/include/netinet6/in6.h:616: error: expected declaration specifiers or '...' before 'u_int8_t'
/usr/include/netinet6/in6.h:631: error: expected declaration specifiers or '...' before 'u_int8_t'
/usr/include/netinet6/in6.h:631: error: expected declaration specifiers or '...' before 'u_int8_t'
/usr/include/netinet6/in6.h:636: error: expected declaration specifiers or '...' before 'u_int8_t'
/usr/include/netinet6/in6.h:638: error: expected declaration specifiers or '...' before 'u_int8_t'
mod_extforward.c: In function 'mod_extforward_uri_handler':
mod_extforward.c:354: error: 'struct sockaddr_in' has no member named 'sin_addr'
mod_extforward.c:404: error: 'struct sockaddr_in' has no member named 'sin_addr'
mod_extforward.c:405: error: 'struct sockaddr_in' has no member named 'sin_addr'
mod_extforward.c:383: warning: unused variable 'addrs_left'
*** Error code 1

Stop in /usr/ports/www/lighttpd/work/lighttpd-1.4.18/src.
*** Error code 1

Stop in /usr/ports/www/lighttpd/work/lighttpd-1.4.18.
*** Error code 1

Stop in /usr/ports/www/lighttpd/work/lighttpd-1.4.18.
*** Error code 1

Stop in /usr/ports/www/lighttpd.
*** Error code 1

Stop in /usr/ports/www/lighttpd.

请问各位有什么办法解决?

hurd 发表于 2007-9-23 23:48:21

Some influential environment variables:
CC          C compiler command
CFLAGS      C compiler flags
LDFLAGS   linker flags, e.g. -L<lib dir> if you have libraries in a
            nonstandard directory <lib dir>
LIBS      libraries to pass to the linker, e.g. -l<library>
CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
            you have headers in a nonstandard directory <include dir>
CPP         C preprocessor
CXX         C++ compiler command
CXXFLAGS    C++ compiler flags
CXXCPP      C++ preprocessor
F77         Fortran 77 compiler command
FFLAGS      Fortran 77 compiler flags
PKG_CONFIGpath to pkg-config utility
FAM_CFLAGSC compiler flags for FAM, overriding pkg-config
FAM_LIBS    linker flags for FAM, overriding pkg-config
XML_CFLAGSC compiler flags for XML, overriding pkg-config
XML_LIBS    linker flags for XML, overriding pkg-config
SQLITE_CFLAGS
            C compiler flags for SQLITE, overriding pkg-config
SQLITE_LIBS linker flags for SQLITE, overriding pkg-config
LUA_CFLAGSC compiler flags for LUA, overriding pkg-config
LUA_LIBS    linker flags for LUA, overriding pkg-config

这个是 ./configure列出的帮助的一部分。

-r-xr-xr-x4 rootwheel    171K Sep 24 00:12 c++42
-rwxr-xr-x1 rootwheel    170K Sep 24 00:12 cpp42
-r-xr-xr-x4 rootwheel    171K Sep 24 00:12 g++42
-r-xr-xr-x3 rootwheel    169K Sep 24 00:12 gcc42
-r-xr-xr-x1 rootwheel   15K Sep 24 00:12 gccbug42
-r-xr-xr-x1 rootwheel   24K Sep 24 00:12 gcov42
-r-xr-xr-x2 rootwheel    172K Sep 24 00:12 gfortran42
-r-xr-xr-x4 rootwheel    171K Sep 24 00:12 i386-portbld-freebsd4.11-c++42
-r-xr-xr-x4 rootwheel    171K Sep 24 00:12 i386-portbld-freebsd4.11-g++42
-r-xr-xr-x3 rootwheel    169K Sep 24 00:12 i386-portbld-freebsd4.11-gcc42
-r-xr-xr-x2 rootwheel    172K Sep 24 00:12 i386-portbld-freebsd4.11-gfortran42
这个是安装gcc42后的相关2进制文件。

似乎用到了CC      C compiler command , CPP         C preprocessor, CXX         C++ compiler command, CXXCPP      C++ preprocessor,F77         Fortran 77 compiler command。 不知道都对应那些文件?

panabit 发表于 2007-9-24 10:27:26

原帖由 hurd 于 2007-9-23 23:48 发表 http://www.panabit.com/forum/images/common/back.gif
Some influential environment variables:
CC          C compiler command
CFLAGS      C compiler flags
LDFLAGS   linker flags, e.g. -L if you have libraries in a
            nonstandar ...
你的这个问题到www.freebsdchina.org里估计会更好一些,这里可能没有人熟悉。
页: [1]
查看完整版本: 请教达人gcc4.2问题。