build fails on fedora-16 due to missing -lm

Issue #8 resolved
John Ellson
created an issue

Linking C executable copyrotated
/usr/bin/ld: CMakeFiles/copyrotated.dir/copyrotated.o: undefined reference to symbol 'sin@@GLIBC_2.2.5'
/usr/bin/ld: note: 'sin@@GLIBC_2.2.5' is defined in DSO /lib64/libm.so.6 so try adding it to the linker command line
/lib64/libm.so.6: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[2]: [examples/copyrotated] Error 1
make[1]:
[examples/CMakeFiles/copyrotated.dir/all] Error 2
make: *** [all] Error 2

===========================

configure.ac has tests for -lm - I guess copyrotated isn't using that?

Not sure thus is the right fix, but I was able to workaround with:

============================

diff -r 733361a31aab examples/CMakeLists.txt
--- a/examples/CMakeLists.txt Fri Jun 17 16:09:25 2011 +0900
+++ b/examples/CMakeLists.txt Fri Nov 04 15:25:20 2011 -0400
@@ -32,7 +32,7 @@

FOREACH(test_name ${TESTS_FILES})
add_executable(${test_name} "${test_name}.c")
- target_link_libraries (${test_name} ${GD_LIB})
+ target_link_libraries (${test_name} ${GD_LIB} -lm)
ENDFOREACH(test_name)

if (WIN32 AND NOT MINGW AND NOT MSYS)

Comments (2)

  1. Anonymous

    I ran into the same problem building on a LFS 7.1 system and can verify that John Ellson's patch allows gd to compile successfully.

  2. Log in to comment