sdfsaf asfsf
sdfsaf asfsf

Reputation: 9

I tried to build Libxls static library and dynamaic library for windows via MSYS2,but it's not working

I tried to build a static library and dynamic library of Libxls for Windows via MSYS2,but it doesn't work

https://github.com/libxls/libxls

my MSYS2 enviroment has everything required which are gcc g++ libiconv etc I have read the install document and readme document as well,it's not working for me,but I just found the blog which really helped me,and I tried the below steps though

#1

CC='i686-w64-mingw32-gcc' ./configure --host=i686-w64-mingw32 --build=i686-w64-mingw32

#2

 make & make install

everything worked fine here,there's no errors yet,I saw the libxlsreader.dll.a ,libxlsreader.la,libxlsreader.lai,libxlsreader-8.dll were generated then I tried step 3

#3

ar x libxlsreader.dll.a

with this step I saw the .o files were generated, then I tried to build a dll file and def file

#4

i686-w64-mingw32-gcc -shared -o libxls.dll *.o -Wl,--export-all-symbols,--output-def,libxls.def -liconv

afterward it generated libxls.dll which was 94k and has only 2 functions as well which were

_nm__brdb @1 DATA
_nm__xls_debug @2 DATA

these was not my unexpceted,cuz it'd should generated a file which has a bunch of functions which consume the libxlsreader-8.dll though, I uploaded the file right here,the consequence files were in .libs folder though

https://drive.google.com/file/d/1zRyursEi3fECVkso-BPOagKa6u60BtDp/view?usp=sharing

any idea what wrong I have done?thank you so much

Upvotes: 0

Views: 643

Answers (1)

Brecht Sanders
Brecht Sanders

Reputation: 7287

That doesn't seem like the right way to build a library like libxls. You should really run the ./configure script, which generates the Makefile that does all the necessary stuff to build a proper library, including what is needed for proper symbol exports in the DLL.

Here's how I do it from the MSYS2 shell using MinGW-w64:

# install location (change as needed)
INSTALLPREFIX=/usr/local
wget https://github.com/libxls/libxls/releases/download/v1.6.1/libxls-1.6.1.tar.gz
tar xfz libxls-1.6.1.tar.gz
cd libxls-1.6.1
./configure --prefix=$INSTALLPREFIX --enable-static --enable-shared &&
 make install-strip &&
 echo SUCCESS

Upvotes: 1

Related Questions