|
|
|
|
 编译好gcc后,gcc的默认库路径如何设置? - baishaolin [ 2006-04-14 16:03 | 194 byte(s)]
 Re: 编译好gcc后,gcc的默认库路径如何设置? - xhbdahai [ 2006-09-12 13:36 | 128 byte(s)]
 Re: 编译好gcc后,gcc的默认库路径如何设置? - leviathan [ 2006-09-13 10:11 | 77 byte(s)]
 Re: 编译好gcc后,gcc的默认库路径如何设置? - canopy [ 2006-04-14 23:12 | 26 byte(s)]
 Re: 编译好gcc后,gcc的默认库路径如何设置? - baishaolin [ 2006-04-15 09:34 | 686 byte(s)]
 Re: 编译好gcc后,gcc的默认库路径如何设置? - canopy [ 2006-04-15 22:08 | 100 byte(s)]
 Re: 编译好gcc后,gcc的默认库路径如何设置? - baishaolin [ 2006-04-16 18:00 | 67 byte(s)]
 Re: 编译好gcc后,gcc的默认库路径如何设置? - canopy [ 2006-04-16 22:34 | 90 byte(s)]
 Re: 编译好gcc后,gcc的默认库路径如何设置? - baishaolin [ 2006-04-17 18:09 | 97 byte(s)]
 Re: 编译好gcc后,gcc的默认库路径如何设置? - EricFisher [ 2006-04-18 09:06 | 168 byte(s)]
 Re: 编译好gcc后,gcc的默认库路径如何设置? - EricFisher [ 2006-04-14 16:20 | 702 byte(s)]
 Re: 编译好gcc后,gcc的默认库路径如何设置? - baishaolin [ 2006-04-14 16:49 | 530 byte(s)]
 Re: 编译好gcc后,gcc的默认库路径如何设置? - EricFisher [ 2006-04-14 21:34 | 364 byte(s)]
 Re: 编译好gcc后,gcc的默认库路径如何设置? - baishaolin [ 2006-04-15 08:49 | 225 byte(s)]
|
|
|
|
[Original]
[Print]
[Top]
|
|
现在我编译好了gcc-4.0.1,但是库路径总是找不对。 我试着设置了LD_LIBRARY_PATH, 在编译的时候也用过-L指定新的库路径,但是gcc总是先 找/usr/lib目录下。还请大侠们支招!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
在编译binutils和gcc时,尝试一下使用这个选项:
--with-sysroot=dir
Tells GCC to consider dir as the root of a tree that contains a (subset of) the root filesystem of the target operating system. Target system headers, libraries and run-time object files will be searched in there. The specified directory is not copied into the install tree, unlike the options --with-headers and --with-libs that this option obsoletes. The default value, in case --with-sysroot is not given an argument, is ${gcc_tooldir}/sys-root. If the specified directory is a subdirectory of ${exec_prefix}, then it will be found relative to the GCC binaries if the installation tree is moved.
|
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
EricFisher:你好! 我可能没有说清楚。我现在已经编译好并安装了gcc, 用新生成的gcc编译hello.c的时候, 会出现
/usr/lib/crt1.o: In function `_start':
../sysdeps/i386/elf/start.S:71: undefined reference to `__libc_csu_fini'
../sysdeps/i386/elf/start.S:72: undefined reference to `__libc_csu_init'
../sysdeps/i386/elf/start.S:81: undefined reference to `__libc_start_main'
/usr/lib/crt1.o是原来的库,现在的新crt1.o库在其他的目录下,我怎么能够让gcc运行的时候就能正确定位lib库的位置?
|
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
试试这个:
“You can prevent GCC from searching any of the default directories with the -nostdinc option. This is useful when you are compiling an operating system kernel or some other program that does not use the standard C library facilities, or the standard C library itself. -I options are not ignored as described above when -nostdinc is in effect”
|
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
gcc寻找共享库的时候, -I -L 指定的目录 要排在默认设置目录之后 才进行搜索。 我不知道怎么改默认路径。我用gcc -print-search-file 命令,会打印出gcc 搜索的程序和库目录. 我只有将那些库搬到那些指定的目录中去。编译才通过。
|
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
gcc -v 后 输出的内容
[root@localhost bin]# gcc -v
使用内建 specs。
目标:i386-redhat-linux
配置为:../gcc-4.0.1/configure --prefix=/usr/local/gcc --enable-threads=posix --disable-checking --enable--long-long --host=i386-redhat-linux --with-system-zlib --enable-languages=c,c++,java : (reconfigured) ../gcc-4.0.1/configure --host=i386-redhat-linux --build=i386-redhat-linux --enable-multilib --prefix=/usr/local/gcc --enable-threads=posix --disable-checking --enable--long-long --with-system-zlib --with-gcc-version-trigger=/usr/rtems/download/gcc-4.0.1/gcc/version.c --enable-languages=c,c++
线程模型:posix
gcc 版本 4.0.1
|
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
gcc本身有自己的path search规则,库的安装路径是configure库时指定的,两者没有关系。
gcc参考上介绍,-nostdinc可以禁止gcc按照默认的规则进行搜索,不过我没有尝试过。
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
|
先使用-nostdinc和-nostdlib禁止掉所有的标准头文件和库文件的搜索目录,之后在命令行通过-I 和-L 指定你想要的头文件目录和库文件目录。
|
|
----
路漫漫兮修远兮,吾将上下而求索!
|
|
[Original]
[Print]
[Top]
|
|
|