Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linking error #51

Open
chongyi-zheng opened this issue Feb 4, 2019 · 5 comments
Open

linking error #51

chongyi-zheng opened this issue Feb 4, 2019 · 5 comments

Comments

@chongyi-zheng
Copy link

I'm trying to compile a project with the xtensor-io library but I get an linking error as

usr/bin/ld: cannot find -l

I have already included

find_package(xtensor-io REQUIRED)
...
target_include_directories(... PRIVATE ${xtensor_io_INCLUDE_DIRS})
target_link_libraries(... PUBLIC xtensor-io)

in my CMakeLists.txt. However, it just didn't work.

Can someone help me?

@SylvainCorlay
Copy link
Member

Could you please provide the error message?

@chongyi-zheng
Copy link
Author

Oh, sorry for that.

Here are some details.

I'm currently working on a ubuntu 18.04 LTS system. I have already installed xtensor-io library into the system when I compiled source codes in directory of the project:

mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr/local ..
sudo make install

After that, I added the code above in my own project's CMakeLists.txt, then

cmake ..
make

errored out following messages

usr/bin/ld: cannot find -lxtensor-io
collect2: error: ld returned 1 exit status

Any suggestions?

@nganhkhoa
Copy link

It is stated in the README.md that this project is a header only library:

xtensor-io is a header-only library

So no library will be built, thus no linking library. The headers should be placed some where on the general include search, /usr/include, or modify your LIBRARY_PATH to contains the folder of the header files, or provide -I/path/to/xtensor-io/include/ when compiling using g++.

@wolfv
Copy link
Member

wolfv commented Mar 12, 2019

yeah, this is something coming along with the new cmake stuff. ngankhoa is right, not linking xtensor-io (but rather the dependencies, like OpenImageIO, ... should help in this case).

Just adding hte xtensor-io_INCLUDES to your include directories should help.

@mfouesneau
Copy link

I also have linking issues when using the example from the documentation

#include <xtensor/xio.hpp>
#include <xtensor-io/xhighfive.hpp>

int main()
{
    xt::xtensor<double,2> A = xt::ones<double>({10,5});

    xt::dump_hdf5("example.h5", "/path/to/data", A);

    A = xt::load_hdf5<xt::xtensor<double,2>>("example.h5", "/path/to/data");

    std::cout << A << std::endl;

    return 0;
}

I think I compile the example properly, but I cannot get some types apparently defined somewhere. The error is below

g++ -I./include/xtensor/include -I./include/xtensor-io/include -I./include/xtensor-blas/include -I./include/xtensor-blas/include/xtensor-blas/flens -I./include -std=c++14  xtio.cpp -o xtio  -lblas -llapack -lhdf5
Undefined symbols for architecture x86_64:
  "HighFive::AtomicType<xt::uvector<double, std::__1::allocator<double> > >::AtomicType()", referenced from:
      void HighFive::SliceTraits<HighFive::DataSet>::read<xt::uvector<double, std::__1::allocator<double> > >(xt::uvector<double, std::__1::allocator<double> >&) const in xtio-ba4fba.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants