Hi all!
I ran into a problem at building TDE for FreeBSD last weekend: - When I compile "tdelibs" with "-DHAVE_PIE_SUPPORT=OFF", then "tquic" segfaults when building "tdebase", i.e. dlopen() of any library built without PIE fails. - When I compile "tdelibs" without "-DHAVE_PIE_SUPPORT=OFF", then the build of "tdelibs" fails at certain points with "/usr/local/bin/ld: /usr/lib/crt1.o: relocation R_X86_64_32 against `_DYNAMIC' can not be used when making a shared object; recompile with -fPIC" - When I add "-shared" to the compiler switches for cmake, the build fails.
I assume that HAVE_PIE_SUPPORT is a must, otherwise the built libraries do not work. Compilig fails the first time on "kgrantpty" with these messages:
Scanning dependencies of target kgrantpty make -f tdecore/CMakeFiles/kgrantpty.dir/build.make tdecore/CMakeFiles/kgrantpty.dir/build /usr/local/bin/cmake -E cmake_progress_report /tmp/tdelibs.build/CMakeFiles [ 11%] Building C object tdecore/CMakeFiles/kgrantpty.dir/kgrantpty.c.o cd /tmp/tdelibs.build/tdecore && /usr/bin/gcc -DHAVE_CONFIG_H -fPIC -I/opt/trinity/include -I/opt/trinity/include/tqt -I/tmp/tdelibs.build/tdecore -I/tmp/tdelibs.build -I/tmp/tdelibs/tdecore -I/tmp/tdelibs/tdecore/network -I/tmp/tdelibs/dcop -I/tmp/tdelibs/libltdl -I/tmp/tdelibs/tdefx -I/tmp/tdelibs/tdeui -I/tmp/tdelibs/tdeio/tdeio -fPIE -o CMakeFiles/kgrantpty.dir/kgrantpty.c.o -c /tmp/tdelibs/tdecore/kgrantpty.c Linking C executable kgrantpty cd /tmp/tdelibs.build/tdecore && /usr/local/bin/cmake -E cmake_link_script CMakeFiles/kgrantpty.dir/link.txt --verbose=1 /usr/bin/gcc -fPIC -pie CMakeFiles/kgrantpty.dir/kgrantpty.c.o -o kgrantpty -L/opt/trinity/lib -L/usr/local/lib /usr/local/bin/ld: /usr/lib/crt1.o: relocation R_X86_64_32 against `_DYNAMIC' can not be used when making a shared object; recompile with -fPIC /usr/lib/crt1.o: error adding symbols: Bad value collect2: error: ld returned 1 exit status *** Error code 1
I can add a "-shared" to the compiler directive and this part will work, i.e:
$ /usr/bin/gcc -DHAVE_CONFIG_H -fPIC -I/opt/trinity/include -I/opt/trinity/include/tqt -I/tmp/tdelibs.build/tdecore -I/tmp/tdelibs.build -I/tmp/tdelibs/tdecore -I/tmp/tdelibs/tdecore/network -I/tmp/tdelibs/dcop -I/tmp/tdelibs/libltdl -I/tmp/tdelibs/tdefx -I/tmp/tdelibs/tdeui -I/tmp/tdelibs/tdeio/tdeio -fPIE -o CMakeFiles/kgrantpty.dir/kgrantpty.c.o -c /tmp/tdelibs/tdecore/kgrantpty.c -shared
But it fails later once again and I absolutly do not know what to do about it:
[ 40%] Building C object tdeio/misc/kpac/CMakeFiles/kpac_dhcp_helper.dir/kpac_dhcp_helper.c.o cd /tmp/tdelibs.build/tdeio/misc/kpac && /usr/bin/gcc -DHAVE_CONFIG_H -D_LARGEFILE64_SOURCE=1 -fPIC -I/opt/trinity/include -I/opt/trinity/include/tqt -I/tmp/tdelibs.build/tdeio/misc/kpac -I/tmp/tdelibs.build -I/tmp/tdelibs.build/tdecore -I/tmp/tdelibs.build/kjs -I/tmp/tdelibs -I/tmp/tdelibs/dcop -I/tmp/tdelibs/tdecore -I/tmp/tdelibs/tdecore/network -I/tmp/tdelibs/tdeio -I/tmp/tdelibs/tdeio/tdeio -I/tmp/tdelibs/kded -fPIE -o CMakeFiles/kpac_dhcp_helper.dir/kpac_dhcp_helper.c.o -c /tmp/tdelibs/tdeio/misc/kpac/kpac_dhcp_helper.c Linking C executable kpac_dhcp_helper cd /tmp/tdelibs.build/tdeio/misc/kpac && /usr/local/bin/cmake -E cmake_link_script CMakeFiles/kpac_dhcp_helper.dir/link.txt --verbose=1 /usr/bin/gcc -fPIC -pie CMakeFiles/kpac_dhcp_helper.dir/kpac_dhcp_helper.c.o -o kpac_dhcp_helper -L/opt/trinity/lib /usr/local/bin/ld: /usr/lib/crt1.o: relocation R_X86_64_32 against `_DYNAMIC' can not be used when making a shared object; recompile with -fPIC /usr/lib/crt1.o: error adding symbols: Bad value collect2: error: ld returned 1 exit status *** Error code 1
At this pount adding "-shared" does not solve the problem:
/usr/bin/gcc -fPIC -pie CMakeFiles/kpac_dhcp_helper.dir/kpac_dhcp_helper.c.o -o kpac_dhcp_helper -L/opt/trinity/lib -shared /usr/local/bin/ld: CMakeFiles/kpac_dhcp_helper.dir/kpac_dhcp_helper.c.o: relocation R_X86_64_PC32 against symbol `get_port' can not be used when making a shared object; recompile with -fPIC /usr/local/bin/ld: final link failed: Bad value collect2: error: ld returned 1 exit status
So, what am I missing?
Nik
On Monday 04 of May 2015 08:50:04 Dr. Nikolaus Klepp wrote:
Hi all!
I ran into a problem at building TDE for FreeBSD last weekend:
- When I compile "tdelibs" with "-DHAVE_PIE_SUPPORT=OFF", then "tquic"
segfaults when building "tdebase", i.e. dlopen() of any library built without PIE fails. - When I compile "tdelibs" without "-DHAVE_PIE_SUPPORT=OFF", then the build of "tdelibs" fails at certain points with "/usr/local/bin/ld: /usr/lib/crt1.o: relocation R_X86_64_32 against `_DYNAMIC' can not be used when making a shared object; recompile with -fPIC" - When I add "-shared" to the compiler switches for cmake, the build fails.
I assume that HAVE_PIE_SUPPORT is a must, otherwise the built libraries do not work. Compilig fails the first time on "kgrantpty" with these messages:
It is at all not expected to be entered -DHAVE_PIE_SUPPORT as a build option. The value is usually set automatically by the compiler flags availability. See check_cxx_compiler_flag( -fPIE HAVE_PIE_SUPPORT ) in cmake/modules/TDEMacros.cmake
For now I have not looking the causes of the problems - I need to find time to analyze and solve bug 2437.