Hello, I am trying to build llvm-gcc 4.2 w/ llvm 2.2 on FreeBSD/amd64 and have found that it doesn't seem to want to build shared libraries. I've found numerous notes that I should try --disable-shared, because the linker ends up erroring out with a linker error when building libgcc_s.so. Subsequently, the same error is produced when it attempts to build libstdc++.so. If you do happen to build and install it, any attempt to link a shared library results in this very same behavior. The crtbeginS.o object seems to contain the offending relocation data which ld doesn't like. The following error is what I get: /usr/home/cokane/src/llvm-gcc4.2-2.2.source/host-amd64-undermydesk-freebsd8/gcc/xgcc -B/usr/home/cokane/src/llvm-gcc4.2-2.2.source/host-amd64-undermydesk-freebsd8/gcc/ -B/home/cokane/llvm-root/amd64-undermydesk-freebsd8/bin/ -B/home/cokane/llvm-root/amd64-undermydesk-freebsd8/lib/ -isystem /home/cokane/llvm-root/amd64-undermydesk-freebsd8/include -isystem /home/cokane/llvm-root/amd64-undermydesk-freebsd8/sys-include -O2 -O2 -fPIC -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -pthread -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc/./libgcc.map -o ./libgcc_s.so.1.tmp libgcc/./_muldi3_s.o libgcc/./_negdi2_s.o libgcc/./_lshrdi3_s.o libgcc/./_ashldi3_s.o libgcc/./_ashrdi3_s.o libgcc/./_cmpdi2_s.o libgcc/./_ucmpdi2_s.o libgcc/./_clear_cache_s.o libgcc/./_enable_execute_stack_s.o libgcc/./_trampoline_s.o libgcc/./__main_s.o libgcc/./_absvsi2_s.o libgcc/./_absvdi2_s.o libgcc/./_addvsi3_s.o libgcc/./_addvdi3_s.o libgcc/./_subvsi3_s.o libgcc/./_subvdi3_s.o libgcc/./_mulvsi3_s.o libgcc/./_mulvdi3_s.o libgcc/./_negvsi2_s.o libgcc/./_negvdi2_s.o libgcc/./_ctors_s.o libgcc/./_ffssi2_s.o libgcc/./_ffsdi2_s.o libgcc/./_clz_s.o libgcc/./_clzsi2_s.o libgcc/./_clzdi2_s.o libgcc/./_ctzsi2_s.o libgcc/./_ctzdi2_s.o libgcc/./_popcount_tab_s.o libgcc/./_popcountsi2_s.o libgcc/./_popcountdi2_s.o libgcc/./_paritysi2_s.o libgcc/./_paritydi2_s.o libgcc/./_powisf2_s.o libgcc/./_powidf2_s.o libgcc/./_powixf2_s.o libgcc/./_powitf2_s.o libgcc/./_mulsc3_s.o libgcc/./_muldc3_s.o libgcc/./_mulxc3_s.o libgcc/./_multc3_s.o libgcc/./_divsc3_s.o libgcc/./_divdc3_s.o libgcc/./_divxc3_s.o libgcc/./_divtc3_s.o libgcc/./_bswapsi2_s.o libgcc/./_bswapdi2_s.o libgcc/./_fixunssfsi_s.o libgcc/./_fixunsdfsi_s.o libgcc/./_fixunsxfsi_s.o libgcc/./_fixsfdi_s.o libgcc/./_fixunssfdi_s.o libgcc/./_floatdisf_s.o libgcc/./_floatundisf_s.o libgcc/./_fixdfdi_s.o libgcc/./_fixunsdfdi_s.o libgcc/./_floatdidf_s.o libgcc/./_floatundidf_s.o libgcc/./_fixxfdi_s.o libgcc/./_fixunsxfdi_s.o libgcc/./_floatdixf_s.o libgcc/./_floatundixf_s.o libgcc/./_fixtfdi_s.o libgcc/./_fixunstfdi_s.o libgcc/./_floatditf_s.o libgcc/./_floatunditf_s.o libgcc/./_divdi3_s.o libgcc/./_moddi3_s.o libgcc/./_udivdi3_s.o libgcc/./_umoddi3_s.o libgcc/./_udiv_w_sdiv_s.o libgcc/./_udivmoddi4_s.o libgcc/./unwind-dw2_s.o libgcc/./unwind-dw2-fde_s.o libgcc/./unwind-sjlj_s.o libgcc/./gthr-gnat_s.o libgcc/./unwind-c_s.o -lc && rm -f ./libgcc_s.so && if [ -f ./libgcc_s.so.1 ]; then mv -f ./libgcc_s.so.1 ./libgcc_s.so.1.backup; else true; fi && mv ./libgcc_s.so.1.tmp ./libgcc_s.so.1 && ln -s libgcc_s.so.1 ./libgcc_s.so /usr/bin/ld: /usr/home/cokane/src/llvm-gcc4.2-2.2.source/host-amd64-undermydesk-freebsd8/gcc/crtbeginS.o: relocation R_X86_64_32S can not be used when making a shared object; recompile with -fPIC /usr/home/cokane/src/llvm-gcc4.2-2.2.source/host-amd64-undermydesk-freebsd8/gcc/crtbeginS.o: could not read symbols: Bad value collect2: ld returned 1 exit status gmake[3]: *** [libgcc_s.so] Error 1 gmake[3]: Leaving directory `/usr/home/cokane/src/llvm-gcc4.2-2.2.source/host-amd64-undermydesk-freebsd8/gcc' gmake[2]: *** [libgcc.a] Error 2 gmake[2]: Leaving directory `/usr/home/cokane/src/llvm-gcc4.2-2.2.source/host-amd64-undermydesk-freebsd8/gcc' gmake[1]: *** [all-gcc] Error 2 gmake[1]: Leaving directory `/usr/home/cokane/src/llvm-gcc4.2-2.2.source' gmake: *** [all] Error 2 I am really eager to get this working on my system so that I can play around. Any help would be appreciated. -- Coleman Kane
Try --disable-multilib Ciao, Duncan.
On Feb 15, 2008, at 7:17 PM, Coleman Kane wrote:> Hello, > > I am trying to build llvm-gcc 4.2 w/ llvm 2.2 on FreeBSD/amd64 and > have > found that it doesn't seem to want to build shared libraries. I've > found > numerous notes that I should try --disable-shared, because the linker > ends up erroring out with a linker error when building libgcc_s.so. > Subsequently, the same error is produced when it attempts to build > libstdc++.so. If you do happen to build and install it, any attempt to > link a shared library results in this very same behavior. The > crtbeginS.o object seems to contain the offending relocation data > which > ld doesn't like.This is due to http://llvm.org/PR1711. Please try configuring with -- disable-shared and --disable-bootstrap. -Chris
Duncan Sands wrote:> Try --disable-multilib > > Ciao, > > Duncan. >The configure line for this build was: env CPPFLAGS=-fPIC CFLAGS=-fPIC CXXFLAGS=-fPIC ./configure --enable-llvm=/home/cokane/src/llvm-2.2/Release --prefix=/home/cokane/llvm-root --enable-languages=c,c++ --disable-nls --with-system-zlib --with-libiconv-prefix=/usr/local --enable-shared --enable-pic --with-pic --disable-bootstrap --disable-multilib I am aware that I *can* get the compiler to build if I also --disable-shared. This, however, just hides the fact that the linker won't link crtbeginS.o to a shared library (as the GCC build doesn't end up building any). When I later go to build shared libraries, it fails linking with the same error message. So it seems that the compiler can only be used for statically linked projects, in my case. -- Coleman
Apparently Analagous Threads
- [LLVMdev] llvm-gcc near tip causing crash in /usr/bin/ld due to memory corruption on linux x86_64
- [LLVMdev] building llvm-gcc on Ubuntu 11.04 Natty Narwhal
- [LLVMdev] Problems building llvm-gcc-4.2 on ppc32, OS X 10.4.10
- [LLVMdev] Linux Kernel Compile for Sparc v8 Arch
- Xenclient build error for crti.o