RPi4 MK package trouble and build link error

147 views
Skip to first unread message

Joseph

unread,
Oct 26, 2019, 6:35:15 PM10/26/19
to Machinekit
First issue: Tried installing the MK package on RPi4 but get dependency error as follows

pi@rpi4-2gb:~ $ sudo apt-get install machinekit-rt-preempt
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 machinekit-rt-preempt : Depends: machinekit (= 0.1.1570528621.git9239acb-1~buster) but it is not going to be installed
                         Depends: yapps2-runtime but it is not installable
E: Unable to correct problems, you have held broken packages.



Second issue: building MK on RPi4 native and get link error
/usr/bin/ld: objects/hal/utils/halcmd_commands.o: undefined reference to symbol '__atomic_load_8@@LIBATOMIC_1.0'
/usr/bin/ld: //usr/lib/arm-linux-gnueabihf/libatomic.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [hal/utils/Submakefile:32: ../bin/halcmd] Error 1
make: Leaving directory '/home/pi/machinekit/src'

The library is present and running strings on it shows the symbol is available

pi@rpi4-2gb:/usr/lib/arm-linux-gnueabihf $ ls -l libatom*
lrwxrwxrwx 1 root root    18 Apr 15  2019 libatomic.so.1 -> libatomic.so.1.2.0
-rw-r--r-- 1 root root 30104 Apr 15  2019 libatomic.so.1.2.0
pi@rpi4-2gb:/usr/lib/arm-linux-gnueabihf $ strings libatomic.so.1.2.0
fU.+
fU2+
__gmon_start__
_ITM_deregisterTMCloneTable
_ITM_registerTMCloneTable
__cxa_finalize
__atomic_load_8
memcpy
__atomic_load_1
__atomic_load_2
__atomic_load_4
__atomic_load
...

Has anyone successfully built MK for the RPi4?  If so would you share your method?

Thank you,   Joe

Michael Brown

unread,
Oct 27, 2019, 2:02:35 PM10/27/19
to Machinekit
Are you running a 32-bit(armhf) or 64-bit(arm64) build ?

Michael

Joseph

unread,
Oct 27, 2019, 3:08:05 PM10/27/19
to Machinekit
Standard 32-bit armhf image.  Built 4.19.y-rt kernel7l image and installed.

Joe

Michael Brown

unread,
Oct 28, 2019, 12:27:43 AM10/28/19
to Machinekit
You do not mention which os you are targeting I'll assume its buster from snibbles of what you present:

I'm not sure the Machinekit repo is fully prepaired/updated for Debian Buster (as the split -cnc/-hal repos are)
So to build natively for buster I'll recommend cloning the machinekit-hal repo and following the instructions:

If you want to build as a RIP, you need to clone machinekit-hal.

From the root of that clone run scripts/build_with_cnc

This will clone machinekit-cnc into the root of the machinekit-hal clone.

machinekit-hal is built, then machinekit-cnc is built with necessary artifacts from machinekit-hal build copied over.

Then the required libs/binaries/scripts/configs etc are copied into machinekit-hal and the environment var is set ready to run the RIP



Personally I prefer having docker installed and cross-building the packages via the docker-builder locally (see Building locally  section)

Best wishes
Michael

Joseph Heath

unread,
Oct 28, 2019, 9:12:57 AM10/28/19
to Michael Brown, Machinekit
Thank you, Michael.

I am using a brand new RPi4 so, yes, it is buster.  Set up using machinekit-hal as instructed.  Getting the same link error.
Compiling hal/utils/halcmd_commands.c
Compiling hal/utils/halsh.c
Linking hal.so
Compiling hal/utils/halcmd_main.c
Compiling hal/utils/halcmd_completion.c
Linking halcmd

/usr/bin/ld: objects/hal/utils/halcmd_commands.o: undefined reference to symbol '__atomic_load_8@@LIBATOMIC_1.0'
/usr/bin/ld: //usr/lib/arm-linux-gnueabihf/libatomic.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [hal/utils/Submakefile:32: ../bin/halcmd] Error 1
make: Leaving directory '/home/pi/machinekit-hal/src'

Is there an expectation for a specific libatomic version?  The library on the machine is v1.2.0 not 1.0.n.
It appears the symbol is present in the 1.2 library.
pi@raspberrypi:/usr/lib/arm-linux-gnueabihf $ strings libatomic.so.1.2.0 | grep __atomic_load
__atomic_load_8
__atomic_load_1
__atomic_load_2
__atomic_load_4
__atomic_load

Ever onward,   Joe
...


--
website: http://www.machinekit.io blog: http://blog.machinekit.io github: https://github.com/machinekit
---
You received this message because you are subscribed to a topic in the Google Groups "Machinekit" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/machinekit/gUgofN5YAPQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to machinekit+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/machinekit/9f8b99a7-da0f-42e6-8e73-b866e7b2c1a8%40googlegroups.com.

Michael Brown

unread,
Oct 28, 2019, 10:48:27 AM10/28/19
to Machinekit
Too bad there still isn't an arm64 image out for the rpi4 (I have recently built a rip install on Debian Buster arm64 with success )

What you can instead try is to add  -latomic to the submakffile line 33 so it becomes this:
$(PROTOBUF_LIBS) $(CZMQ_LIBS) $(AVAHI_LIBS) -lm -lstdc++ -latomic

Perhaps you need to add  -ldl before  -latomic also

Recipe is same for the old mk repo

Michael 

On Monday, 28 October 2019 14:12:57 UTC+1, Joseph wrote:
Thank you, Michael.

I am using a brand new RPi4 so, yes, it is buster.  Set up using machinekit-hal as instructed.  Getting the same link error.
Compiling hal/utils/halcmd_commands.c
Compiling hal/utils/halsh.c
Linking hal.so
Compiling hal/utils/halcmd_main.c
Compiling hal/utils/halcmd_completion.c
Linking halcmd
/usr/bin/ld: objects/hal/utils/halcmd_commands.o: undefined reference to symbol '__atomic_load_8@@LIBATOMIC_1.0'
/usr/bin/ld: //usr/lib/arm-linux-gnueabihf/libatomic.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [hal/utils/Submakefile:32: ../bin/halcmd] Error 1
make: Leaving directory '/home/pi/machinekit-hal/src'

Is there an expectation for a specific libatomic version?  The library on the machine is v1.2.0 not 1.0.n.
It appears the symbol is present in the 1.2 library.
pi@raspberrypi:/usr/lib/arm-linux-gnueabihf $ strings libatomic.so.1.2.0 | grep __atomic_load
__atomic_load_8
__atomic_load_1
__atomic_load_2
__atomic_load_4
__atomic_load

Ever onward,   Joe
...


To unsubscribe from this group and all its topics, send an email to machi...@googlegroups.com.

Joseph Heath

unread,
Oct 28, 2019, 10:08:19 PM10/28/19
to Michael Brown, Machinekit
Thank you Michael!  Adding that library explicitly allowed the build to move forward.

Now to do some machine testing...

All the best,   Joe

To unsubscribe from this group and all its topics, send an email to machinekit+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/machinekit/08f41132-b0d5-4538-b85d-8e05b5631464%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages