whpthomas / GPX

Gcode to x3g conversion post processor
GNU General Public License v2.0
98 stars 16 forks source link

undefined reference to 'sqrt' #25

Open unicornmafia opened 6 years ago

unicornmafia commented 6 years ago

I am building on linux. It looks like there is a problem accessing the math libraries.

make --trace
Makefile:24: update target 'getopt.o' due to: getopt.c
cc -c -w getopt.c -o getopt.o
Makefile:24: update target 'gpx.o' due to: gpx.c
cc -c -w gpx.c -o gpx.o
Makefile:24: update target 'gpx-main.o' due to: gpx-main.c
cc -c -w gpx-main.c -o gpx-main.o
Makefile:20: update target 'gpx' due to: getopt.o gpx.o gpx-main.o
cc -lm getopt.o gpx.o gpx-main.o -o gpx
gpx.o: In function `magnitude':
gpx.c:(.text+0x1c4b): undefined reference to `sqrt'
gpx.o: In function `mm_to_steps':
gpx.c:(.text+0x2256): undefined reference to `round'
gpx.c:(.text+0x227d): undefined reference to `round'
gpx.c:(.text+0x22a4): undefined reference to `round'
gpx.c:(.text+0x22f4): undefined reference to `round'
gpx.c:(.text+0x2350): undefined reference to `round'
gpx.o:gpx.c:(.text+0x2390): more undefined references to `round' follow
collect2: error: ld returned 1 exit status
Makefile:20: recipe for target 'gpx' failed
make: *** [gpx] Error 1

here's my version

uname -a
Linux 4.4.0-116-generic #140-Ubuntu SMP Mon Feb 12 21:23:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
CountMurphy commented 6 years ago

Reading the pull requests, it looks like this has been mentioned (and fixed) before: https://github.com/whpthomas/GPX/pull/24

unicornmafia commented 6 years ago

Ah yes, moving the -lm after the objects worked for me too. thanks!

CountMurphy commented 6 years ago

Also please note that this repo is not under active development. This repo (https://github.com/markwal/GPX) is.