- Configuring LinuxCNC
- Advanced Configuration
- [Solved] Compile Error when using regular math functions in kinematics file
[Solved] Compile Error when using regular math functions in kinematics file
- Aciera
-
Topic Author
- Offline
- Administrator
-
- Posts: 4324
- Thank you received: 1922
When I try to build it I get this error:
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.
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 or Create an account to join the conversation.
- dgarrett
- Offline
- Platinum Member
-
- Posts: 567
- Thank you received: 325
$ linuxcnc_info
Please Log in or Create an account to join the conversation.
- Aciera
-
Topic Author
- Offline
- Administrator
-
- Posts: 4324
- Thank you received: 1922
Attachments:
Please Log in or Create an account to join the conversation.
- dgarrett
- Offline
- Platinum Member
-
- Posts: 567
- Thank you received: 325
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 or Create an account to join the conversation.
- Aciera
-
Topic Author
- Offline
- Administrator
-
- Posts: 4324
- Thank you received: 1922
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.
Attachments:
Please Log in or Create an account to join the conversation.
- Aciera
-
Topic Author
- Offline
- Administrator
-
- Posts: 4324
- Thank you received: 1922
Please Log in or Create an account to join the conversation.
- Aciera
-
Topic Author
- Offline
- Administrator
-
- Posts: 4324
- Thank you received: 1922
Now I'll try an iso.
Please Log in or Create an account to join the conversation.
- Aciera
-
Topic Author
- Offline
- Administrator
-
- Posts: 4324
- Thank you received: 1922
Turns out that works just fine!
Please Log in or Create an account to join the conversation.
- Aciera
-
Topic Author
- Offline
- Administrator
-
- Posts: 4324
- Thank you received: 1922
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:
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
Attachments:
Please Log in or Create an account to join the conversation.
- Aciera
-
Topic Author
- Offline
- Administrator
-
- Posts: 4324
- Thank you received: 1922
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 or Create an account to join the conversation.
- Configuring LinuxCNC
- Advanced Configuration
- [Solved] Compile Error when using regular math functions in kinematics file