guff icon indicating copy to clipboard operation
guff copied to clipboard

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

Open JeffAbrahamson opened this issue 4 years ago • 3 comments

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

JeffAbrahamson avatar Jul 24 '20 08:07 JeffAbrahamson

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

olivercoad avatar Jul 24 '20 18:07 olivercoad

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$/.)

JeffAbrahamson avatar Jul 24 '20 19:07 JeffAbrahamson

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

I don't think you can without forking the repo

olivercoad avatar Jul 25 '20 00:07 olivercoad