We do magic relocation of certain libraries and binaries for nativesdk by marking certain strings with a magic segment (.gccrelocprefix) and changing that path during sdk relocation. We should look at doing the same for native binaries from sstate. This would massively reduce the need for wrapper binaries in the sysroot, and fix situations where commonly used libraries have paths embedded in them (such as glib with GIO_MODULE_PATH).
similar problem with hard-coded paths in glibc: https://bugzilla.yoctoproject.org/show_bug.cgi?id=8583
A list of recipes which could do with this: - glib GIO module path - curl ca-certificate path - libxml2 catalog path
(In reply to comment #2) > A list of recipes which could do with this: > - glib GIO module path > - curl ca-certificate path > - libxml2 catalog path Thanks. I'll have a go at this (self-assigning for now ). I had a look yesterday and below is my understanding of the tasks (do correct if I'm mistaken). 1. Add magic attribute to path variables in native binaries where needed I guess this means patches like the glibc one: + static char default_gconv_path[4096] __attribute__ ((section (".gccrelocprefix"))) = GCONV_PATH; 2. Store the original sysroot path somewhere when populating the sysroot I don't see (good) ways around this: in the SDK relocation case it's done when the SDK is generated: ##DEFAULT_INSTALL_DIR## is replaced in the relocation script itself. Not sure how this should be done... 3. During recipe sysroot preparation modify binaries to replace original path with current sysroot path (like relocate_sdk.py) This should be straight forward once #2 is solved -- but would be good to not copy-paste half of relocate_sdk.py somewhere else...
After a bit of testing I have questions: * the binaries in recipe-sysroot-native are hardlinks (with copies in other recipe-sysroot-natives, sysroot-components and the original sysroot-destdir). I'm not sure what I should be doing with that -- I think the the value of e.g. CURL_CA_BUNDLE should be different for every recipe-sysroot-native dir, or is there some alternative that I've overlooked? * Assuming I figure that out, where exactly should the binary-relocation happen? staging.bbclass::extend_recipe_sysroot() is ... scary.
1) Maybe unhardlink any files that get modified. There won't be that many. 2) Talk to RP. Yes, it is. :)