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

math.h error in makefile #1

Open
dhiaeddine opened this issue Jun 19, 2014 · 4 comments
Open

math.h error in makefile #1

dhiaeddine opened this issue Jun 19, 2014 · 4 comments

Comments

@dhiaeddine
Copy link

i found an error in the make file while compiling the gen tabs.you forgot to add the -lm flag
i suggest to change the line 166 in Makefile.ini to be like this :

$(gentab_programs) : % : %.c ./include/liquidfpm.h
$(CC) $(INCLUDE_CFLAGS) $(CFLAGS) -lm $^ $(LDFLAGS)-o $@

@jgaeddert
Copy link
Owner

Line 167 already includes the C math library linkage:

$(gentab_programs) : % : %.c ./include/liquidfpm.h

If you're still having trouble compiling I will gladly help you. Sometimes I've noticed that different versions of gcc are more strict about the ordering of compiler flags; namely that when compiling and linking in a single line the linker flags need to come at the END of the command.

Please let me know if you're still having trouble compiling.

@starxiang
Copy link

Hi, I found an error when I do the "make" order, The following error message showed

gcc -I . -I include -lm gentab/gentab.logsin.c -o gentab/gentab.logsin
/tmp/ccEMtk6v.o: In function main': gentab.logsin.c:(.text+0x3bb): undefined reference to sin'
gentab.logsin.c:(.text+0x548): undefined reference to `log2'
collect2: error: ld returned 1 exit status
makefile:183: recipe for target 'gentab/gentab.logsin' failed
make: *** [gentab/gentab.logsin] Error 1

I use Ubuntu 18.04, and gcc version is 7.3.0 (gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0)

@jgaeddert
Copy link
Owner

Try moving the linker flags to the end of the line. Newer versions of gcc are more strict about command-line ordering.

@unkadoug
Copy link

I expect this behavior is common to all compilers/linkers in a Unix-like environment. May I suggest that you fix this at your end, rather than requiring every user to correct it individually?

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

4 participants