conan: conan create failed with ld: symbol(s) not found for architecture x86_64

Hi, I’m trying to learn how to create package using conan and make this toy example armadillo.

Following the tutorial, by conan create demo/testing the package seems to be built and installed successfully however the test failed with

clang: warning: libstdc++ is deprecated; move to libc++ [-Wdeprecated]
Undefined symbols for architecture x86_64:
  "_ddot_", referenced from:
      void arma::syrk_vec<false, false, false>::apply<double, arma::Mat<double> >(arma::Mat<double>&, arma::Mat<double> const&, double, double) in example.cpp.o
  "_dgemm_", referenced from:
      void arma::gemm<false, true, false, false>::apply_blas_type<double, arma::Mat<double>, arma::Mat<double> >(arma::Mat<double>&, arma::Mat<double> const&, arma::Mat<double> const&, double, double) in example.cpp.o
  "_dgemv_", referenced from:
      void arma::glue_times::apply<double, false, true, false, arma::Mat<double>, arma::Mat<double> >(arma::Mat<double>&, arma::Mat<double> const&, arma::Mat<double> const&, double) in example.cpp.o
  "_dsyrk_", referenced from:
      void arma::syrk<false, false, false>::apply_blas_type<double, arma::Mat<double> >(arma::Mat<double>&, arma::Mat<double> const&, double, double) in example.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bin/example] Error 1
make[1]: *** [CMakeFiles/example.dir/all] Error 2
make: *** [all] Error 2
ERROR: PROJECT: Error in build() method, line 12
	cmake.build()
	ConanException: Error 512 while executing cmake --build './' '--' '-j4'

I’m on a macOS 10.12.6 (16G1036) with conan 0.29.2. Can you give me some hints to solve this? Thank you!

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 24 (13 by maintainers)

Most upvoted comments

@danimtb Thanks. I’m a bit new to C++ and conan though having a Python background. If I made anything stupid, please forgive me.🙁

@lasote I’m sorry I’ve made a mistake that I’ve a global installed version. Manually running the command gave the same error. However, manually adding the blas to target_link_libraries in the CMakeLists.txt of the test_package demo solve the problem. Thank you very much.

However, when I use the global version armadillo, simply g++ -o example example.cpp -larmadillo works as given in section 6 here. Why do we add blas when using conan?

I think I did. Since the file is auto generated …

project(PackageTest CXX)
cmake_minimum_required(VERSION 2.8.12)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

add_executable(example example.cpp)
target_link_libraries(example ${CONAN_LIBS})

# CTest is a testing tool that can be used to test your project.
# enable_testing()
# add_test(NAME example
#          WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
#          COMMAND example)