help of building shared library
okcy1016 opened this issue · 1 comments
Hi jart, thanks for the excellent work of both cosmopolitan and bestline.
Recently, I need a cross-platform readline replacement for python since it simply not working on windows, and with some researching I found this repo.
I initially tried to compile bestline.c to libbestline.so, with GNU gcc and it's std lib, I could get it work, but it is not really portable since it rely on libc and several libs at runtime, see:
Then I tried to compile it with cosmopolitan which I consider it features a portable libc runtime, I tried the following build command:
libbestline.so: bestline.c crt.o ape.o ape.lds cosmopolitan.a cosmopolitan.h
gcc -g -Os -fPIC -shared -fno-pie -no-pie -mno-red-zone -nostdlib -nostdinc -fno-omit-frame-pointer -pg -mnop-\
mcount -o $@ bestline.c -Wl,--gc-sections -fuse-ld=bfd -Wl,-T,ape.lds -include cosmopolitan.h crt.o ape.o cosmopolitan\
.a
Unfortunatelly, it produces a ELF 64-bit LSB executable
instead of a shared object:
what I want is to build is a dynamic library with ldd comand shows not a dynamic executable
.
Could you send some help to me? I would be very appreciate for that.
thank you in advance :D
Cosmopolitan doesn't have support for building dynamic shared objects. You need to build your executable with cosmopolitan. If you're looking to use bestline with Python, then consider trying python.com where we've already ported bestline to Python.
git clone https://github.com/jart/cosmopolitan
cd cosmopolitan
build/bootstrap/make.com o//third_party/python/python.com
o//third_party/python/python.com
Enjoy!