-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Undefined reference errors when using External Library with k_msgq_* calls #31613
Comments
Please look at 6b720cb3c56a198db19b1884e78385cb7a392b00 for a possible fix. |
@pabigot This pointed me in the right direction, thank you. Now it works. Thanks! |
Hi, I'm having the same problem linking an external library that makes Zephyr kernel calls. I tried adding the line "zephyr_library_link_libraries(kernel)" in my CMakeLists.txt and changed "target_link_libraries(app PUBLIC pep)" to "target_link_libraries(app PRIVATE pep)" but this had no effect. I think I must be making the change in the wrong spot... help? |
@danderson-presonus My
|
Thanks! This got me up and running. |
@pabigot I am not able to locate this fix. Can you help? Thanks in Advance. |
Describe the bug
I made a very simple library that includes two functions that use the message queue. However, I get this linking error:
undefined reference to 'z_impl_k_msgq_put'
I think it's due to
'z_impl_k_msgq_put'
being declared as extern and that affects the linking, but I haven't found a solution. I tried replacing thek_msgq_*
functions withLOG_INF
, and then it works just fine.I'm trying to put some code into libraries so that we can share those with external parties, without sharing our source code with them.
To Reproduce
I have created a simple minimal example of the problem.
Expected behavior
A clean build.
Impact
I can't librarize Zephyr code that includes calls to the message queue (and possibly similar code), hence I can't provide external parties with the modules they need without sharing our source code.
Logs and console output
Rebuilding ‘zephyr/zephyr_prebuilt.elf’ from solution 'build' in configuration 'Common' Compiling 'empty_file.c' Linking 'zephyr_prebuilt.elf' B 1 MB 2.67% B 448 KB 1.74% lib/liblib.a(lib.c.obj): in function 'k_msgq_put'': undefined reference to 'z_impl_k_msgq_put' ld returned 1 exit status B 2 KB 4.30% Build failed
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: