brechtsanders / xlsxio

XLSX I/O - C library for reading and writing .xlsx files
MIT License
421 stars 112 forks source link

Dynamic library cannot be used #103

Open aszswaz opened 3 years ago

aszswaz commented 3 years ago

This is my CMakeList.

cmake_minimum_required(VERSION 3.20)
project(easyexcel C)

set(CMAKE_C_STANDARD 99)

find_package(PkgConfig)
set(ENV{PKG_CONFIG_PATH} /usr/local/lib/pkgconfig)
pkg_check_modules(XLSXIO_READ REQUIRED libxlsxio_read)
message(XLSXIO_READ_INCLUDE_DIRS: ${XLSXIO_READ_INCLUDE_DIRS})
message(XLSXIO_READ_LIBRARIES: ${XLSXIO_READ_LIBRARIES})

include_directories(${XLSXIO_READ_INCLUDE_DIRS})
link_directories(${XLSXIO_READ_LIBRARIES})

add_executable(${PROJECT_NAME} main.c)
target_link_libraries(${PROJECT_NAME} xlsxio_read xlsxio_write)

This is cmake build information.

XLSXIO_READ_INCLUDE_DIRS:/usr/local/include
XLSXIO_READ_LIBRARIES:xlsxio_readminizipzexpat
-- Configuring done
-- Generating done
-- Build files have been written to: /home/aszswaz/project/CLionProjects/easyexcel/cmake-build-debug

This is the program error log.

/home/aszswaz/project/CLionProjects/easyexcel/cmake-build-debug/easyexcel: error while loading shared libraries: libxlsxio_read.so: cannot open shared object file: No such file or directory

xlsxio按照默认的配置安装在 /usr/local/lib,How do I solve this problem?

brechtsanders commented 3 years ago

Have you tried with the latest changes made to master for #101 ?

aszswaz commented 3 years ago

Have you tried with the latest changes made to master for #101 ?

I tried it, but it is still the same. Compilation can be completed. Once the program is run, the dynamic library cannot be used.

brechtsanders commented 3 years ago

If it compiles that's already good. Is everything in place for dependency shared libraries to be found? Can you give more information about: operating system, exact output / errors?