the test is very hard
I set option(OPENXLSX_ENABLE_LIBZIP "Enable using libzip" ON) in OpenXLSX-development-aral/CMakeLists.txt
and run
mkdir build2
cd build2
cmake ..
it reports
-- Configuring done
CMake Error at OpenXLSX/CMakeLists.txt:178 (target_link_libraries):
Target "OpenXLSX" links to:
libzip::zip
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
-- Generating done
but I can run make, it stoped at
In file included from /par/OpenXLSX-development-aral/OpenXLSX/sources/XLZipArchive.cpp:48:
/par/OpenXLSX-development-aral/OpenXLSX/headers/detail/LibZip.hpp:11:10: fatal error: zip.h: No such file or directory
11 | #include <zip.h> // libzip
so I add export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/par/libzip-1.11.4/lib and it continue
[ 8%] Linking CXX static library ../output/libOpenXLSX.a
[ 60%] Built target OpenXLSX
[ 62%] Building CXX object Examples/CMakeFiles/Demo1.dir/Demo1.cpp.o
[ 64%] Linking CXX executable ../output/Demo1
/usr/bin/ld: cannot find -llibzip::zip: No such file or directory
I then modified the OpenXLSX-development-aral/OpenXLSX/CMakeLists.txt, replace all libzip::zip to zip
and make sure the libzip.so in the following path
ls -l /par/libzip-1.11.4/build/lib
total 332
drwxrwxrwx 1 root root 4096 Aug 25 11:49 CMakeFiles
-rwxrwxrwx 1 root root 263 Aug 25 11:49 CTestTestfile.cmake
-rwxrwxrwx 1 root root 127726 Aug 25 11:49 Makefile
-rwxrwxrwx 1 root root 3132 Aug 25 11:49 cmake_install.cmake
lrwxrwxrwx 1 root root 11 Aug 25 11:49 libzip.so -> libzip.so.5
lrwxrwxrwx 1 root root 13 Aug 25 11:49 libzip.so.5 -> libzip.so.5.5
-rwxrwxrwx 1 root root 200368 Aug 25 11:49 libzip.so.5.5
-rwxrwxrwx 1 root root 3142 Aug 25 11:49 zip_err_str.c
I set export LIBRARY_PATH=$LIBRARY_PATH:/par/libzip-1.11.4/build/lib and make it again, it finished at
[100%] Built target Demo10
I made sure it depends on libzip by
ldd output/Demo5
linux-vdso.so.1 (0x00007fffae1f0000)
libzip.so.5 => /par/libzip-1.11.4/build/lib/libzip.so.5 (0x00007fa234a87000)
then
export LD_LIBRARY_PATH=$LIBRARY_PATH:/par/libzip-1.11.4/build/lib
it can run now, but it much slower than the orignal OPENXLSX_ENABLE_LIBZIP OFF config(in build).
root@6ae32a5ffcde:/par/OpenXLSX-development-aral/build2# time output/Demo5
********************************************************************************
DEMO PROGRAM #05: Ranges and Iterators
********************************************************************************
Generating spreadsheet ...
Saving spreadsheet ...
Re-opening spreadsheet ...
Reading data from spreadsheet ...
Cell count: 8388608
Sum of cell values: 415132707
real 0m48.306s
user 0m43.401s
sys 0m2.463s
root@6ae32a5ffcde:/par/OpenXLSX-development-aral/build2# cd ../build
root@6ae32a5ffcde:/par/OpenXLSX-development-aral/build# time output/Demo5
********************************************************************************
DEMO PROGRAM #05: Ranges and Iterators
********************************************************************************
Generating spreadsheet ...
Saving spreadsheet ...
Re-opening spreadsheet ...
Reading data from spreadsheet ...
Cell count: 8388608
Sum of cell values: 415096577
real 0m16.781s
user 0m14.867s
sys 0m2.513s
460

被折叠的 条评论
为什么被折叠?



