-
Notifications
You must be signed in to change notification settings - Fork 736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Header conflict when cross compiling #2632
Comments
Can you pull the following submodule branch and see if this fixes you issue? https://github.com/Azure/azure-uamqp-c/tree/ericwol/safemath_conflict |
Hi, thanks. No, unfortunately it still gives error (I fetched and checked out the branch):
|
I see. There was more files with the same issue. Please pull the new changes in the branch and try again. |
It went way further this time (95%), but there's still an error: [ 95%] Building C object out/serializer/CMakeFiles/serializer.dir/src/agenttypesystem.c.o
In file included from /home/abertulli/two_lidars/azure-iot-sdk-c/serializer/inc/agenttypesystem.h:15:0,
from /home/abertulli/two_lidars/azure-iot-sdk-c/serializer/src/agenttypesystem.c:8:
/opt/box-root-fs/usr/include/stdint.h:267:0: error: "SIZE_MAX" redefined [-Werror]
# define SIZE_MAX (4294967295U)
In file included from /home/abertulli/two_lidars/azure-iot-sdk-c/serializer/src/agenttypesystem.c:6:0:
/home/abertulli/two_lidars/azure-iot-sdk-c/c-utility/inc/azure_c_shared_utility/safe_math.h:8:0: note: this is the location of the previous definition
#define SIZE_MAX ((size_t)((size_t)~(size_t)0))
cc1: all warnings being treated as errors
make[2]: *** [out/serializer/CMakeFiles/serializer.dir/build.make:76: out/serializer/CMakeFiles/serializer.dir/src/agenttypesystem.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1176: out/serializer/CMakeFiles/serializer.dir/all] Error 2
make: *** [Makefile:136: all] Error 2 |
Please pull the following changes on the main repo |
Thanks, it appears to be working now! As a further comment, I'd add that a temporary workaround could be adding a guard in the standard C library /* Limit of `size_t' type. */
#ifndef SIZE_MAX // <----- HERE
# if __WORDSIZE == 64
# define SIZE_MAX (18446744073709551615UL)
# else
# ifdef __WORDSIZE32_SIZE_ULONG
# define SIZE_MAX (4294967295UL)
# else
# define SIZE_MAX (4294967295U)
# endif
# endif
#endif // <----- and HERE It worked for me. Anyway, now it works with the standard headers, with the main repo at 033308b and the submodule |
This issue can be closed for me, but I don't close it myself in case you would like to keep it open waiting to link it to a PR merging the fix into the main branch |
Development Machine, OS, Compiler (and Other Relevant Toolchain Info)
target system Debian stretch (armv7l)
Cross Compiled on WSL Ubuntu 22.04 (x86-64) using GCC 6.3.0 built from source
Notice that the cross compiler works fine with other submodules / files / units
SDK Version
Release LTS_03_2024_Ref02 (commit 46996fc)
Protocol
MQTT
Describe the Bug
Hi, thanks for your work. Compiling the project on the target and the host system works fine, but when cross-compiling, I have an header conflict (see console logs and relevant file below). Notice that the cross compiler, that was built from source to match the Glibc version of the target, works fine with other projects not containing the Azure SDK.
MCVE
Just compiling the Azure SDK is enough
Console Logs
Relevant files
( the repo is added as a git submodule, pinned to the above mentined commit)
Investigating in the affected files, I see:
/opt/box-root-fs/usr/include/stdint.h
(/opt/box-root-fs
is the sysroot of the compiler, in which I copied the system libraries from the target system with rsync)~/two_lidars/azure-iot-sdk-c/c-utility/inc/azure_c_shared_utility/safe_math.h
(~/two_lidars/
being my project):The text was updated successfully, but these errors were encountered: