-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Description
Describe the bug
A clear and concise description of what the bug is.
Multiple declaration/conflict between /sys/_pthreadtypes.h and posix_types.h
I was trying to import and compile an external c source, a posix compliant library with a zephyr based project
External library repo: https://github.com/digidotcom/xbee_ansic_library/
What have you tried to diagnose or workaround this issue?
Identify which header file is in conflict. Described above
To Reproduce
Clone the external library to the project directory, configure it to compile along the project in top-level cmakelist
Expected behavior
Successful build
Impact
Build error
Logs and console output
il.c.obj.d -o CMakeFiles/app.dir/src/xbee_ansic_library/src/mbedtls/mbedtls_util.c.obj -c ../src/xbee_ansic_library/src/mbedtls/mbedtls_util.c
In file included from /home/manoj/zephyrproject/zephyr/include/posix/time.h:61,
from ../src/xbee_ansic_library/include/mbedtls/platform.h:73,
from ../src/xbee_ansic_library/src/mbedtls/mbedtls_util.c:40:
/home/manoj/zephyrproject/zephyr/include/posix/posix_types.h:45:3: error: conflicting types for 'pthread_attr_t'
45 | } pthread_attr_t;
| ^~~~~~~~~~~~~~
In file included from /home/manoj/zephyr-sdk-0.12.0/arm-zephyr-eabi/arm-zephyr-eabi/sys-include/sys/types.h:223,
from /home/manoj/zephyr-sdk-0.12.0/arm-zephyr-eabi/arm-zephyr-eabi/sys-include/stdio.h:61,
from ../src/xbee_ansic_library/include/mbedtls/platform.h:71,
from ../src/xbee_ansic_library/src/mbedtls/mbedtls_util.c:40:
/home/manoj/zephyr-sdk-0.12.0/arm-zephyr-eabi/arm-zephyr-eabi/sys-include/sys/_pthreadtypes.h:75:3: note: previous declaration of 'pthread_attr_t' was here
75 | } pthread_attr_t;
| ^~~~~~~~~~~~~~
In file included from /home/manoj/zephyrproject/zephyr/include/posix/time.h:61,
from ../src/xbee_ansic_library/include/mbedtls/platform.h:73,
from ../src/xbee_ansic_library/src/mbedtls/mbedtls_util.c:40:
/home/manoj/zephyrproject/zephyr/include/posix/posix_types.h:47:15: error: conflicting types for 'pthread_t'
47 | typedef void *pthread_t;
| ^~~~~~~~~
In file included from /home/manoj/zephyr-sdk-0.12.0/arm-zephyr-eabi/arm-zephyr-eabi/sys-include/sys/types.h:223,
from /home/manoj/zephyr-sdk-0.12.0/arm-zephyr-eabi/arm-zephyr-eabi/sys-include/stdio.h:61,
from ../src/xbee_ansic_library/include/mbedtls/platform.h:71,
from ../src/xbee_ansic_library/src/mbedtls/mbedtls_util.c:40:
/home/manoj/zephyr-sdk-0.12.0/arm-zephyr-eabi/arm-zephyr-eabi/sys-include/sys/_pthreadtypes.h:32:20: note: previous declaration of 'pthread_t' was here
32 | typedef __uint32_t pthread_t; /* identify a thread */
| ^~~~~~~~~
In file included from /home/manoj/zephyrproject/zephyr/include/posix/time.h:61,
from ../src/xbee_ansic_library/include/mbedtls/platform.h:73,
from ../src/xbee_ansic_library/src/mbedtls/mbedtls_util.c:40:
/home/manoj/zephyrproject/zephyr/include/posix/posix_types.h:58:3: error: conflicting types for 'pthread_mutex_t'
58 | } pthread_mutex_t;
| ^~~~~~~~~~~~~~~
In file included from /home/manoj/zephyr-sdk-0.12.0/arm-zephyr-eabi/arm-zephyr-eabi/sys-include/sys/types.h:223,
from /home/manoj/zephyr-sdk-0.12.0/arm-zephyr-eabi/arm-zephyr-eabi/sys-include/stdio.h:61,
from ../src/xbee_ansic_library/include/mbedtls/platform.h:71,
from ../src/xbee_ansic_library/src/mbedtls/mbedtls_util.c:40:
/home/manoj/zephyr-sdk-0.12.0/arm-zephyr-eabi/arm-zephyr-eabi/sys-include/sys/_pthreadtypes.h:154:20: note: previous declaration of 'pthread_mutex_t' was here
154 | typedef __uint32_t pthread_mutex_t; /* identify a mutex */
| ^~~~~~~~~~~~~~~
In file included from /home/manoj/zephyrproject/zephyr/include/posix/time.h:61,
from ../src/xbee_ansic_library/include/mbedtls/platform.h:73,
from ../src/xbee_ansic_library/src/mbedtls/mbedtls_util.c:40:
/home/manoj/zephyrproject/zephyr/include/posix/posix_types.h:62:3: error: conflicting types for 'pthread_mutexattr_t'
62 | } pthread_mutexattr_t;
| ^~~~~~~~~~~~~~~~~~~
In file included from /home/manoj/zephyr-sdk-0.12.0/arm-zephyr-eabi/arm-zephyr-eabi/sys-include/sys/types.h:223,
from /home/manoj/zephyr-sdk-0.12.0/arm-zephyr-eabi/arm-zephyr-eabi/sys-include/stdio.h:61,
from ../src/xbee_ansic_library/include/mbedtls/platform.h:71,
from ../src/xbee_ansic_library/src/mbedtls/mbedtls_util.c:40:
/home/manoj/zephyr-sdk-0.12.0/arm-zephyr-eabi/arm-zephyr-eabi/sys-include/sys/_pthreadtypes.h:169:3: note: previous declaration of 'pthread_mutexattr_t' was here
169 | } pthread_mutexattr_t;
| ^~~~~~~~~~~~~~~~~~~
In file included from /home/manoj/zephyrproject/zephyr/include/posix/time.h:61,
from ../src/xbee_ansic_library/include/mbedtls/platform.h:73,
from ../src/xbee_ansic_library/src/mbedtls/mbedtls_util.c:40:
/home/manoj/zephyrproject/zephyr/include/posix/posix_types.h:67:3: error: conflicting types for 'pthread_cond_t'
67 | } pthread_cond_t;
| ^~~~~~~~~~~~~~
In file included from /home/manoj/zephyr-sdk-0.12.0/arm-zephyr-eabi/arm-zephyr-eabi/sys-include/sys/types.h:223,
from /home/manoj/zephyr-sdk-0.12.0/arm-zephyr-eabi/arm-zephyr-eabi/sys-include/stdio.h:61,
from ../src/xbee_ansic_library/include/mbedtls/platform.h:71,
from ../src/xbee_ansic_library/src/mbedtls/mbedtls_util.c:40:
/home/manoj/zephyr-sdk-0.12.0/arm-zephyr-eabi/arm-zephyr-eabi/sys-include/sys/_pthreadtypes.h:176:20: note: previous declaration of 'pthread_cond_t' was here
176 | typedef __uint32_t pthread_cond_t; /* identify a condition variable */
| ^~~~~~~~~~~~~~
In file included from /home/manoj/zephyrproject/zephyr/include/posix/time.h:61,
from ../src/xbee_ansic_library/include/mbedtls/platform.h:73,
from ../src/xbee_ansic_library/src/mbedtls/mbedtls_util.c:40:
/home/manoj/zephyrproject/zephyr/include/posix/posix_types.h:70:3: error: conflicting types for 'pthread_condattr_t'
70 | } pthread_condattr_t;
| ^~~~~~~~~~~~~~~~~~
In file included from /home/manoj/zephyr-sdk-0.12.0/arm-zephyr-eabi/arm-zephyr-eabi/sys-include/sys/types.h:223,
from /home/manoj/zephyr-sdk-0.12.0/arm-zephyr-eabi/arm-zephyr-eabi/sys-include/stdio.h:61,
from ../src/xbee_ansic_library/include/mbedtls/platform.h:71,
from ../src/xbee_ansic_library/src/mbedtls/mbedtls_util.c:40:
/home/manoj/zephyr-sdk-0.12.0/arm-zephyr-eabi/arm-zephyr-eabi/sys-include/sys/_pthreadtypes.h:186:3: note: previous declaration of 'pthread_condattr_t' was here
186 | } pthread_condattr_t; /* a condition attribute object */
| ^~~~~~~~~~~~~~~~~~
ninja: build stopped: subcommand failed.
XBee subdirectory CMakeLists.txt
cmake_minimum_required(VERSION 3.13.1)
project(project_info)
set(TARGET_SCOPE app PRIVATE)
target_compile_definitions(${TARGET_SCOPE} -D POSIX)
target_compile_definitions(${TARGET_SCOPE} -D MBEDTLS_NO_PLATFORM_ENTROPY)
set(INCLUDES include
ports/posix/
)
target_include_directories(${TARGET_SCOPE} ${INCLUDES})
file(GLOB SRCS_FILES
"ports/posix/*.c"
"src/*/*.c"
)
target_sources(${TARGET_SCOPE} ${SRCS_FILES})
Environment (please complete the following information):
- OS:
Ubuntu 20.04.2 LTS - Toolchain:
Zephyr SDK - Commit SHA or Version used:
0.12.0
Additional context
Add any other context about the problem here.