Closed joluxer closed 9 months ago
This is strange - I've been cross-compiling this a lot for different platforms and it's also deployed in yocto and buildroot - I have never seen any such problem. Could you give some more details?
I'm cross-compiling on Gentoo, the cross-build environment is created by Gentoo's crossdev system, which produced up to now an very high quality cross-build enviroment. The cross-target is armv7a-unknown-linux-gnueabihf.
The build run is controlled by a larger CMake project, which calls autogen.sh and thus configure automatically as an ExternalProject with out-of-source-build. I can provide You with the detailed artifacts of this project part, if you need it. Sharing the whole project is'nt possible. The build enviroment is available publicly as a docker image: joluxer/dyna-linux-imx6ull-colibri.
In a few days I can do a minimal example for reproducing the problem.
More details to come on request.
Gesendet: Donnerstag, 14. November 2019 um 11:31 Uhr Von: "Bartosz Gołaszewski" notifications@github.com An: brgl/libgpiod libgpiod@noreply.github.com Cc: joluxer linuxer@quantentunnel.de, Author author@noreply.github.com Betreff: Re: [brgl/libgpiod] Drop AC_FUNC_MALLOC and _REALLOC and check for them as regular functions. (#45)
This is strange - I've been cross-compiling this a lot for different platforms and it's also deployed in yocto and buildroot - I have never seen any such problem. Could you give some more details?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
The thing is: AC_FUNC_MALLOC
is a very standard macro. It not only checks the existence of malloc()
but also verifies that it's compatible with GNUC malloc()
. The comment you're adding about it not working when cross-compiling is untrue in 99% cases. I'll even risk saying that if it doesn't work in your environment, it's a problem with the environment and not the project.
I found that cross-building with Gentoos cross-emerge works flawless, but compiling by hand does not.
So the AC_FUNC_MALLOC
macro seems to do special things, which are not compatible with my manual tests.
To see other build systems which compile this thing without problems makes me believe, that this is a problem of my manual tests. I'll keep an eye on this in my test environment.
The autoconf AC_FUNC_MALLOC macro does not only check for the presence of malloc, but it also verifies its behaviour when allocating 0 bytes. Since autoconf is not able to check with cross-compilers, malloc is always marked as missing when cross-building.
When using Yocto or Buildroot to build the package, the build system adds a set of autoconf variables to work around this issue, and specify that this detection should be successfull.
Thanks for bringing this to my attention. I'll take another look at this and potentially apply this patch.
Just wanted to chime in that this fixed the same cross compilation issue for me (building on x86-64 for target aarch64).
While cross-compiling there occurred "undefined reference to `rpl_malloc'", the suggested change fixes the problem.
Tested for native X86_64 and armv7a-unknown-linux-gnueabihf.