Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4899

C/C++ • Re: Cross compile using cmake

$
0
0
That has progressed things although I couldn't find an "install_root=" setting, just a grep returning..
install_dir used to be the option to relocate the glibc install before they switched to the more standard DESTDIR variable: http://web.archive.org/web/201502200554 ... stall.html
In recent versions of glibc, they do the same thing, as you've found.
..as it had "/wibble/" prefix in there. Is it normal to have to do this? I'm hoping your DESTDIR suggestion means I can omit that sed patch.
No, it shouldn't be there, and that's indeed the reason why you shouldn't set --prefix to a path on the build machine: it should generally be relative to the sysroot, with DESTDIR or equivalent set to the actual sysroot path. For most software, setting --prefix to the full path may work, but the problem is that some build scripts hardcode the prefix in the generated binaries or config files. This causes issues later on, because when cross-compiling, most paths are interpreted relative to the sysroot.
It lives! I must admit to feeling somewhat exhilarated. :-)

I added DESTDIR to glibc during relevant parts where it installs stuff and was able to build without patching "libc.so". I had to set "DESTDIR=/" for the moment to avoid (yet again) having to hack all the mariadb prerequisite scripts. The important thing the test 'sdv' app compiles. I'm resisting the temptation to fiddle with it further now. I'll be too tired to complete it. I need to write the script from scratch: fundamental variables are named wrong in light of what I've learned. Ultimately I want it to be like my native gcc build script which has worked for years. Typically, download new gcc..

Code:

$ ./go ntfinal#no tests, full bootstrap multilib
..and whatever is the default compiler ends up installed in "/usr/local/GCC/$VER/". ie:

Code:

$ VER=15-20240929 ./go qfinal#no tests, no bootstrap, no multilib (for a quick build test)
..would produce "/usr/local/GCC/15-20240929/".

For xgcc I have TGT_NAM and TGT_PFX (and within the script a notion of TGT_ARCH). The idea..

Code:

$ TGT_NAM=arm TGT_PFX=junk ./go all
..and the result is a compiler in "/usr/local/RPI/$TGT_ARCH/$TGT_PFX/". Trouble is, I lost the plot with those variables a bit with my xgcc build scripts. My QT build contains "arm-none-eabi" for the pico and TGT_ARCH first field is constructed from TGT_NAM whereas other scripts use a case statement. TL;DR is it's anybody's guess whether..

Code:

$ TGT_NAM=arm (blah)$ TGT_NAM=aarch64 (blah)$ TGT_NAM=arm32 (blah)$ TGT_NAM=arm64 (blah)
..makes sense in any particular context.

Now I can fix all that thanks to your input. I owe you a beer! :-)

Statistics: Posted by swampdog — Sat Nov 09, 2024 5:21 pm



Viewing all articles
Browse latest Browse all 4899

Trending Articles