- Posts: 4819
- Thank you received: 0
[Solved] Compile Error when using regular math functions in kinematics file
6 years 8 months ago #158554
by Aciera
I used some math functions in a kinematics file. Things like abs, cos, acos, sin, asine and so forth.
When I try to build it I get this error:
Apparently its a problem with a missing library that needs to be added to the make file. The section for this kinematic file looks like this but I have really not much clue as to what would need to be added.
I would appreciate some guidance as to solve this.
When I try to build it I get this error:
Code:
Linking genserkins
/usr/bin/ld: objects/emc/kinematics/genserfuncs.o: undefined reference to symbol 'acos@@GLIBC_2.0'
//lib/i386-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
emc/kinematics/Submakefile:18: recipe for target '../bin/genserkins' failed
make: *** [../bin/genserkins] Error 1
Apparently its a problem with a missing library that needs to be added to the make file. The section for this kinematic file looks like this but I have really not much clue as to what would need to be added.
Warning: Spoiler!
obj-m += genser-switchkins.o
genser-switchkins-objs := emc/kinematics/genser-switchkins.o
genser-switchkins-objs += emc/kinematics/genserfuncs.o
genser-switchkins-objs += libnml/posemath/gomath.o
genser-switchkins-objs += libnml/posemath/sincos.o $(MATHSTUB)
genser-switchkins-objs += emc/kinematics/kins_util.o
genser-switchkins-objs := emc/kinematics/genser-switchkins.o
genser-switchkins-objs += emc/kinematics/genserfuncs.o
genser-switchkins-objs += libnml/posemath/gomath.o
genser-switchkins-objs += libnml/posemath/sincos.o $(MATHSTUB)
genser-switchkins-objs += emc/kinematics/kins_util.o
I would appreciate some guidance as to solve this.
Please Log in to join the conversation.
6 years 8 months ago #158555
by dgarrett
Replied by dgarrett on topic Compile Error when using regular math functions in kinematics file
please post the output from:
Code:
$ linuxcnc_info
Please Log in to join the conversation.
6 years 8 months ago #158557
by Aciera
Replied by Aciera on topic Compile Error when using regular math functions in kinematics file
Attachment not found
Please Log in to join the conversation.
6 years 8 months ago #158596
by dgarrett
Replied by dgarrett on topic Compile Error when using regular math functions in kinematics file
linuxcnc_info excerpts:
So it appears to be debian stretch with preempt rt kernel.
I cannot reproduce on a similar 64bit stretch virtual machine
but need more information.
1) Are you modifying the primary in-tree Makefile (e.g. src/Makefile)?
or
2) Are you using an independent Makefile?
In either case, please explain in more detail and post:
a)the Makefile used to produce the error message posted at
message 158554
b)the exact directory location of the Makefile
c)the source file(s) using added math functions.
Note: you have both a git tree and a deb install for linuxcnc
and that can lead to hard-to-find errors.
Code:
kernel-vers -v: #1 SMP PREEMPT RT Debian 4.9.189-3+deb9u2 (2019-11-11)
cmdline: BOOT_IMAGE=/boot/vmlinuz-4.9.0-11-rt-686-pae ...
...
gcc: gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
I cannot reproduce on a similar 64bit stretch virtual machine
but need more information.
1) Are you modifying the primary in-tree Makefile (e.g. src/Makefile)?
or
2) Are you using an independent Makefile?
In either case, please explain in more detail and post:
a)the Makefile used to produce the error message posted at
message 158554
b)the exact directory location of the Makefile
c)the source file(s) using added math functions.
Note: you have both a git tree and a deb install for linuxcnc
and that can lead to hard-to-find errors.
Please Log in to join the conversation.
6 years 8 months ago #158601
by Aciera
Replied by Aciera on topic Compile Error when using regular math functions in kinematics file
Thanks so much for looking into this!
So I have uninstalled the deb in the synaptic manager and deleted all the RIP installations.
Then :
$ git clone git://github.com/linuxcnc/linuxcnc.git linuxcnc-dev
$ cd linuxcnc-dev/src
$ ./autogen.sh
$ ./configure --with-realtime=uspace
Returning the message to continue to compile by typing make ....
$ make && sudo make setuid
Build fails:
I tried this a couple of times but I can't build LinuxCNC anymore.
So I have uninstalled the deb in the synaptic manager and deleted all the RIP installations.
Then :
$ git clone git://github.com/linuxcnc/linuxcnc.git linuxcnc-dev
$ cd linuxcnc-dev/src
$ ./autogen.sh
$ ./configure --with-realtime=uspace
Returning the message to continue to compile by typing make ....
$ make && sudo make setuid
Build fails:
Attachment not found
I tried this a couple of times but I can't build LinuxCNC anymore.
Please Log in to join the conversation.
6 years 8 months ago #158603
by Aciera
Replied by Aciera on topic Compile Error when using regular math functions in kinematics file
I'll try a fresh install and report back.
Please Log in to join the conversation.
6 years 8 months ago #158606
by Aciera
Replied by Aciera on topic Compile Error when using regular math functions in kinematics file
tried a fresh Linux Mint 19.1 install and the exact same thing happens when I try to build LinuxCNC from git.
Now I'll try an iso.
Now I'll try an iso.
Please Log in to join the conversation.
6 years 8 months ago #158621
by Aciera
Replied by Aciera on topic Compile Error when using regular math functions in kinematics file
This just threw me on total loop! There must have been something wrong with the linuxcnc-dev on git. I tried about four different systems on two different machines until I decided to just forget about the normal branch and try to build the switchkins-branch.
Turns out that works just fine!
[strike]My kinematics file now also compiles without error.[/strike]
Turns out that works just fine!
[strike]My kinematics file now also compiles without error.[/strike]
Please Log in to join the conversation.
6 years 8 months ago #158641
by Aciera
Replied by Aciera on topic Compile Error when using regular math functions in kinematics file
So I'm back to square 1 with this. Im on a new machine (Linux Mint 19.1 Tessa non realtime kernel)
I've made changes to these two files adding a third kinematics case in genser-switchkins.c which corresponds to a remap to M430. This seems to work.
Of course the difficult part is the actual code for the "gensertoolKinematicsInverse" function. Because I'm having a hard time making sense of all the pointers and go_math functions in the original code I'm trying to use a code by Rudy du Preez
that should actually be able to do the toolcoordinate kinematics I want. So I copied that in.
Since his code does not define any other includes I thought that would work. But when I rebuild I get the error:
Probably totally obvious to other people who actually know what they're doing but I'm stumped.
All hints are welcome.
Thanks
Attachment not found
I've made changes to these two files adding a third kinematics case in genser-switchkins.c which corresponds to a remap to M430. This seems to work.
Attachment not found
Of course the difficult part is the actual code for the "gensertoolKinematicsInverse" function. Because I'm having a hard time making sense of all the pointers and go_math functions in the original code I'm trying to use a code by Rudy du Preez
Attachment not found
Attachment not found
Code:
user@user-iMac:~/linuxcnc-dev/src$ make && sudo make setuid
Reading 194/194 dependency files
Done reading dependencies
Reading 215/215 realtime dependency files
Done reading realtime dependencies
Linking genserkins
/usr/bin/ld: objects/emc/kinematics/genserfuncs.o: undefined reference to symbol 'sincos@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
emc/kinematics/Submakefile:18: recipe for target '../bin/genserkins' failed
make: *** [../bin/genserkins] Error 1
Probably totally obvious to other people who actually know what they're doing but I'm stumped.
All hints are welcome.
Thanks
Please Log in to join the conversation.
6 years 8 months ago #158648
by Aciera
Replied by Aciera on topic Compile Error when using regular math functions in kinematics file
I found this answer to a similar question:
But where would I add that "-lm"?
If your code includes mathematical functions (like exp, cos, etc.), you need to link to the mathematics library libm.so. This is done, just like for serial compiling, by adding -lm to the end of your compile command, that is,
mpicc -o sample sample.c -lm
But where would I add that "-lm"?
Please Log in to join the conversation.
Time to create page: 0.065 seconds
