Tiny Core Linux
Tiny Core Extensions => TCE Q&A Forum => Topic started by: asi3brg on January 16, 2020, 05:15:22 AM
-
I've a c++ dll (.so) that I use to comunicate in a CAN-BUS via a PEAK CAN-FD interface.
Now I want to use this dll within Tiny Core but I'm facing errors compiling it with gcc (once in Tiny Core couldn't found g++ compiler).
Note: I used this dll in ubuntu, compiled with g++, now I tested compiling with gcc, also in ubuntu, and I got the same errors.
Atached I'm send errors generated by gcc compilattion in Tiny Core
Please let me know if you have some help or hint.
-
Use the compiletc meta-extension to compile in tinycore - that being said, g++ is provided by the gcc extension.
Note that gcc and tinycore are compiled for a minimum cpu of i486.
You might need to define which c++ standard you wish to compile to.
-
Hi asi3brg
Welcome to the forum. From your attachment, try changing this:
gcc -static -g LibCAN.cpp GenericAux.cpp pcaninfo.c TimeOut.cpp -O0 -Wall -m32 -march=i386 -mtune=i386 -fno-stack-protector -fPIC -Wl,--no-undefined -shared -I/usr/include -I../../ -ldl -o LibCAN.so
to that:
gcc -static -g LibCAN.cpp GenericAux.cpp pcaninfo.c TimeOut.cpp -O0 -Wall -m32 -march=i386 -mtune=i386 -fno-stack-protector -fPIC -Wl,--no-undefined -shared -I/usr/include -I../../ -lstdc++ -lm -ldl -o LibCAN.so
So you want to add -lstdc++ and -lm to the make file, probably where it lists -ldl.
-
Hi Juanito,
Thank you for the fast reply.
After add -lstdc++ and -lm only this error remains
tc@box:/home/BlBox_SW/LibCAN/LibCAN$ make
gcc -static -g LibCAN.cpp GenericAux.cpp pcaninfo.c TimeOut.cpp -I/usr/include -I../../ -lstdc++ -lm -ldl -o LibCAN.so
/usr/local/bin/ld: /tmp/cccgs6Z3.o: in function `CANBasic::LoadDllSo()':
/home/BlBox_SW/LibCAN/LibCAN/LibCAN.cpp:635: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/local/bin/ld: /usr/lib/crt1.o: in function `_start':
(.text+0x18): undefined reference to `main'
collect2: error: ld returned 1 exit status
make: *** [Makefile:27: all] Error 1
tc@box:/home/BlBox_SW/LibCAN/LibCAN$
-
Hi asi3brg
Do you have a main defined in any of your source files? If not, maybe you need to add:
-nostartfiles
to your linker options.
-
Hi Rich
Now I'm able to compile this shared object in Tiny Core.
Thank you for your excellent support.
-
Hi asi3brg
You are welcome. Thank you for confirming your success.