andmarti1424 / sc-im

sc-im - Spreadsheet Calculator Improvised -- An ncurses spreadsheet program for terminal
Other
4.81k stars 204 forks source link

Compilation errors about zip functions when building with xlsx support #714

Closed ephemer4l closed 2 years ago

ephemer4l commented 2 years ago
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: skipping incompatible /usr/lib/libm.so when searching for -lm
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: skipping incompatible /usr/lib/libm.a when searching for -lm
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: skipping incompatible /usr/lib/libc.so when searching for -lc
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: skipping incompatible /usr/lib/libc.a when searching for -lc
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../lib64/libxlsxwriter.a(packager.c.o): in function `_add_file_to_zip':
(.text+0x3f): undefined reference to `zipOpenNewFileInZip4_64'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: (.text+0xe9): undefined reference to `zipWriteInFileInZip'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: (.text+0x116): undefined reference to `zipCloseFileInZip'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../lib64/libxlsxwriter.a(packager.c.o): in function `lxw_packager_new':
(.text+0x27d): undefined reference to `zipOpen'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../lib64/libxlsxwriter.a(packager.c.o): in function `lxw_create_package':
(.text+0xe94): undefined reference to `zipClose'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: (.text+0xed2): undefined reference to `zipClose'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: (.text+0x1d28): undefined reference to `zipClose'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: (.text+0x1e75): undefined reference to `zipClose'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: (.text+0x2196): undefined reference to `zipOpenNewFileInZip4_64'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: (.text+0x220b): undefined reference to `zipWriteInFileInZip'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: (.text+0x221c): undefined reference to `zipCloseFileInZip'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: (.text+0x24d5): undefined reference to `zipClose'
collect2: error: ld returned 1 exit status
make: *** [Makefile:194: sc-im] Error 1

I use sc-im-0.8.2 but the same issue happens also if I clone the source from github. I'm on gentoo. I use this: https://gitweb.gentoo.org/repo/proj/guru.git/tree/dev-libs/libxlsxwriter/libxlsxwriter-1.1.4.ebuild?h=dev&id=fd50b5c39e810314d0fcb852064b52cbe684a1ad to install libxlsxwriter.

andmarti1424 commented 2 years ago

Please check you have libzip installed. It shows undefined reference to all of its functions..

ephemer4l commented 2 years ago

I have libzip 1.8.0 installed.

*  dev-libs/libzip
      Latest version available: 1.8.0-r1
      Latest version installed: 1.8.0-r1
      Size of files: 743 KiB
      Homepage:      https://nih.at/libzip/
      Description:   Library for manipulating zip archives
      License:       BSD

with these use flags:

 * Found these USE flags for dev-libs/libzip-1.8.0-r1:
 U I
 + + bzip2       : Use the bzlib compression library
 - - gnutls      : Prefer net-libs/gnutls as SSL/TLS provider (ineffective with USE=-ssl)
 - - lzma        : Support for LZMA (de)compression algorithm
 - - mbedtls     : Use net-libs/mbedtls as TLS provider
 + + ssl         : Add support for SSL/TLS connections (Secure Socket Layer / Transport Layer Security)
 - - static-libs : Build static versions of dynamic libraries as well
 - - test        : Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)
 - - tools       : Install binary tools to compare, modify and merge zip files 
 - - zstd        : Enable support for ZSTD compression

Although one interesting thing is that I get no cflags for libzip with pkg-config:

$ pkg-config --cflags libzip

$

And no flags for libxlsxwriter either:

$ pkg-config --cflags xlsxwriter

$

and the libs for both give me the output:

$ pkg-config --libs xlsxwriter
-L/usr/lib -lxlsxwriter -lz 
$ pkg-config --libs libzip
-lzip

Another thing that may interest you is that I can't fine any .so files for libxlsxwriter. All I have is

.rw-r--r-- 660k root  7 May 08:09  /usr/lib64/libxlsxwriter.a
ephemer4l commented 2 years ago

After my comment it dawned on me that I wasn't building libxlsxwriter with dynamic libraries. Adding -DBUILD_SHARED_LIBS="ON" to cmake args fixed the issue.