Compiling ubus with external toolchain fails

Compiling ubus with external toolchain fails,in ubus CMakeLists.txt,can't find libubusd_library.a.
ADD_EXECUTABLE(ubusd ubusd_main.c)
TARGET_LINK_LIBRARIES(ubusd ubusd_library ${ubox_library} ${blob_library} ${json})
the error log is

In function `sighup_handler': <artificial>:(.text+0x14): undefined reference to `ubusd_acl_load'
:(.text+0x18): undefined reference to `ubusd_acl_load' /home/narwal/work/test/tmp/cc6at7gQ.ltrans0.ltrans.o: In function `server_cb':
:(.text+0x94): undefined reference to `ubusd_proto_new_client' <artificial>:(.text+0xa0): undefined reference to `ubusd_proto_new_client'
/home/narwal/work/test/tmp/cc6at7gQ.ltrans0.ltrans.o: In function `client_cb': <artificial>:(.text+0x12c): undefined reference to `ubus_msg_writev'
:(.text+0x138): undefined reference to `ubus_msg_writev' <artificial>:(.text+0x14c): undefined reference to `ubus_msg_list_free'
:(.text+0x15c): undefined reference to `ubus_msg_list_free' <artificial>:(.text+0x1ec): undefined reference to `ubus_msg_new'
:(.text+0x1f0): undefined reference to `ubus_msg_new'`

try the </> above the message window, when posting cli output.

1 Like

There is a warning further up that says:
CMakeFiles/ubusd_library.dir/ubusd_acl.c.o: plugin needed to handle lto object

For two external toolchains I have fixed it by removing -flto from the ubus/Makefile

Snippets from a dockerfile that sets up an sdk:

RUN sed 's/TARGET_LDFLAGS += -flto//g' -i package/system/ubus/Makefile
RUN sed 's/ -flto//g' -i package/system/ubus/Makefile

Hans

2 Likes