Answer the question
In order to leave comments, you need to log in
How to make g++ portable cross compiler?
I am making an appimage image of a tulsa with a cross compiler inside. Every time the image is run, it mounts itself to a random path. And when you try to run from within the g++ crosscompiler image, it gives an error, such a file does not exist.
The bottom line is that the /fixed/path/devkit-x86/sysroots/x86_64-pokysdk-linux/lib/ld-linux-x86-64.so.2 dependency is embedded inside the g++ cross-compiler binary and when transferred to an environment where this file in a place that doesn't match the hardcoded path, g++ "doesn't find itself".
If you write something like patchelf --set-interpreter /new/path/devkit-x86/sysroots/x86_64-pokysdk-linux/lib/ld-linux-x86-64.so.2 g++ , then g++ will work again, before packing into an image. But the image is mounted read-only and I can’t solve this problem like that.
I also tried this trick: g++ -Wl,-dynamic-linker,/new/path/devkit-x86/sysroots/x86_64-pokysdk-linux/lib/ld-linux-x86-64.so.2 , but it didn't help.
How to be?
Answer the question
In order to leave comments, you need to log in
In general, such a not very universal crutch became the solution to the problem.
Inside the already created image, there is an AppRun launcher in which I registered immediately after mounting to find out the current directory like this:
HERE=$(dirname $(readlink -f "${0}"))
export MYAPP_DIR="${HERE}/opt/myApp"
mkdir -p "/tmp/myApp.AppImage/lib64"
ln -sf ${MYAPP_DIR}/devkit-x86/sysroots/x86_64-pokysdk-linux/lib/ld-2.20.so /tmp/myApp.AppImage/lib64/ld-linux-x86-64.so.2
From the description it is not entirely clear who does not detect whom.
For completeness, please provide the full text of the error and the output of the command g++ -v
.
If the compiler can't find your sysroot try running it like this:
g++ --sysroot=/new/path/devkit-x86/sysroots/x86_64-pokysdk-linux
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question