Hello,
I have cloned Micro-XRCE-DDS-Client and Agent projects, to publish simple dds message (PublishHelloWorld project), and everything is ok. I am using Windows OS and I want to move Micro-XRCE-DDS-Client on Zephyr so it can be run on this. I created the CMakelists and configure all important options and also moved "HelloWorld.c", "main.c", "HelloWorld.idl", "HelloWorld.h" files to the zephyr project. When I want to build Zephyr with this command "west build -b qemu_x86 samples/hello_world", I got the follwing two errors:
(I also share the content of my CMakelists at the end of this message)
"
FAILED: CMakeFiles/microxrceddsclient.dir/C/z/Micro-XRCE-DDS-Client/src/c/util/time.c.obj ...
In file included from C:/z/zephyrproject/zephyr/include/zephyr/toolchain.h:50,
from C:/z/zephyrproject/zephyr/include/zephyr/kernel_includes.h:23,
from C:/z/zephyrproject/zephyr/include/zephyr/kernel.h:17,
from C:/z/zephyrproject/zephyr/include/zephyr/posix/posix_types.h:30,
from C:/z/zephyrproject/zephyr/include/zephyr/posix/sys/select.h:9,
from c:\users\mohamm~1\downlo~1\zephyr~1.0\x86_64~1\x86_64-zephyr-elf\sys-include\sys\types.h:50,
from c:\users\mohamm~1\downlo~1\zephyr~1.0\x86_64~1\x86_64-zephyr-elf\sys-include\time.h:28,
from C:/z/zephyrproject/zephyr/include/zephyr/posix/time.h:117,
from C:/z/zephyrproject/zephyr/include/zephyr/posix/time.h:12,
from C:/z/Micro-XRCE-DDS-Client/src/c/util/time.c:3:
C:/z/zephyrproject/zephyr/include/zephyr/toolchain/gcc.h:579:2: error: #error processor architecture not supported
579 | #error processor architecture not supported
| ^~~~~
In file included from C:/z/zephyrproject/zephyr/include/zephyr/kernel_includes.h:32:
C:/z/zephyrproject/zephyr/include/zephyr/kernel_structs.h:123:28: error: 'CONFIG_NUM_PREEMPT_PRIORITIES' undeclared here (not in a function)
123 | sys_dlist_t queues[K_NUM_THREAD_PRIO];
| ^~~~~
C:/z/zephyrproject/zephyr/include/zephyr/kernel_structs.h:123:28: error: 'CONFIG_NUM_COOP_PRIORITIES' undeclared here (not in a function)
123 | sys_dlist_t queues[K_NUM_THREAD_PRIO];
| ^~~~~
C:/z/zephyrproject/zephyr/include/zephyr/kernel_structs.h:203:26: error: 'CONFIG_MP_MAX_NUM_CPUS' undeclared here (not in a function)
203 | struct _cpu cpus[CONFIG_MP_MAX_NUM_CPUS];
| ^~~~~~
In file included from C:/z/zephyrproject/zephyr/include/zephyr/kernel_includes.h:34:
C:/z/zephyrproject/zephyr/include/zephyr/syscall.h:11:10: fatal error: zephyr/syscall_list.h: No such file or directory
11 | #include <zephyr/syscall_list.h>
| ^~~~~~~
compilation terminated.
[17/149] Building C object CMakeFiles/microxrceddsclient.dir/C/z/Micro-XRCE-DDS-Client/src/c/util/ping.c.obj
FAILED: CMakeFiles/microxrceddsclient.dir/C/z/Micro-XRCE-DDS-Client/src/c/util/ping.c.obj
...
In file included from C:/z/zephyrproject/zephyr/include/zephyr/toolchain.h:50,
from C:/z/zephyrproject/zephyr/include/zephyr/kernel_includes.h:23,
from C:/z/zephyrproject/zephyr/include/zephyr/kernel.h:17,
from C:/z/zephyrproject/zephyr/include/zephyr/posix/posix_types.h:30,
from C:/z/zephyrproject/zephyr/include/zephyr/posix/sys/select.h:9,
from c:\users\mohamm~1\downlo~1\zephyr~1.0\x86_64~1\x86_64-zephyr-elf\sys-include\sys\types.h:50,
from C:/z/Micro-XRCE-DDS-Client/include/uxr/client/profile/transport/ip/udp/udp_transport_posix.h:23,
from C:/z/Micro-XRCE-DDS-Client/include/uxr/client/transport.h:24,
from C:/z/Micro-XRCE-DDS-Client/include/uxr/client/util/ping.h:28,
from C:/z/Micro-XRCE-DDS-Client/src/c/util/ping.c:1:
C:/z/zephyrproject/zephyr/include/zephyr/toolchain/gcc.h:579:2: error: #error processor architecture not supported
579 | #error processor architecture not supported
| ^~~~~
In file included from C:/z/zephyrproject/zephyr/include/zephyr/kernel_includes.h:32:
C:/z/zephyrproject/zephyr/include/zephyr/kernel_structs.h:123:28: error: 'CONFIG_NUM_PREEMPT_PRIORITIES' undeclared here (not in a function)
123 | sys_dlist_t queues[K_NUM_THREAD_PRIO];
| ^~~~~
C:/z/zephyrproject/zephyr/include/zephyr/kernel_structs.h:123:28: error: 'CONFIG_NUM_COOP_PRIORITIES' undeclared here (not in a function)
123 | sys_dlist_t queues[K_NUM_THREAD_PRIO];
| ^~~~~
C:/z/zephyrproject/zephyr/include/zephyr/kernel_structs.h:203:26: error: 'CONFIG_MP_MAX_NUM_CPUS' undeclared here (not in a function)
203 | struct _cpu cpus[CONFIG_MP_MAX_NUM_CPUS];
| ^~~~~~
In file included from C:/z/zephyrproject/zephyr/include/zephyr/kernel_includes.h:34:
C:/z/zephyrproject/zephyr/include/zephyr/syscall.h:11:10: fatal error: zephyr/syscall_list.h: No such file or directory
11 | #include <zephyr/syscall_list.h>
| ^~~~~~~
compilation terminated.
[19/149] Generating misc/generated/syscalls.json, misc/generated/struct_tags.json
ninja: build stopped: subcommand failed.
"
option(UCLIENT_PROFILE_UDP "Enable UDP transport" ON)
option(UCLIENT_PROFILE_SERIAL "Enable Serial transport" ON)
set(UCLIENT_C_STANDARD 99 CACHE STRING "Version of the C language used to build the library")
Hello, I have cloned Micro-XRCE-DDS-Client and Agent projects, to publish simple dds message (PublishHelloWorld project), and everything is ok. I am using Windows OS and I want to move Micro-XRCE-DDS-Client on Zephyr so it can be run on this. I created the CMakelists and configure all important options and also moved "HelloWorld.c", "main.c", "HelloWorld.idl", "HelloWorld.h" files to the zephyr project. When I want to build Zephyr with this command "west build -b qemu_x86 samples/hello_world", I got the follwing two errors: (I also share the content of my CMakelists at the end of this message)
" FAILED: CMakeFiles/microxrceddsclient.dir/C/z/Micro-XRCE-DDS-Client/src/c/util/time.c.obj ... In file included from C:/z/zephyrproject/zephyr/include/zephyr/toolchain.h:50, from C:/z/zephyrproject/zephyr/include/zephyr/kernel_includes.h:23, from C:/z/zephyrproject/zephyr/include/zephyr/kernel.h:17, from C:/z/zephyrproject/zephyr/include/zephyr/posix/posix_types.h:30, from C:/z/zephyrproject/zephyr/include/zephyr/posix/sys/select.h:9, from c:\users\mohamm~1\downlo~1\zephyr~1.0\x86_64~1\x86_64-zephyr-elf\sys-include\sys\types.h:50, from c:\users\mohamm~1\downlo~1\zephyr~1.0\x86_64~1\x86_64-zephyr-elf\sys-include\time.h:28, from C:/z/zephyrproject/zephyr/include/zephyr/posix/time.h:117, from C:/z/zephyrproject/zephyr/include/zephyr/posix/time.h:12, from C:/z/Micro-XRCE-DDS-Client/src/c/util/time.c:3: C:/z/zephyrproject/zephyr/include/zephyr/toolchain/gcc.h:579:2: error: #error processor architecture not supported 579 | #error processor architecture not supported | ^~~~~ In file included from C:/z/zephyrproject/zephyr/include/zephyr/kernel_includes.h:32: C:/z/zephyrproject/zephyr/include/zephyr/kernel_structs.h:123:28: error: 'CONFIG_NUM_PREEMPT_PRIORITIES' undeclared here (not in a function) 123 | sys_dlist_t queues[K_NUM_THREAD_PRIO]; | ^
~~~~ C:/z/zephyrproject/zephyr/include/zephyr/kernel_structs.h:123:28: error: 'CONFIG_NUM_COOP_PRIORITIES' undeclared here (not in a function) 123 | sys_dlist_t queues[K_NUM_THREAD_PRIO]; | ^~~~~ C:/z/zephyrproject/zephyr/include/zephyr/kernel_structs.h:203:26: error: 'CONFIG_MP_MAX_NUM_CPUS' undeclared here (not in a function) 203 | struct _cpu cpus[CONFIG_MP_MAX_NUM_CPUS]; | ^~~~~~ In file included from C:/z/zephyrproject/zephyr/include/zephyr/kernel_includes.h:34: C:/z/zephyrproject/zephyr/include/zephyr/syscall.h:11:10: fatal error: zephyr/syscall_list.h: No such file or directory 11 | #include <zephyr/syscall_list.h> | ^~~~~~~ compilation terminated. [17/149] Building C object CMakeFiles/microxrceddsclient.dir/C/z/Micro-XRCE-DDS-Client/src/c/util/ping.c.objFAILED: CMakeFiles/microxrceddsclient.dir/C/z/Micro-XRCE-DDS-Client/src/c/util/ping.c.obj ... In file included from C:/z/zephyrproject/zephyr/include/zephyr/toolchain.h:50, from C:/z/zephyrproject/zephyr/include/zephyr/kernel_includes.h:23, from C:/z/zephyrproject/zephyr/include/zephyr/kernel.h:17, from C:/z/zephyrproject/zephyr/include/zephyr/posix/posix_types.h:30, from C:/z/zephyrproject/zephyr/include/zephyr/posix/sys/select.h:9, from c:\users\mohamm~1\downlo~1\zephyr~1.0\x86_64~1\x86_64-zephyr-elf\sys-include\sys\types.h:50, from C:/z/Micro-XRCE-DDS-Client/include/uxr/client/profile/transport/ip/udp/udp_transport_posix.h:23, from C:/z/Micro-XRCE-DDS-Client/include/uxr/client/transport.h:24, from C:/z/Micro-XRCE-DDS-Client/include/uxr/client/util/ping.h:28, from C:/z/Micro-XRCE-DDS-Client/src/c/util/ping.c:1: C:/z/zephyrproject/zephyr/include/zephyr/toolchain/gcc.h:579:2: error: #error processor architecture not supported 579 | #error processor architecture not supported | ^~~~~ In file included from C:/z/zephyrproject/zephyr/include/zephyr/kernel_includes.h:32: C:/z/zephyrproject/zephyr/include/zephyr/kernel_structs.h:123:28: error: 'CONFIG_NUM_PREEMPT_PRIORITIES' undeclared here (not in a function) 123 | sys_dlist_t queues[K_NUM_THREAD_PRIO]; | ^
~~~~ C:/z/zephyrproject/zephyr/include/zephyr/kernel_structs.h:123:28: error: 'CONFIG_NUM_COOP_PRIORITIES' undeclared here (not in a function) 123 | sys_dlist_t queues[K_NUM_THREAD_PRIO]; | ^~~~~ C:/z/zephyrproject/zephyr/include/zephyr/kernel_structs.h:203:26: error: 'CONFIG_MP_MAX_NUM_CPUS' undeclared here (not in a function) 203 | struct _cpu cpus[CONFIG_MP_MAX_NUM_CPUS]; | ^~~~~~ In file included from C:/z/zephyrproject/zephyr/include/zephyr/kernel_includes.h:34: C:/z/zephyrproject/zephyr/include/zephyr/syscall.h:11:10: fatal error: zephyr/syscall_list.h: No such file or directory 11 | #include <zephyr/syscall_list.h> | ^~~~~~~ compilation terminated. [19/149] Generating misc/generated/syscalls.json, misc/generated/struct_tags.json ninja: build stopped: subcommand failed. "My CMakelists :
"
SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.20.0)
Find Zephyr and initialize the project
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(PublishHelloWorld)
Micro-XRCE-DDS Client build options
option(UCLIENT_PROFILE_UDP "Enable UDP transport" ON) option(UCLIENT_PROFILE_SERIAL "Enable Serial transport" ON) set(UCLIENT_C_STANDARD 99 CACHE STRING "Version of the C language used to build the library")
set(CMAKE_PREFIX_PATH "C:/z/Micro-XRCE-DDS-Client/build/microcdr/src/microcdr-build/cmake/config") #8585
Paths for Micro-XRCE-DDS-Client
set(MICRO_XRCE_DDS_PATH C:/z/Micro-XRCE-DDS-Client)
set(MICRO_XRCE_DDS_INCLUDE_DIR C:/z/Micro-XRCE-DDS-Client/include) set(MICRO_XRCE_DDS_SRC_DIR C:/z/Micro-XRCE-DDS-Client/src/c)
Paths for Microcdr
set(MICROCDR_INCLUDE_DIR ${MICRO_XRCE_DDS_PATH}/microcdr/include) set(MICROCDR_SRC_DIR ${MICRO_XRCE_DDS_PATH}/microcdr/src/c)
Add your source files and the Micro-XRCE-DDS sources
target_sources(app PRIVATE src/main.c src/HelloWorld.c)
Add sources for Microcdr
target_sources(app PRIVATE ${MICROCDR_SRC_DIR}/common.c ${MICROCDR_SRC_DIR}/types/array.c ${MICROCDR_SRC_DIR}/types/basic.c ${MICROCDR_SRC_DIR}/types/sequence.c ${MICROCDR_SRC_DIR}/types/string.c )
Sources
Check platform.
set(UCLIENT_PLATFORM_ZEPHYR ON) set(UCLIENT_PLATFORM_POSIX ON)
set(_transport_src "${MICRO_XRCE_DDS_PATH}/src/c/profile/transport/ip/udp/udp_transport.c" "${MICRO_XRCE_DDS_PATH}/src/c/profile/transport/ip/udp/udp_transport_posix.c"
"11${MICRO_XRCE_DDS_PATH}/src/c/profile/transport/ip/udp/udp_transport_posix_nopoll.c"
)
Other sources
set(SRCS ${MICRO_XRCE_DDS_PATH}/src/c/core/session/stream/input_best_effort_stream.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/stream/input_reliable_stream.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/stream/output_best_effort_stream.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/stream/output_reliable_stream.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/stream/stream_storage.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/stream/stream_id.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/stream/seq_num.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/session.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/session_info.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/submessage.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/object_id.c ${MICRO_XRCE_DDS_PATH}/src/c/core/serialization/xrce_types.c ${MICRO_XRCE_DDS_PATH}/src/c/core/serialization/xrce_header.c ${MICRO_XRCE_DDS_PATH}/src/c/core/serialization/xrce_subheader.c ${MICRO_XRCE_DDS_PATH}/src/c/util/time.c ${MICRO_XRCE_DDS_PATH}/src/c/util/ping.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/common_create_entities.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/create_entities_ref.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/create_entities_xml.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/create_entities_bin.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/read_access.c ${MICRO_XRCE_DDS_PATH}/src/c/core/session/write_access.c
11${MICRO_XRCE_DDS_PATH}/src/c/profile/multithread/multithread.c
Set target properties for Micro-XRCE-DDS
add_library(microxrcedds_client STATIC ${SRCS}) set_target_properties(microxrcedds_client PROPERTIES C_STANDARD 99)
target_link_libraries(microxrcedds_client
)
target_link_libraries(microxrcedds_client PRIVATE ${CMAKE_THREAD_LIBS_INIT})
message(STATUS "*****ZEPHYR_BASE=${ZEPHYR_BASE}")
Link Zephyr application with Micro-XRCE-DDS
target_link_libraries(app PRIVATE microxrcedds_client)
target_include_directories(microxrcedds_client PUBLIC ${MICRO_XRCE_DDS_INCLUDE_DIR} ${MICROCDR_INCLUDE_DIR} ${MICRO_XRCE_DDS_SRC_DIR} ${MICROCDR_SRC_DIR} ${CMAKE_BINARY_DIR}/include
${CMAKE_BINARY_DIR}/zephyr/include/generated/zephyr
)
target_include_directories(app PRIVATE
Generate config.h
)
configure_file( ${MICRO_XRCE_DDS_PATH}/microcdr/include/ucdr/config.h.in ${CMAKE_BINARY_DIR}/include/ucdr/config.h )
Install config.h
install(
"