Open joakim-tjernlund opened 2 years ago
bear 3.0.19
readelf on the cross compiler gives:
0x0000000000000001 (NEEDED) Shared library: [libm.so.6]
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
0x0000000000000001 (NEEDED) Shared library: [ld-linux-x86-64.so.2]
0x000000000000000f (RPATH) Library rpath: [$ORIGIN/../../lib]
[Requesting program interpreter: /opt/infn-xr/1.0/sysroots/x86_64-xrsdk-linux/lib/ld-linux-x86-64.so.2]
So I presume bear is then tricked into using this older glibc and it fails. Is it possible to build bear with static libs ?
Alternatively you can try --force-wrapper
flag for Bear. That case it will use compiler wrappers, and won't clash with the libC. The only thing you might want to pay attention for that case, the build system needs to respect the CC
and CXX
environment variables.
Any luck @joakim-tjernlund ?
On vacation ATM but I did a test build with --force-wrapper
and it built the kernel/u-boot so it looks better.
Looking at the compile_commands.json generated file I only see a few files in there, only files that are built with the host gcc like scripts/sorttable.c or lib/gen_crc32table.c
The reason for that is, you specify the CROSS_COMPILE
environment variable. The CC
(or CXX
) environment would be better for that. Can you change the build to use those environment variables instead? (Bear replace those env variables with a compile wrapper, and only those will get captured.)
The reason for that is, you specify the
CROSS_COMPILE
environment variable. TheCC
(orCXX
) environment would be better for that. Can you change the build to use those environment variables instead? (Bear replace those env variables with a compile wrapper, and only those will get captured.)
I don't think I can do that, both Linux kernel and u-boot depends hard on CROSS_COMPILE
. It is an common way to express cross compilation and I think the best would be if bear supports the CROSS_COMPILE
variable.
Ok. Can you share some man page/link that explains this variable usage?
That was harder to find but this is one page: https://hugh712.gitbooks.io/embeddedsystem/content/cross-compiling_the_kernel.html
Basically it an prefix like arm-linux- , then the build system construct a compiler/linker by appending gcc or ld. The CROSS_COMPILE var can be an absolute path like /opt//my-cross/arm-linux- or just arm-linux- and then the normal PATH is searched.
Thanks @joakim-tjernlund , I see now... Can you try a workaround for me?
Bear install an executable called wrapper
, which as the name suggests wraps program executions. It also install a directory called wrapper.d
, which contains soft links to the wrapper
. Could you create soft links in this directory with the cross compiler names? (eg.: arm-linux-gcc
, arm-linux-ld
, etc...)
Execute Bear with the --force-wrapper
flag. You might also want to specify a config file location with --config <path>
, where the config contains instructions to recognize these programs as compiler. (See more here .)
been on vacation a few weeks and forgot about this, sorry. Question though, both u-boot and kernel needs both the host compiler (aka plain gcc) and the cross compiler. Will bear manage both?