Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arch Linux ARM Cross Compile #3244

Closed
like-a-bause opened this issue Sep 18, 2014 · 11 comments
Closed

Arch Linux ARM Cross Compile #3244

like-a-bause opened this issue Sep 18, 2014 · 11 comments

Comments

@like-a-bause
Copy link

Hey there,
once again I am trying to get OF to work on the Raspberry Pi with Arch Linux. I opened an issue here but since Raspberry is now in the core and the problems have changed I open this here.
What I did until now is setting up the Pre Build Environment with ArchLinux. My fork for that is here.
I installed the dependencies with the non-ARM script under linux/archlinux/.
When running rmake on the Ubuntu VM I get linker errors. The gist can be found here.

The Problem is, that the linker can't find libEGL:

/opt/raspberrypi/tools-master/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: warning: libEGL.so.1, needed by /opt/raspberrypi/root/lib/libcairo.so, not found (try using -rpath or -rpath-link)
/opt/raspberrypi/tools-master/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: warning: libGL.so.1, needed by /opt/raspberrypi/root/lib/libcairo.so, not found (try using -rpath or -rpath-link)

and fails after that with undefined references. Both Libraries are located in /usr/lib.

Has anyone an idea on how to fix this? I have a feeling that there are only a few steps to go.

@bilderbuchi
Copy link
Member

pinging @openframeworks/linuxarm

@arturoc
Copy link
Member

arturoc commented Sep 18, 2014

i got it working some days ago, i've just committed the install dependcies script that i used. the makefiles also have flags for detecting the arch linux cross compiling toolchain

@bilderbuchi
Copy link
Member

So I guess I'll close this as fixed, we can reopen if the issue persists.

@like-a-bause
Copy link
Author

I ran your install dependencies and indeed raspberry_firmware was not installed.
Now I get a Compile Error with the git master:
.......... -c ../../../libs/openFrameworks/types/ofColor.cpp {standard input}: Assembler messages: {standard input}:27846: Warning: end of file not at end of a line; newline inserted {standard input}:29015: Error: unknown pseudo-op: '.ll' arm-unknown-linux-gnueabihf-g++: internal compiler error: Killed (program cc1plus) Please submit a full bug report, with preprocessed source if appropriate.
I use the cross compiler toolchain from the archlinuxarm website (cross compile guide) and an ubuntu/trusty64. Do you have a different setup @arturoc?

@like-a-bause
Copy link
Author

I ran a diff on ofColor.cpp master branch against the 0.8.4 release. No difference. I also checked out a fresh copy of the master branch. Still the same error.
When i do rmake Debug i get a lot of warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp (every File that compiles) and again the linker error as in here
@arturoc 's fork is older than the openFrameworks master, so I didn't try that.
Is there a way to make the Makefile output more verbose? Maybe there is still a problem with the Makefiles.

@arturoc
Copy link
Member

arturoc commented Sep 19, 2014

the problem with ofColor is a problem with memory but it usually doesn't happen when you cross compile, what command are you using to compile?

@like-a-bause
Copy link
Author

rmake which is defined the following:

export RPI_TOOLS=/opt/raspberrypi/tools-master
export RPI_ROOT=/opt/raspberrypi/root
export PKG_CONFIG_PATH=$RPI_ROOT/usr/lib/pkgconfig
alias rmake='make RPI_TOOLS=$RPI_TOOLS RPI_ROOT=$RPI_ROOT GST_VERSION=1.0 PLATFORM_OS=Linux PLATFORM_ARCH=armv6l'

I'm trying to compile a toolchain with crosstools-ng right now...

@arturoc
Copy link
Member

arturoc commented Sep 19, 2014

the archlinux toolchain worked fine for me, the only time i've seen the ofColor problem is when trying to compile from the raspberry pi since ofColor is templated to so many different types in the cpp that the compiler doesn't have enough memory but never saw it when compiling from the computer.

@like-a-bause
Copy link
Author

Indeed, the VM had only 512 MB RAM. Solved the ofColor issue with stocking it up.

I think i found the cause of all some evil.

libGL.so.1 -> libGL.so.1.2.0
libGL.so.1.2.0 -> /usr/lib/mesa/libGL.so.1.2.0

This hard link points to the /usr/lib/mesa of the VM, which doesn't exist. When I copy the libGL.so.1.2.0 from the $RPI_ROOT to the Directory in the VMs /usr/lib/mesa. raspberry_pi_hello compiles.
This is an ugly hack. Are these symlinks supposed to be absolute?

raspberrypi_hello_world_gles2 Fails with:

src/main.cpp:3:29: fatal error: ofGLES2Renderer.h: No such file or directory

@arturoc
Copy link
Member

arturoc commented Sep 19, 2014

i think that's not even the correct one but the ones that are in /opt/ in the rpi. i needed to copy them to /usr/... but don't remember exactly.

also the problem with the links can be solved by using sshfs to mount the system with the option -o transform_symlinks which transforms the symlinks to relative

@like-a-bause
Copy link
Author

sshfs is not an option, as the root filesystem is loop mounted from an image file on my Mac Books ssd into the VM. The Pi boots from there over nfs. I will try to solve these issues and put the playbook into my fork.
Maybe doing a chroot before calling rmake....
But I'm super glad it works. Thanks for your hard work @arturoc

I think the libEGL.so in RPI_ROOT/opt/vc/lib would not be used as ld specifically complains about libEGL.so.1 not being found.
Phew... 2 days of hard work. Totally worth it. (I hate Raspbian)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants