Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libm underlinking #11

Closed
richardgv opened this issue Jan 10, 2013 · 1 comment
Closed

libm underlinking #11

richardgv opened this issue Jan 10, 2013 · 1 comment

Comments

@richardgv
Copy link

pixz-1.0.2 does not link correctly with ld.gold, because of an underlinking issue:

...
x86_64-pc-linux-gnu-gcc   -Wall -Wl,-O1 -Wl,--as-needed -o pixz pixz.o common.o endian.o cpu.o read.
o write.o list.o -lpthread -llzma -larchive
common.o:common.c:function pipeline_create: error: undefined reference to 'ceil'
collect2: error: ld returned 1 exit status
make: *** [pixz] Error 1

ceil() is used in the program but -lm is not in linking flags. Add -lm to LIDADD looks sufficient to fix the issue:

diff --git a/Makefile~ b/Makefile
index fe605f2..36dc27b 100644
--- a/Makefile~
+++ b/Makefile
@@ -12,7 +12,7 @@ MYCFLAGS = $(patsubst %,-I%/include,$(LIBPREFIX)) $(OPT) -std=gnu99 \
 MYLDFLAGS = $(patsubst %,-L%/lib,$(LIBPREFIX)) $(OPT) -Wall

 THREADS = -lpthread
-LIBADD = $(THREADS) -llzma -larchive
+LIBADD = $(THREADS) -llzma -larchive -lm

 CC = gcc
 COMPILE = $(CC) $(MYCFLAGS) $(CFLAGS) -c -o
@vasi
Copy link
Owner

vasi commented Jan 10, 2013

Thank you for the report. Fixed in HEAD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants