Skip to content

Undefined reference to `cnpy::npy_load(std::string)' #95

Description

@rsmath

Cnpy is having trouble when used in conjunction with PyTorch. I boiled down the problem to having included PyTorch in the CMakeLists.txt as follows

FIND_PACKAGE(Torch REQUIRED)
FIND_PACKAGE(ZLIB REQUIRED)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})

INCLUDE_DIRECTORIES("/home/USER/cnpy")
LINK_DIRECTORIES("/home/USER/cnpy/build")

add_executable(example1 example1.cpp)
target_link_libraries(example1 cnpy)
TARGET_LINK_LIBRARIES(example1 "${TORCH_LIBRARIES}")
TARGET_LINK_LIBRARIES(example1 ${ZLIB_LIBRARIES})

When I do not enforce PyTorch to be found, the example code in the repository runs fine with loading cnpy. Otherwise, I get the following error.

image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions