antirez/codakido — Issue #1: compiles only with explicit -lm
Author: badboy
Created: 2012-03-03 10:20:46+00:00
State: open

Compilation fails with an error:

/usr/bin/ld: lua/src/liblua.a(lvm.o): undefined reference to symbol 'floor@@GLIBC_2.2.5'
/usr/bin/ld: note: 'floor@@GLIBC_2.2.5' is defined in DSO /lib/libm.so.6 so try adding it to the linker command line
/lib/libm.so.6: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make: *** [codakido] Error 1

If I explicitly add `-lm` to the Makefile it works just fine:

diff --git i/Makefile w/Makefile
index b6be8ab..9b08f7a 100644
--- i/Makefile
+++ w/Makefile
@@ -1,7 +1,7 @@
all: codakido

codakido: codakido.c lua/src/liblua.a
-	$(CC) -O2 -Wall -W $< `sdl-config --cflags` `sdl-config --libs` lua/src/liblua.a -o $@
+	$(CC) -O2 -Wall -W -lm $< `sdl-config --cflags` `sdl-config --libs` lua/src/liblua.a -o $@

lua/src/liblua.a:
-(cd lua && $(MAKE) ansi)