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

Compiling test_... strips exp() definition before use #5

Open
JeffAbrahamson opened this issue Jul 24, 2020 · 3 comments
Open

Compiling test_... strips exp() definition before use #5

JeffAbrahamson opened this issue Jul 24, 2020 · 3 comments

Comments

@JeffAbrahamson
Copy link

In order to avoid missing math functions when linking the test programs, move the LDFLAGS (which notably contains -lm) to the end of the compile line.

cc -o test_guff test_guff.o -lm \
	args.o ascii.o counter.o draw.o fnv.o input.o regression.o scale.o svg.o  test_draw.o test_input.o test_regression.o test_scale.o test_types.o  -std=c99 -g -Wall -pedantic   -O3
/usr/bin/ld: ascii.o: in function `print_header':
/home/jeff/src/guff/ascii.c:63: undefined reference to `exp'
/usr/bin/ld: /home/jeff/src/guff/ascii.c:63: undefined reference to `exp'
/usr/bin/ld: /home/jeff/src/guff/ascii.c:57: undefined reference to `exp'
/usr/bin/ld: /home/jeff/src/guff/ascii.c:57: undefined reference to `exp'
/usr/bin/ld: scale.o: in function `scale_transform':
/home/jeff/src/guff/scale.c:45: undefined reference to `log'
/usr/bin/ld: /home/jeff/src/guff/scale.c:40: undefined reference to `log'
/usr/bin/ld: /home/jeff/src/guff/scale.c:45: undefined reference to `log'
/usr/bin/ld: /home/jeff/src/guff/scale.c:40: undefined reference to `log'
/usr/bin/ld: svg.o: in function `svg_plot':
/home/jeff/src/guff/svg.c:68: undefined reference to `log'
/usr/bin/ld: svg.o: in function `scale_tick':
/home/jeff/src/guff/svg.c:131: undefined reference to `log10'
/usr/bin/ld: /home/jeff/src/guff/svg.c:131: undefined reference to `pow'
/usr/bin/ld: /home/jeff/src/guff/svg.c:131: undefined reference to `log10'
/usr/bin/ld: /home/jeff/src/guff/svg.c:131: undefined reference to `pow'
collect2: error: ld returned 1 exit status
make: *** [Makefile:38: test_guff] Error 1

0001-Fix-compile-instruction-for-test_.patch.gz

@olivercoad
Copy link

I had the same problem and yep this patch worked for me. You could make a pull request

@JeffAbrahamson
Copy link
Author

I included a patch file.
I don't see how to create a PR from a patch. But git can apply the patch (git apply file.patch), and we can discuss it here in this issue instead of in a PR...

(The patch file is gzipped because github won't upload files that match /.*patch$/.)

@olivercoad
Copy link

I don't see how to create a PR from a patch

I don't think you can without forking the repo

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