I have downloaded the latest Armadillo package (3.920) and I am trying to use it on my machine (Ubuntu 12.04). I am following the steps mentioned in the readme.txt file for the installation (cmake ., make, sudo make install). I have lapack and blas on my system. When I try to run the example provided in the examples directory using:
g++ example1.cpp -O2 -larmadillo
I get the error:
/usr/lib/liblapack.so.3gf: undefined reference to ATL_zptgemm'
/usr/lib/liblapack.so.3gf: undefined reference toATL_scopy'
etc
If I try to run the example with
g++ example1.cpp -O2 -llpack -lblas -lgfortran
I get the error:
/tmp/ccOsKhfg.o: In function double arma::blas::dot<double>(unsigned int, double const*, double const*)':
example1.cpp:(.text._ZN4arma4blas3dotIdEET_jPKS2_S4_[double arma::blas::dot<double>(unsigned int, double const*, double const*)]+0x36): undefined reference towrapper_ddot_'
/tmp/ccOsKhfg.o: In function void arma::blas::gemv<double>(char const*, int const*, int const*, double const*, double const*, int const*, double const*, int const*, double const*, double*, int const*)':
example1.cpp:(.text._ZN4arma4blas4gemvIdEEvPKcPKiS5_PKT_S8_S5_S8_S5_S8_PS6_S5_[void arma::blas::gemv<double>(char const*, int const*, int const*, double const*, double const*, int const*, double const*, int const*, double const*, double*, int const*)]+0x53): undefined reference towrapper_dgemv_'
/tmp/ccOsKhfg.o: In function void arma::blas::gemm<double>(char const*, char const*, int const*, int const*, int const*, double const*, double const*, int const*, double const*, int const*, double const*, double*, int const*)':
example1.cpp:(.text._ZN4arma4blas4gemmIdEEvPKcS3_PKiS5_S5_PKT_S8_S5_S8_S5_S8_PS6_S5_[void arma::blas::gemm<double>(char const*, char const*, int const*, int const*, int const*, double const*, double const*, int const*, double const*, int const*, double const*, double*, int const*)]+0x61): undefined reference towrapper_dgemm_'
Note that if I comment lines '#define ARMA_USE_LAPACK','#define ARMA_USE_BLAS'in config.hpp I am able to run example 1 but not example 2 as it requires lapack.
Can you please guide me in solving the problem.
Thanks.
Salil
By seeing your question,
i think you should type -llapack instead of -llpack.
Without -lgfortan it can work so try that too.
g++ main.cpp -o main -o1 -larmadillo -llapack -lblas
Related
When I try to compile Flutter in my environment(macOS、M1), I get the following error.
Can anyone tell me how to fix it?
~/development/engine/src# ninja -C out/host_debug_unopt
ninja: Entering directory `out/host_debug_unopt'
[4610/5246] ACTION //third_party/dart/runtime/bin:generate_snapshot_bin(//build/toolchain/mac:clang_arm64)
FAILED: clang_arm64/gen/third_party/dart/runtime/bin/vm_snapshot_data.bin clang_arm64/gen/third_party/dart/runtime/bin/vm_snapshot_instructions.bin clang_arm64/gen/third_party/dart/runtime/bin/isolate_snapshot_data.bin clang_arm64/gen/third_party/dart/runtime/bin/isolate_snapshot_instructions.bin
python3 ../../third_party/dart/build/gn_run_binary.py compiled_action clang_arm64/gen_snapshot --sound-null-safety --deterministic --snapshot_kind=core --vm_snapshot_data=clang_arm64/gen/third_party/dart/runtime/bin/vm_snapshot_data.bin --vm_snapshot_instructions=clang_arm64/gen/third_party/dart/runtime/bin/vm_snapshot_instructions.bin --isolate_snapshot_data=clang_arm64/gen/third_party/dart/runtime/bin/isolate_snapshot_data.bin --isolate_snapshot_instructions=clang_arm64/gen/third_party/dart/runtime/bin/isolate_snapshot_instructions.bin /Users/rentoezoe/development/engine/src/out/host_debug_unopt/clang_arm64/vm_platform_strong_stripped.dill
Command failed: ./clang_arm64/gen_snapshot --sound-null-safety --deterministic --snapshot_kind=core --vm_snapshot_data=clang_arm64/gen/third_party/dart/runtime/bin/vm_snapshot_data.bin --vm_snapshot_instructions=clang_arm64/gen/third_party/dart/runtime/bin/vm_snapshot_instructions.bin --isolate_snapshot_data=clang_arm64/gen/third_party/dart/runtime/bin/isolate_snapshot_data.bin --isolate_snapshot_instructions=clang_arm64/gen/third_party/dart/runtime/bin/isolate_snapshot_instructions.bin /Users/rentoezoe/development/engine/src/out/host_debug_unopt/clang_arm64/vm_platform_strong_stripped.dill
output: ../../third_party/dart/runtime/vm/cpuinfo_macos.cc: 42: error: unreachable code
version=2.15.0-110.0.dev (dev) (Wed Sep 15 09:12:52 2021 -0700) on "macos_x64"
pid=55356, thread=259, isolate_group=(nil)(0x0), isolate=(nil)(0x0)
isolate_instructions=0, vm_instructions=0
pc 0x000000010088fe00 fp 0x000000016f835de0 dart::Profiler::DumpStackTrace(void*)+0x90
pc 0x00000001005fa974 fp 0x000000016f835e00 dart::Assert::Fail(char const*, ...) const+0x28
pc 0x00000001007522d8 fp 0x000000016f836240 dart::CpuInfo::FieldContains(dart::CpuInfoIndices, char const*)+0xb0
pc 0x000000010075201c fp 0x000000016f836260 dart::HostCPUFeatures::Init()+0x64
pc 0x00000001007526f4 fp 0x000000016f836480 dart::Dart::DartInit(unsigned char const*, unsigned char const*, _Dart_Isolate* (*)(char const*, char const*, char const*, char const*, Dart_IsolateFlags*, void*, char**), bool (*)(void**, char**), void (*)(void*, void*), void (*)(void*, void*), void (*)(void*), void (*)(), void* (*)(char const*, bool), void (*)(unsigned char**, long*, void*), void (*)(void const*, long, void*), void (*)(void*), bool (*)(unsigned char*, long), _Dart_Handle* (*)(), bool, Dart_CodeObserver*)+0x2e0
pc 0x0000000100752c94 fp 0x000000016f836500 dart::Dart::Init(unsigned char const*, unsigned char const*, _Dart_Isolate* (*)(char const*, char const*, char const*, char const*, Dart_IsolateFlags*, void*, char**), bool (*)(void**, char**), void (*)(void*, void*), void (*)(void*, void*), void (*)(void*), void (*)(), void* (*)(char const*, bool), void (*)(unsigned char**, long*, void*), void (*)(void const*, long, void*), void (*)(void*), bool (*)(unsigned char*, long), _Dart_Handle* (*)(), bool, Dart_CodeObserver*)+0x74
pc 0x0000000100fbcf0c fp 0x000000016f836560 Dart_Initialize+0x68
pc 0x00000001005cd600 fp 0x000000016f836700 dart::bin::main(int, char**)+0x650
pc 0x00000001a0b21430 fp 0x000000016f836720 start+0x4
-- End of DumpStackTrace
[4611/5246] ACTION //flutter/lib/snapshot:generate_snapshot_bin(//build/toolchain/mac:clang_x64)
FAILED: gen/flutter/lib/snapshot/vm_isolate_snapshot.bin gen/flutter/lib/snapshot/vm_snapshot_instructions.bin gen/flutter/lib/snapshot/isolate_snapshot.bin gen/flutter/lib/snapshot/isolate_snapshot_instructions.bin
python3 ../../build/gn_run_binary.py clang_arm64/gen_snapshot --snapshot_kind=core --enable_mirrors=false --vm_snapshot_data=/Users/rentoezoe/development/engine/src/out/host_debug_unopt/gen/flutter/lib/snapshot/vm_isolate_snapshot.bin --vm_snapshot_instructions=/Users/rentoezoe/development/engine/src/out/host_debug_unopt/gen/flutter/lib/snapshot/vm_snapshot_instructions.bin --isolate_snapshot_data=/Users/rentoezoe/development/engine/src/out/host_debug_unopt/gen/flutter/lib/snapshot/isolate_snapshot.bin --isolate_snapshot_instructions=/Users/rentoezoe/development/engine/src/out/host_debug_unopt/gen/flutter/lib/snapshot/isolate_snapshot_instructions.bin --enable_asserts /Users/rentoezoe/development/engine/src/out/host_debug_unopt/flutter_patched_sdk/platform_strong.dill
../../third_party/dart/runtime/vm/cpuinfo_macos.cc: 42: error: unreachable code
version=2.15.0-110.0.dev (dev) (Wed Sep 15 09:12:52 2021 -0700) on "macos_x64"
pid=55354, thread=259, isolate_group=(nil)(0x0), isolate=(nil)(0x0)
isolate_instructions=0, vm_instructions=0
pc 0x000000010494be00 fp 0x000000016b779d40 dart::Profiler::DumpStackTrace(void*)+0x90
pc 0x00000001046b6974 fp 0x000000016b779d60 dart::Assert::Fail(char const*, ...) const+0x28
pc 0x000000010480e2d8 fp 0x000000016b77a1a0 dart::CpuInfo::FieldContains(dart::CpuInfoIndices, char const*)+0xb0
pc 0x000000010480e01c fp 0x000000016b77a1c0 dart::HostCPUFeatures::Init()+0x64
pc 0x000000010480e6f4 fp 0x000000016b77a3e0 dart::Dart::DartInit(unsigned char const*, unsigned char const*, _Dart_Isolate* (*)(char const*, char const*, char const*, char const*, Dart_IsolateFlags*, void*, char**), bool (*)(void**, char**), void (*)(void*, void*), void (*)(void*, void*), void (*)(void*), void (*)(), void* (*)(char const*, bool), void (*)(unsigned char**, long*, void*), void (*)(void const*, long, void*), void (*)(void*), bool (*)(unsigned char*, long), _Dart_Handle* (*)(), bool, Dart_CodeObserver*)+0x2e0
pc 0x000000010480ec94 fp 0x000000016b77a460 dart::Dart::Init(unsigned char const*, unsigned char const*, _Dart_Isolate* (*)(char const*, char const*, char const*, char const*, Dart_IsolateFlags*, void*, char**), bool (*)(void**, char**), void (*)(void*, void*), void (*)(void*, void*), void (*)(void*), void (*)(), void* (*)(char const*, bool), void (*)(unsigned char**, long*, void*), void (*)(void const*, long, void*), void (*)(void*), bool (*)(unsigned char*, long), _Dart_Handle* (*)(), bool, Dart_CodeObserver*)+0x74
pc 0x0000000105078f0c fp 0x000000016b77a4c0 Dart_Initialize+0x68
pc 0x0000000104689600 fp 0x000000016b77a660 dart::bin::main(int, char**)+0x650
pc 0x00000001a0b21430 fp 0x000000016b77a680 start+0x4
-- End of DumpStackTrace
[4619/5246] ACTION //third_party/dart/utils/kernel-service:kernel_service_dill(//build/toolchain/mac:clang_arm64)
ninja: build stopped: subcommand failed.
zsh: exit 1 ninja -C out/host_debug_unopt
Just before the above, I run the following.
(This is after preparing the engine in the environment at hand in the way described in this document.
https://github.com/flutter/flutter/wiki/Setting-up-the-Engine-development-environment)
~/development/engine/src# ./flutter/tools/gn --unoptimized
GOMA usage was specified but can't be found, falling back to local builds. Set the GOMA_DIR environment variable to fix GOMA.
Using prebuilt Dart SDK binary. If you are editing Dart sources and wish to compile the Dart SDK, set `--no-prebuilt-dart-sdk`.
Generating GN files in: out/host_debug_unopt
Generating Xcode projects took 113ms
Generating compile_commands took 26ms
Done. Made 585 targets from 221 files in 2943ms
I am using armadillo in C++ and have a very simple issue - can someone please explain to me why I am unable to calculate XtX? I am multiplying a 2x3 and a 3x2 matrix and as soon as I add the last line, the code does not build.
mat X(3,2);
X="1 3; 1 2; 1 5";
mat Xt;
Xt=X.t();
mat XtX(2,2);
XtX=Xt*X;
This is the error I get:
[build] CMakeFiles\MoE.dir/objects.a(main.cpp.obj): In function `void arma::blas::gemv<double>(char const*, int const*, int const*, double const*, double const*, int const*, double const*, int const*, double const*, double*, int const*)':
[build] C:/Users/.../include/armadillo_bits/wrapper_blas.hpp:42: undefined reference to `wrapper_dgemv_'
I'm trying to compile the first example presented in CGAL's Quadratic Programming document here. I'm using Debian Jessie and installed CGAL via sudo apt-get libcgal-dev and verified that it's present in /usr/include, along with a few of its dependencies, e.g. boost, gmpxx.h, mpfr.h. Per gmp's document here, I try to compile with: g++ first_qp.cpp -lmpfr -lgmp
It appears I get several linker errors below. Any help is appreciated, thanks!
/tmp/ccPeDUda.o: In function `CGAL::Algebraic_structure_traits<CGAL::Gmpz>::Integral_division::operator()(CGAL::Gmpz const&, CGAL::Gmpz const&) const':
first_qp.cpp:(.text._ZNK4CGAL26Algebraic_structure_traitsINS_4GmpzEE17Integral_divisionclERKS1_S5_[_ZNK4CGAL26Algebraic_structure_traitsINS_4GmpzEE17Integral_divisionclERKS1_S5_]+0xac): undefined reference to `CGAL::postcondition_fail(char const*, char const*, int, char const*)'
/tmp/ccPeDUda.o: In function `CGAL::Handle_for<CGAL::Gmpz_rep, std::allocator<CGAL::Gmpz_rep> >::Handle_for(CGAL::Handle_for<CGAL::Gmpz_rep, std::allocator<CGAL::Gmpz_rep> > const&)':
first_qp.cpp:(.text._ZN4CGAL10Handle_forINS_8Gmpz_repESaIS1_EEC2ERKS3_[_ZN4CGAL10Handle_forINS_8Gmpz_repESaIS1_EEC5ERKS3_]+0x50): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
/tmp/ccPeDUda.o: In function `CGAL::Quadratic_program<int>::Quadratic_program(CGAL::Sign, bool, int, bool, int)':
first_qp.cpp:(.text._ZN4CGAL17Quadratic_programIiEC2ENS_4SignEbibi[_ZN4CGAL17Quadratic_programIiEC5ENS_4SignEbibi]+0x190): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
/tmp/ccPeDUda.o: In function `CGAL::Quadratic_program<int>::set_a(int, int, int const&)':
first_qp.cpp:(.text._ZN4CGAL17Quadratic_programIiE5set_aEiiRKi[_ZN4CGAL17Quadratic_programIiE5set_aEiiRKi]+0x41): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
first_qp.cpp:(.text._ZN4CGAL17Quadratic_programIiE5set_aEiiRKi[_ZN4CGAL17Quadratic_programIiE5set_aEiiRKi]+0x70): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
/tmp/ccPeDUda.o: In function `CGAL::Quadratic_program<int>::set_b(int, int const&)':
first_qp.cpp:(.text._ZN4CGAL17Quadratic_programIiE5set_bEiRKi[_ZN4CGAL17Quadratic_programIiE5set_bEiRKi]+0x3e): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
/tmp/ccPeDUda.o:first_qp.cpp:(.text._ZN4CGAL17Quadratic_programIiE5set_uEibRKi[_ZN4CGAL17Quadratic_programIiE5set_uEibRKi]+0x43): more undefined references to `CGAL::assertion_fail(char const*, char const*, int, char const*)' follow
/tmp/ccPeDUda.o: In function `CGAL::QP_solver<CGAL::Quadratic_program<int>, CGAL::Gmpz, CGAL::QP_solver_impl::QP_tags<CGAL::Boolean_tag<false>, CGAL::Boolean_tag<false> > >::set_pricing_strategy(CGAL::Quadratic_program_pricing_strategy)':
first_qp.cpp:(.text._ZN4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE20set_pricing_strategyENS_34Quadratic_program_pricing_strategyE[_ZN4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE20set_pricing_strategyENS_34Quadratic_program_pricing_strategyE]+0xee): undefined reference to `CGAL::default_random'
first_qp.cpp:(.text._ZN4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE20set_pricing_strategyENS_34Quadratic_program_pricing_strategyE[_ZN4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE20set_pricing_strategyENS_34Quadratic_program_pricing_strategyE]+0x140): undefined reference to `CGAL::default_random'
first_qp.cpp:(.text._ZN4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE20set_pricing_strategyENS_34Quadratic_program_pricing_strategyE[_ZN4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE20set_pricing_strategyENS_34Quadratic_program_pricing_strategyE]+0x1d2): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
/tmp/ccPeDUda.o: In function `CGAL::QP_solver<CGAL::Quadratic_program<int>, CGAL::Gmpz, CGAL::QP_solver_impl::QP_tags<CGAL::Boolean_tag<false>, CGAL::Boolean_tag<false> > >::set(CGAL::Quadratic_program<int> const&)':
first_qp.cpp:(.text._ZN4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE3setERKS2_[_ZN4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE3setERKS2_]+0x55): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
first_qp.cpp:(.text._ZN4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE3setERKS2_[_ZN4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE3setERKS2_]+0x90): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
/tmp/ccPeDUda.o: In function `CGAL::QP_solver<CGAL::Quadratic_program<int>, CGAL::Gmpz, CGAL::QP_solver_impl::QP_tags<CGAL::Boolean_tag<false>, CGAL::Boolean_tag<false> > >::init()':
first_qp.cpp:(.text._ZN4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE4initEv[_ZN4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE4initEv]+0x107): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
/tmp/ccPeDUda.o: In function `CGAL::QP_solver<CGAL::Quadratic_program<int>, CGAL::Gmpz, CGAL::QP_solver_impl::QP_tags<CGAL::Boolean_tag<false>, CGAL::Boolean_tag<false> > >::solve()':
first_qp.cpp:(.text._ZN4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE5solveEv[_ZN4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE5solveEv]+0x40): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
/tmp/ccPeDUda.o:first_qp.cpp:(.text._ZNK4CGAL17Quadratic_programIiE5get_rEv[_ZNK4CGAL17Quadratic_programIiE5get_rEv]+0x3f): more undefined references to `CGAL::assertion_fail(char const*, char const*, int, char const*)' follow
/tmp/ccPeDUda.o: In function `CGAL::Quotient<CGAL::Gmpz>::Quotient<CGAL::Gmpz, CGAL::Gmpz>(CGAL::Gmpz const&, CGAL::Gmpz const&)':
first_qp.cpp:(.text._ZN4CGAL8QuotientINS_4GmpzEEC2IS1_S1_EERKT_RKT0_[_ZN4CGAL8QuotientINS_4GmpzEEC5IS1_S1_EERKT_RKT0_]+0x88): undefined reference to `CGAL::precondition_fail(char const*, char const*, int, char const*)'
/tmp/ccPeDUda.o: In function `CGAL::Quadratic_program_solution<CGAL::Gmpz>::infeasibility_certificate_begin() const':
first_qp.cpp:(.text._ZNK4CGAL26Quadratic_program_solutionINS_4GmpzEE31infeasibility_certificate_beginEv[_ZNK4CGAL26Quadratic_program_solutionINS_4GmpzEE31infeasibility_certificate_beginEv]+0x42): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
first_qp.cpp:(.text._ZNK4CGAL26Quadratic_program_solutionINS_4GmpzEE31infeasibility_certificate_beginEv[_ZNK4CGAL26Quadratic_program_solutionINS_4GmpzEE31infeasibility_certificate_beginEv]+0x7b): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
/tmp/ccPeDUda.o: In function `CGAL::Quadratic_program_solution<CGAL::Gmpz>::unboundedness_certificate_begin() const':
first_qp.cpp:(.text._ZNK4CGAL26Quadratic_program_solutionINS_4GmpzEE31unboundedness_certificate_beginEv[_ZNK4CGAL26Quadratic_program_solutionINS_4GmpzEE31unboundedness_certificate_beginEv]+0x42): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
first_qp.cpp:(.text._ZNK4CGAL26Quadratic_program_solutionINS_4GmpzEE31unboundedness_certificate_beginEv[_ZNK4CGAL26Quadratic_program_solutionINS_4GmpzEE31unboundedness_certificate_beginEv]+0x7b): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
/tmp/ccPeDUda.o: In function `CGAL::QP_solver<CGAL::Quadratic_program<int>, CGAL::Gmpz, CGAL::QP_solver_impl::QP_tags<CGAL::Boolean_tag<false>, CGAL::Boolean_tag<false> > >::init_x_O_v_i()':
first_qp.cpp:(.text._ZN4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE12init_x_O_v_iEv[_ZN4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE12init_x_O_v_iEv]+0x1d5): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
/tmp/ccPeDUda.o:first_qp.cpp:(.text._ZN4CGAL16QP_basis_inverseINS_4GmpzENS_11Boolean_tagILb0EEEE3setEiii[_ZN4CGAL16QP_basis_inverseINS_4GmpzENS_11Boolean_tagILb0EEEE3setEiii]+0x43): more undefined references to `CGAL::assertion_fail(char const*, char const*, int, char const*)' follow
/tmp/ccPeDUda.o: In function `CGAL::Map_with_default<std::map<unsigned long, CGAL::Sign, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, CGAL::Sign> > > >::operator()(unsigned long) const':
first_qp.cpp:(.text._ZNK4CGAL16Map_with_defaultISt3mapImNS_4SignESt4lessImESaISt4pairIKmS2_EEEEclEm[_ZNK4CGAL16Map_with_defaultISt3mapImNS_4SignESt4lessImESaISt4pairIKmS2_EEEEclEm]+0x40): undefined reference to `CGAL::precondition_fail(char const*, char const*, int, char const*)'
/tmp/ccPeDUda.o: In function `CGAL::Map_with_default<std::map<unsigned long, int, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, int> > > >::operator()(unsigned long) const':
first_qp.cpp:(.text._ZNK4CGAL16Map_with_defaultISt3mapImiSt4lessImESaISt4pairIKmiEEEEclEm[_ZNK4CGAL16Map_with_defaultISt3mapImiSt4lessImESaISt4pairIKmiEEEEclEm]+0x40): undefined reference to `CGAL::precondition_fail(char const*, char const*, int, char const*)'
/tmp/ccPeDUda.o: In function `CGAL::Map_with_default<std::map<unsigned long, bool, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, bool> > > >::operator()(unsigned long) const':
first_qp.cpp:(.text._ZNK4CGAL16Map_with_defaultISt3mapImbSt4lessImESaISt4pairIKmbEEEEclEm[_ZNK4CGAL16Map_with_defaultISt3mapImbSt4lessImESaISt4pairIKmbEEEEclEm]+0x40): undefined reference to `CGAL::precondition_fail(char const*, char const*, int, char const*)'
/tmp/ccPeDUda.o: In function `CGAL::QP_basis_inverse<CGAL::Gmpz, CGAL::Boolean_tag<false> >::ensure_physical_row(unsigned int)':
first_qp.cpp:(.text._ZN4CGAL16QP_basis_inverseINS_4GmpzENS_11Boolean_tagILb0EEEE19ensure_physical_rowEj[_ZN4CGAL16QP_basis_inverseINS_4GmpzENS_11Boolean_tagILb0EEEE19ensure_physical_rowEj]+0x4f): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
first_qp.cpp:(.text._ZN4CGAL16QP_basis_inverseINS_4GmpzENS_11Boolean_tagILb0EEEE19ensure_physical_rowEj[_ZN4CGAL16QP_basis_inverseINS_4GmpzENS_11Boolean_tagILb0EEEE19ensure_physical_rowEj]+0x102): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
first_qp.cpp:(.text._ZN4CGAL16QP_basis_inverseINS_4GmpzENS_11Boolean_tagILb0EEEE19ensure_physical_rowEj[_ZN4CGAL16QP_basis_inverseINS_4GmpzENS_11Boolean_tagILb0EEEE19ensure_physical_rowEj]+0x198): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
first_qp.cpp:(.text._ZN4CGAL16QP_basis_inverseINS_4GmpzENS_11Boolean_tagILb0EEEE19ensure_physical_rowEj[_ZN4CGAL16QP_basis_inverseINS_4GmpzENS_11Boolean_tagILb0EEEE19ensure_physical_rowEj]+0x239): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
/tmp/ccPeDUda.o: In function `CGAL::QP_solver<CGAL::Quadratic_program<int>, CGAL::Gmpz, CGAL::QP_solver_impl::QP_tags<CGAL::Boolean_tag<false>, CGAL::Boolean_tag<false> > >::original_variable_value_under_bounds(int) const':
first_qp.cpp:(.text._ZNK4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE36original_variable_value_under_boundsEi[_ZNK4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE36original_variable_value_under_boundsEi]+0x6c): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
/tmp/ccPeDUda.o:first_qp.cpp:(.text._ZNK4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE36original_variable_value_under_boundsEi[_ZNK4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE36original_variable_value_under_boundsEi]+0x163): more undefined references to `CGAL::assertion_fail(char const*, char const*, int, char const*)' follow
/tmp/ccPeDUda.o: In function `CGAL::Quotient<CGAL::Gmpz>::operator/=(CGAL::Quotient<CGAL::Gmpz> const&)':
first_qp.cpp:(.text._ZN4CGAL8QuotientINS_4GmpzEEdVERKS2_[_ZN4CGAL8QuotientINS_4GmpzEEdVERKS2_]+0x4d): undefined reference to `CGAL::precondition_fail(char const*, char const*, int, char const*)'
/tmp/ccPeDUda.o: In function `CGAL::QP_solver<CGAL::Quadratic_program<int>, CGAL::Gmpz, CGAL::QP_solver_impl::QP_tags<CGAL::Boolean_tag<false>, CGAL::Boolean_tag<false> > >::replace_variable(CGAL::Boolean_tag<false>)':
first_qp.cpp:(.text._ZN4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE16replace_variableES7_[_ZN4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE16replace_variableES7_]+0x18c): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
/tmp/ccPeDUda.o: In function `CGAL::QP_solver<CGAL::Quadratic_program<int>, CGAL::Gmpz, CGAL::QP_solver_impl::QP_tags<CGAL::Boolean_tag<false>, CGAL::Boolean_tag<false> > >::z_replace_variable_slack_by_original()':
first_qp.cpp:(.text._ZN4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE36z_replace_variable_slack_by_originalEv[_ZN4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE36z_replace_variable_slack_by_originalEv]+0xeb): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
/tmp/ccPeDUda.o: In function `void CGAL::QP_basis_inverse<CGAL::Gmpz, CGAL::Boolean_tag<false> >::enter_original_leave_original<__gnu_cxx::__normal_iterator<CGAL::Gmpz*, std::vector<CGAL::Gmpz, std::allocator<CGAL::Gmpz> > > >(__gnu_cxx::__normal_iterator<CGAL::Gmpz*, std::vector<CGAL::Gmpz, std::allocator<CGAL::Gmpz> > >, unsigned int)':
first_qp.cpp:(.text._ZN4CGAL16QP_basis_inverseINS_4GmpzENS_11Boolean_tagILb0EEEE29enter_original_leave_originalIN9__gnu_cxx17__normal_iteratorIPS1_St6vectorIS1_SaIS1_EEEEEEvT_j[_ZN4CGAL16QP_basis_inverseINS_4GmpzENS_11Boolean_tagILb0EEEE29enter_original_leave_originalIN9__gnu_cxx17__normal_iteratorIPS1_St6vectorIS1_SaIS1_EEEEEEvT_j]+0x6d): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
first_qp.cpp:(.text._ZN4CGAL16QP_basis_inverseINS_4GmpzENS_11Boolean_tagILb0EEEE29enter_original_leave_originalIN9__gnu_cxx17__normal_iteratorIPS1_St6vectorIS1_SaIS1_EEEEEEvT_j[_ZN4CGAL16QP_basis_inverseINS_4GmpzENS_11Boolean_tagILb0EEEE29enter_original_leave_originalIN9__gnu_cxx17__normal_iteratorIPS1_St6vectorIS1_SaIS1_EEEEEEvT_j]+0xa7): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
first_qp.cpp:(.text._ZN4CGAL16QP_basis_inverseINS_4GmpzENS_11Boolean_tagILb0EEEE29enter_original_leave_originalIN9__gnu_cxx17__normal_iteratorIPS1_St6vectorIS1_SaIS1_EEEEEEvT_j[_ZN4CGAL16QP_basis_inverseINS_4GmpzENS_11Boolean_tagILb0EEEE29enter_original_leave_originalIN9__gnu_cxx17__normal_iteratorIPS1_St6vectorIS1_SaIS1_EEEEEEvT_j]+0x49c): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
/tmp/ccPeDUda.o:first_qp.cpp:(.text._ZN4CGAL16QP_basis_inverseINS_4GmpzENS_11Boolean_tagILb0EEEE26enter_original_leave_slackIN9__gnu_cxx17__normal_iteratorIPS1_St6vectorIS1_SaIS1_EEEESC_EEvT_T0_[_ZN4CGAL16QP_basis_inverseINS_4GmpzENS_11Boolean_tagILb0EEEE26enter_original_leave_slackIN9__gnu_cxx17__normal_iteratorIPS1_St6vectorIS1_SaIS1_EEEESC_EEvT_T0_]+0x6e): more undefined references to `CGAL::assertion_fail(char const*, char const*, int, char const*)' follow
/tmp/ccPeDUda.o: In function `CGAL::QP__partial_base<CGAL::Quadratic_program<int>, CGAL::Gmpz, CGAL::QP_solver_impl::QP_tags<CGAL::Boolean_tag<false>, CGAL::Boolean_tag<false> > >::activating(__gnu_cxx::__normal_iterator<int const*, std::vector<int, std::allocator<int> > >&)':
first_qp.cpp:(.text._ZN4CGAL16QP__partial_baseINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE10activatingERN9__gnu_cxx17__normal_iteratorIPKiSt6vectorIiSaIiEEEE[_ZN4CGAL16QP__partial_baseINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE10activatingERN9__gnu_cxx17__normal_iteratorIPKiSt6vectorIiSaIiEEEE]+0xa0): undefined reference to `CGAL::precondition_fail(char const*, char const*, int, char const*)'
/tmp/ccPeDUda.o: In function `CGAL::QP__partial_base<CGAL::Quadratic_program<int>, CGAL::Gmpz, CGAL::QP_solver_impl::QP_tags<CGAL::Boolean_tag<false>, CGAL::Boolean_tag<false> > >::entering_basis(__gnu_cxx::__normal_iterator<int const*, std::vector<int, std::allocator<int> > >)':
first_qp.cpp:(.text._ZN4CGAL16QP__partial_baseINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE14entering_basisEN9__gnu_cxx17__normal_iteratorIPKiSt6vectorIiSaIiEEEE[_ZN4CGAL16QP__partial_baseINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE14entering_basisEN9__gnu_cxx17__normal_iteratorIPKiSt6vectorIiSaIiEEEE]+0xa0): undefined reference to `CGAL::precondition_fail(char const*, char const*, int, char const*)'
/tmp/ccPeDUda.o: In function `CGAL::QP_solver<CGAL::Quadratic_program<int>, CGAL::Gmpz, CGAL::QP_solver_impl::QP_tags<CGAL::Boolean_tag<false>, CGAL::Boolean_tag<false> > >::nonbasic_original_variable_bound_index(int) const':
first_qp.cpp:(.text._ZNK4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE38nonbasic_original_variable_bound_indexEi[_ZNK4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE38nonbasic_original_variable_bound_indexEi]+0x80): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
first_qp.cpp:(.text._ZNK4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE38nonbasic_original_variable_bound_indexEi[_ZNK4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE38nonbasic_original_variable_bound_indexEi]+0xd1): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
/tmp/ccPeDUda.o: In function `CGAL::QP_solver<CGAL::Quadratic_program<int>, CGAL::Gmpz, CGAL::QP_solver_impl::QP_tags<CGAL::Boolean_tag<false>, CGAL::Boolean_tag<false> > >::state_of_zero_nonbasic_variable(int) const':
first_qp.cpp:(.text._ZNK4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE31state_of_zero_nonbasic_variableEi[_ZNK4CGAL9QP_solverINS_17Quadratic_programIiEENS_4GmpzENS_14QP_solver_impl7QP_tagsINS_11Boolean_tagILb0EEES7_EEE31state_of_zero_nonbasic_variableEi]+0xc1): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
You can use cmake to resolve these types of conflicts. ex:
cgal_create_CMakeLists -s executable
cmake .
make
The example mentioned achieved success.
I have installed Armadillo in Ubuntu 14.10. I have an example code likes below
#include <iostream>
#include <armadillo>
using namespace std;
using namespace arma;
int main(int argc, char** argv)
{
mat A = randu<mat>(4,5);
mat B = randu<mat>(4,5);
cout << A*B.t() << endl;
return 0;
}
I compiled in command line, it is always successful, I depict in captured image.
I have eclipse Luna for C++ and config in C/C++ Build Settings
As you can see, it is similar to command line but when eclipse compiles, it use -Iarmadillo instead of -larmadillo and it then occurs errors.
The errors were
make all Building file: ../src/Test.cpp Invoking: GCC C++ Compiler
g++ -std=c++0x -Iarmadillo -O0 -MMD -MP -MF"src/Test.d"
-MT"src/Test.d" -o "src/Test.o" "../src/Test.cpp" /tmp/ccy9M8WG.o: In function void arma::blas::gemv<double>(char const*, int const*, int
const*, double const*, double const*, int const*, double const*, int
const*, double const*, double*, int const*)':
Test.cpp:(.text._ZN4arma4blas4gemvIdEEvPKcPKiS5_PKT_S8_S5_S8_S5_S8_PS6_S5_[_ZN4arma4blas4gemvIdEEvPKcPKiS5_PKT_S8_S5_S8_S5_S8_PS6_S5_]+0x55):
undefined reference towrapper_dgemv_' /tmp/ccy9M8WG.o: In function
void arma::blas::gemm<double>(char const*, char const*, int const*,
int const*, int const*, double const*, double const*, int const*,
double const*, int const*, double const*, double*, int const*)':
Test.cpp:(.text._ZN4arma4blas4gemmIdEEvPKcS3_PKiS5_S5_PKT_S8_S5_S8_S5_S8_PS6_S5_[_ZN4arma4blas4gemmIdEEvPKcS3_PKiS5_S5_PKT_S8_S5_S8_S5_S8_PS6_S5_]+0x5b):
undefined reference towrapper_dgemm_' /tmp/ccy9M8WG.o: In function
void arma::blas::syrk<double>(char const*, char const*, int const*,
int const*, double const*, double const*, int const*, double const*,
double*, int const*)':
Test.cpp:(.text._ZN4arma4blas4syrkIdEEvPKcS3_PKiS5_PKT_S8_S5_S8_PS6_S5_[_ZN4arma4blas4syrkIdEEvPKcS3_PKiS5_PKT_S8_S5_S8_PS6_S5_]+0x4e):
undefined reference towrapper_dsyrk_' /tmp/ccy9M8WG.o: In function
double arma::blas::dot<double>(unsigned int, double const*, double
const*)':
Test.cpp:(.text._ZN4arma4blas3dotIdEET_jPKS2_S4_[_ZN4arma4blas3dotIdEET_jPKS2_S4_]+0x4a):
undefined reference towrapper_ddot_' /tmp/ccy9M8WG.o: In function
TLS wrapper function for arma::arma_rng_cxx11_instance':
Test.cpp:(.text._ZTWN4arma23arma_rng_cxx11_instanceE[_ZTWN4arma23arma_rng_cxx11_instanceE]+0x5):
undefined reference toTLS init function for
arma::arma_rng_cxx11_instance'
Test.cpp:(.text._ZTWN4arma23arma_rng_cxx11_instanceE[_ZTWN4arma23arma_rng_cxx11_instanceE]+0x15):
undefined reference to `arma::arma_rng_cxx11_instance' collect2:
error: ld returned 1 exit status src/subdir.mk:18: recipe for target
'src/Test.o' failed make: *** [src/Test.o] Error 1
My questions are
How can I force eclipse use -larmadillo?
What happened to this phenomenon?
Thank you in advance
You can also create GNU Autotools projects and add following line:
bin_PROGRAMS=armadillo_example
armadillo_example_SOURCES=armadillo_example.cpp
armadillo_example_LDADD=-larmadillo
To Makefile.am file where your source code exist.
You may not be linking with Armadillo. Use -larmadillo in your link as Hamed suggested.
I have these packages installed on my OpenSUSE 11.3:
i | libstdc++45 | Standard shared library for C++ | package
i | libstdc++45-devel | Contains files and libraries for development | package
But when i'm trying to compile this C++ code:
#include <cstdio>
#include <tr1/regex>
using namespace std;
int main() {
int test[2];
const tr1::regex pattern(".*");
test[0] = 1;
if (tr1::regex_match("anything", pattern) == false) {
printf("Pattern does not match.\n");
}
return 0;
}
using
g++ -pedantic -g -O1 -o ./main.o ./main.cpp
It outputs this errors:
/tmp/cc0g3GUE.o: In function `basic_regex':
/usr/include/c++/4.5/tr1_impl/regex:771: undefined reference to `std::tr1::basic_regex<char, std::tr1::regex_traits<char> >::_M_compile()'
/tmp/cc0g3GUE.o: In function `bool std::tr1::regex_match<char const*, char, std::tr1::regex_traits<char> >(char const*, char const*, std::tr1::basic_regex<char, std::tr1::regex_traits<char> > const&, std::bitset<11u>)':
/usr/include/c++/4.5/tr1_impl/regex:2144: undefined reference to `bool std::tr1::regex_match<char const*, std::allocator<std::tr1::sub_match<char const*> >, char, std::tr1::regex_traits<char> >(char const*, char const*, std::tr1::match_results<char const*, std::allocator<std::tr1::sub_match<char const*> > >&, std::tr1::basic_regex<char, std::tr1::regex_traits<char> > const&, std::bitset<11u>)'
collect2: ld returned 1 exit status
What packages should i (un)install to make the code work on my PC?
You need to look at the c++0x library support for gcc as I think Regex is not yet completed
http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.200x