You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Software versions of OpenWrt/LEDE release, packages, etc.
Steps to reproduce
I'm compiling custom packages that I can unfortunately not share, but the problem is as follows:
This is more a suggestion than a bug report.
I sometimes get undefined reference to ubus_invoke in libfoo.so.
I have tried to replicate the linking error with a simple c program, but it compiles fine (on my ubuntu machine with latest libubus compiled from source today)..
I think the problem here is that the ubus CMakeLists.txt file has LIB_SOURCES libubus.c (and more), but the definition of ubus_invoke() is in libubus.h. Causing libubus.so to not have that symbol/function.
So if I in a main program call a function in libfoo that calls ubus_invoke, then I can end up with a undefined reference to ubus_invoke ?
Suggest moving the definitions to the .c file , or add libubus.h to LIB_SOURCES
again I'm sorry I couldn't replicate the problem.
The text was updated successfully, but these errors were encountered:
oh shoot. I don't know how to edit the original task above.
Maybe it was a bad idea to suggest adding libubus.h to LIB_SOURCES. If so, it is possible to get "multiple definitions of" errors in the build. I'd suggest just moving the "return ubus_invoke_fd) definitions from libubus.h to libubus.c
:)
I sometimes get undefined reference to ubus_invoke in libfoo.so.
Then you need to fix the libfoo.so, your toolchain/build because ubus_invoke() is declared as static inline int in libubus.h which means, that you should've it included in your libfoo.so already, statically, there is no such symbol in libubus.so:
$objdump -tT build/libubus.so | grep ubus_invoke
0000000000003b4b g F .text 00000000000000a0 ubus_invoke_async_fd
0000000000003beb g F .text 000000000000007a ubus_invoke_fd
0000000000003beb g DF .text 000000000000007a Base ubus_invoke_fd
0000000000003b4b g DF .text 00000000000000a0 Base ubus_invoke_async_fd
$ objdump -tT build/examples/client | grep ubus_invoke
0000000000000000 F UND 0000000000000000 ubus_invoke_async_fd
0000000000000000 F UND 0000000000000000 ubus_invoke_fd
0000000000000000 DF UND 0000000000000000 ubus_invoke_async_fd
0000000000000000 DF UND 0000000000000000 ubus_invoke_fd
Since this is what comes up with google, I'll reply here. No idea where this openwrt-bot got these messages from.
ynezz is right about the static inline, but the situation I had was different.
Since the libubus in my sdk was an older version than on the router, libubus api had changed from having int ubus_invoke to static inline int ubus invoke. Causing issues with mismatch between sdk and router.
hansdals:
Supply the following if possible:
I'm compiling custom packages that I can unfortunately not share, but the problem is as follows:
This is more a suggestion than a bug report.
I sometimes get undefined reference to ubus_invoke in libfoo.so.
I have tried to replicate the linking error with a simple c program, but it compiles fine (on my ubuntu machine with latest libubus compiled from source today)..
#include <stdio.h>
#include <libubus.h>
int main()
{
ubus_invoke(NULL, 0, NULL, NULL, NULL, NULL, 0);
return 0;
}
gcc test.c -lubus
I think the problem here is that the ubus CMakeLists.txt file has LIB_SOURCES libubus.c (and more), but the definition of ubus_invoke() is in libubus.h. Causing libubus.so to not have that symbol/function.
So if I in a main program call a function in libfoo that calls ubus_invoke, then I can end up with a undefined reference to ubus_invoke ?
Suggest moving the definitions to the .c file , or add libubus.h to LIB_SOURCES
again I'm sorry I couldn't replicate the problem.
The text was updated successfully, but these errors were encountered: