Skip to content
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

Building a dynamic library using libmaix #11

Closed
pauceano opened this issue Mar 28, 2024 · 1 comment
Closed

Building a dynamic library using libmaix #11

pauceano opened this issue Mar 28, 2024 · 1 comment

Comments

@pauceano
Copy link

I am trying to build a dynamic library using libmaix but I cannot.
I want to build libZMQ library,

I copied the hello_world example in libmaix, I have put al sources in main/src and includes in main/include

I have added to /libmaix/examples/libzmq/main/CMakeLists.txt
list(APPEND ADD_DEFINITIONS -fPIC)
and register_component(SHARED)
I see in the logs that compile.cmake has activated to_dynamic_lib flag.
But, after compiling everything, it ends with the following error:
.....
[ 95%] Building CXX object main/CMakeFiles/main.dir/src/zmq_utils.cpp.o
[ 96%] Building CXX object main/CMakeFiles/main.dir/src/zmtp_engine.cpp.o
[ 97%] Linking CXX shared library libmain.so
[ 97%] Built target main
Scanning dependencies of target libzmq
[ 98%] Building C object CMakeFiles/libzmq.dir/exe_src.c.o
[ 99%] Linking C executable libzmq
/opt/toolchain-sunxi-musl/toolchain/bin/../lib/gcc/arm-openwrt-linux-muslgnueabi/6.4.1/../../../../arm-openwrt-linux-muslgnueabi/lib/crt1.o: In function _start_c': /home/caiyongheng/tina/out/astar-parrot/compile_dir/toolchain/musl-1.1.16/crt/crt1.c:17: undefined reference to main'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/libzmq.dir/build.make:89: libzmq] Error 1
make[1]: *** [CMakeFiles/Makefile2:301: CMakeFiles/libzmq.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
.......
CMakeLists.txt

@Neutree
Copy link
Owner

Neutree commented Mar 28, 2024

dumplcate with #10

@Neutree Neutree closed this as completed Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants