When I try to run make -j from https://drake.mit.edu/python_bindings.html#python-bindings-binary, I get this error:
# make -j
[ 12%] Performing build step for 'drake_cxx_python'
INFO: Analyzed target //:install (1 packages loaded, 3 targets configured).
INFO: Found 1 target...
ERROR: /home/dxy/manipulation/drake/examples/kuka_iiwa_arm/BUILD.bazel:125:16: Linking of rule '//examples/kuka_iiwa_arm:kuka_plan_runner' failed (Exit 1): cc failed: error executing command /usr/bin/cc #bazel-out/k8-opt/bin/examples/kuka_iiwa_arm/kuka_plan_runner-2.params
Use --sandbox_debug to see verbose messages from the sandbox cc failed: error executing command /usr/bin/cc #bazel-out/k8-opt/bin/examples/kuka_iiwa_arm/kuka_plan_runner-2.params
Use --sandbox_debug to see verbose messages from the sandbox
bazel-out/k8-opt/bin/multibody/parsing/_objs/parser/parser.pic.o:parser.cc:function drake::multibody::(anonymous namespace)::DetermineFileType(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): error: undefined reference to 'std::filesystem::__cxx11::path::_M_split_cmpts()'
bazel-out/k8-opt/bin/multibody/parsing/_objs/parser/parser.pic.o:parser.cc:function drake::multibody::(anonymous namespace)::DetermineFileType(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): error: undefined reference to 'std::filesystem::__cxx11::path::_M_find_extension() const'
bazel-out/k8-opt/bin/multibody/parsing/_objs/parser/parser.pic.o:parser.cc:function drake::multibody::(anonymous namespace)::DetermineFileType(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): error: undefined reference to 'std::filesystem::__cxx11::path::_M_split_cmpts()'
bazel-out/k8-opt/bin/multibody/parsing/_objs/detail_misc/detail_path_utils.pic.o:detail_path_utils.cc:function std::filesystem::__cxx11::path::operator=(std::filesystem::__cxx11::path&&) [clone .part.222]: error: undefined reference to 'std::filesystem::__cxx11::path::_M_split_cmpts()'
bazel-out/k8-opt/bin/multibody/parsing/_objs/detail_misc/detail_path_utils.pic.o:detail_path_utils.cc:function std::filesystem::__cxx11::path::path<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::filesystem::__cxx11::path>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::filesystem::__cxx11::path::format): error: undefined reference to 'std::filesystem::__cxx11::path::_M_split_cmpts()'
bazel-out/k8-opt/bin/multibody/parsing/_objs/detail_misc/detail_path_utils.pic.o:detail_path_utils.cc:function std::filesystem::__cxx11::path::operator/=(std::filesystem::__cxx11::path const&): error: undefined reference to 'std::filesystem::__cxx11::path::has_root_directory() const'
bazel-out/k8-opt/bin/multibody/parsing/_objs/detail_misc/detail_path_utils.pic.o:detail_path_utils.cc:function std::filesystem::__cxx11::path::operator/=(std::filesystem::__cxx11::path const&): error: undefined reference to 'std::filesystem::__cxx11::path::has_filename() const'
bazel-out/k8-opt/bin/multibody/parsing/_objs/detail_misc/detail_path_utils.pic.o:detail_path_utils.cc:function drake::multibody::internal::GetFullPath(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): error: undefined reference to 'std::filesystem::current_path[abi:cxx11]()'
bazel-out/k8-opt/bin/multibody/parsing/_objs/detail_misc/detail_path_utils.pic.o:detail_path_utils.cc:function drake::multibody::internal::GetFullPath(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): error: undefined reference to 'std::filesystem::__cxx11::path::lexically_normal() const'
bazel-out/k8-opt/bin/multibody/parsing/_objs/detail_misc/detail_path_utils.pic.o:detail_path_utils.cc:function drake::multibody::internal::GetFullPath(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): error: undefined reference to 'std::filesystem::status(std::filesystem::__cxx11::path const&)'
bazel-out/k8-opt/bin/multibody/parsing/_objs/detail_misc/detail_path_utils.pic.o:detail_path_utils.cc:function drake::multibody::internal::GetFullPath(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): error: undefined reference to 'std::filesystem::status(std::filesystem::__cxx11::path const&)'
bazel-out/k8-opt/bin/multibody/parsing/_objs/detail_misc/detail_path_utils.pic.o:detail_path_utils.cc:function drake::multibody::internal::ResolveUri(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, drake::multibody::PackageMap const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): error: undefined reference to 'std::filesystem::__cxx11::path::lexically_normal() const'
bazel-out/k8-opt/bin/multibody/parsing/_objs/detail_misc/detail_path_utils.pic.o:detail_path_utils.cc:function drake::multibody::internal::ResolveUri(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, drake::multibody::PackageMap const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): error: undefined reference to 'std::filesystem::status(std::filesystem::__cxx11::path const&)'
bazel-out/k8-opt/bin/multibody/parsing/_objs/detail_misc/detail_path_utils.pic.o:detail_path_utils.cc:function drake::multibody::internal::ResolveUri(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, drake::multibody::PackageMap const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): error: undefined reference to 'std::filesystem::__cxx11::path::has_root_directory() const'
bazel-out/k8-opt/bin/multibody/parsing/_objs/detail_misc/detail_path_utils.pic.o:detail_path_utils.cc:function drake::multibody::internal::ResolveUri(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, drake::multibody::PackageMap const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): error: undefined reference to 'std::filesystem::current_path[abi:cxx11]()'
bazel-out/k8-opt/bin/multibody/parsing/_objs/package_map/package_map.pic.o:package_map.cc:function drake::multibody::PackageMap::Add(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): error: undefined reference to 'std::filesystem::status(std::filesystem::__cxx11::path const&)'
bazel-out/k8-opt/bin/multibody/parsing/_objs/package_map/package_map.pic.o:package_map.cc:function drake::multibody::(anonymous namespace)::GetParentDirectory(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): error: undefined reference to 'std::filesystem::__cxx11::path::parent_path() const'
bazel-out/k8-opt/bin/multibody/parsing/_objs/package_map/package_map.pic.o:package_map.cc:function drake::multibody::PackageMap::PopulateUpstreamToDrakeHelper(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) [clone .localalias.363]: error: undefined reference to 'std::filesystem::__cxx11::path::has_root_directory() const'
bazel-out/k8-opt/bin/multibody/parsing/_objs/package_map/package_map.pic.o:package_map.cc:function drake::multibody::PackageMap::PopulateUpstreamToDrakeHelper(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) [clone .localalias.363]: error: undefined reference to 'std::filesystem::__cxx11::path::has_filename() const'
bazel-out/k8-opt/bin/multibody/parsing/_objs/package_map/package_map.pic.o:package_map.cc:function drake::multibody::PackageMap::PopulateUpstreamToDrake(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): error: undefined reference to 'std::filesystem::__cxx11::path::_M_find_extension() const'
bazel-out/k8-opt/bin/multibody/parsing/_objs/package_map/package_map.pic.o:package_map.cc:function drake::multibody::PackageMap::PopulateUpstreamToDrake(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): error: undefined reference to 'std::filesystem::__cxx11::path::parent_path() const'
bazel-out/k8-opt/bin/common/_objs/drake_path/drake_path.pic.o:drake_path.cc:function drake::MaybeGetDrakePath[abi:cxx11](): error: undefined reference to 'std::filesystem::__cxx11::path::parent_path() const'
bazel-out/k8-opt/bin/common/_objs/find_resource/find_loaded_library.pic.o:find_loaded_library.cc:function drake::LoadedLibraryPath(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): error: undefined reference to 'std::filesystem::read_symlink(std::filesystem::__cxx11::path const&)'
bazel-out/k8-opt/bin/common/_objs/find_runfiles/find_runfiles.pic.o:find_runfiles.cc:function drake::(anonymous namespace)::Create(): error: undefined reference to 'std::filesystem::__cxx11::path::lexically_normal() const'
bazel-out/k8-opt/bin/common/_objs/find_runfiles/find_runfiles.pic.o:find_runfiles.cc:function drake::(anonymous namespace)::Create(): error: undefined reference to 'std::filesystem::read_symlink(std::filesystem::__cxx11::path const&)'
collect2: error: ld returned 1 exit status
Target //:install failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 801.493s, Critical Path: 69.97s
INFO: 1333 processes: 20 internal, 1306 linux-sandbox, 7 worker.
FAILED: Build did NOT complete successfully
CMakeFiles/drake_cxx_python.dir/build.make:110: recipe for target 'drake_cxx_python-prefix/src/drake_cxx_python-stamp/drake_cxx_python-build' failed
make[2]: *** [drake_cxx_python-prefix/src/drake_cxx_python-stamp/drake_cxx_python-build] Error 1
CMakeFiles/Makefile2:931: recipe for target 'CMakeFiles/drake_cxx_python.dir/all' failed
make[1]: *** [CMakeFiles/drake_cxx_python.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2
Any suggestions for how to debug would be appreciated. Here is the system information -
Operating system Ubuntu 18.04
Language Python bindings building
C++ compiler GCC 8.4.0
Python version Python 3.6.9
Python distribution pyenv
If building from source:
Build system (Bazel, CMake)
Bazel version:
# which bazel; bazel version
/usr/local/bin/bazel
Bazelisk version: v1.4.0
Build label: 3.7.0
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Oct 20 13:29:16 2020 (1603200556)
Build timestamp: 1603200556
Build timestamp as int: 1603200556
Bazel C++ compiler:
# bazel run #drake//common:print_host_settings
Starting local Bazel server and connecting to it...
WARNING: ignoring LD_PRELOAD in environment.
INFO: Analyzed target //common:print_host_settings (22 packages loaded, 91 targets configured).
INFO: Found 1 target...
Target //tools/cc_toolchain:print_host_settings up-to-date:
bazel-bin/tools/cc_toolchain/print_host_settings
INFO: Elapsed time: 3.664s, Critical Path: 0.05s
INFO: 5 processes: 4 internal, 1 linux-sandbox.
INFO: Build completed successfully, 5 total actions
INFO: Running command line: bazel-bin/tools/cc_toolchain/print_host_settings tooINFO: Build completed successfully, 5 total actions
++ uname -s
+ [[ Linux == Darwin ]]
+ capture_cc_env=tools/cc_toolchain/capture_cc.env
+ source tools/cc_toolchain/capture_cc.env
++ BAZEL_CC=/usr/bin/gcc
++ BAZEL_CC_FLAGS=
+ [[ ! -z /usr/bin/gcc ]]
++ python3 -c 'import os; print(os.path.realpath("/usr/bin/gcc"))'
+ BAZEL_CC=/usr/bin/x86_64-linux-gnu-gcc-8
+ /usr/bin/x86_64-linux-gnu-gcc-8 --version
x86_64-linux-gnu-gcc-8 (Ubuntu 8.4.0-1ubuntu1~18.04) 8.4.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
CMake version:
# which cmake; cmake --version
/usr/bin/cmake
cmake version 3.10.2
CMake C++ compiler
# cmake -LA ./ | grep 'CMAKE_.*_COMPILER'
-- The C compiler identification is GNU 8.4.0
-- The CXX compiler identification is GNU 8.4.0
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Bazel: /usr/local/bin/bazel (found suitable version "3.7.0", minimum required is "2.0")
-- Found PythonInterp: /usr/bin/python3 (found suitable exact version "3.6.9")
-- Found Git: /usr/bin/git (found version "2.17.1")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dxy/manipulation/tmp/drake
-- Cache values
BUILD_TESTING:BOOL=ON
BZRCOMMAND:FILEPATH=BZRCOMMAND-NOTFOUND
Bazel_EXECUTABLE:FILEPATH=/usr/local/bin/bazel
CMAKE_AR:FILEPATH=/usr/bin/ar
CMAKE_BUILD_TYPE:STRING=Release
CMAKE_COLOR_MAKEFILE:BOOL=ON
CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++
CMAKE_CXX_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-8
CMAKE_CXX_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-8
CMAKE_CXX_FLAGS:STRING=
CMAKE_CXX_FLAGS_DEBUG:STRING=-g
CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
CMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc
CMAKE_C_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-8
CMAKE_C_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-8
CMAKE_C_FLAGS:STRING=
CMAKE_C_FLAGS_DEBUG:STRING=-g
CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
CMAKE_EXE_LINKER_FLAGS:STRING=
CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING=
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING=
CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING=
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=OFF
CMAKE_INSTALL_PREFIX:STRING=/home/dxy/manipulation/tmp/drake/install
CMAKE_LINKER:FILEPATH=/usr/bin/ld
CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/make
CMAKE_MODULE_LINKER_FLAGS:STRING=
CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING=
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING=
CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING=
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
CMAKE_NM:FILEPATH=/usr/bin/nm
CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy
CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump
CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib
CMAKE_SHARED_LINKER_FLAGS:STRING=
CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING=
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING=
CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING=
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING=
CMAKE_SKIP_INSTALL_RPATH:BOOL=NO
CMAKE_SKIP_RPATH:BOOL=NO
CMAKE_STATIC_LINKER_FLAGS:STRING=
CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING=
CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING=
CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING=
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING=
CMAKE_STRIP:FILEPATH=/usr/bin/strip
CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE
COVERAGE_COMMAND:FILEPATH=/usr/bin/gcov
COVERAGE_EXTRA_FLAGS:STRING=-l
CPACK_SOURCE_RPM:BOOL=OFF
CPACK_SOURCE_TBZ2:BOOL=ON
CPACK_SOURCE_TGZ:BOOL=ON
CPACK_SOURCE_TXZ:BOOL=ON
CPACK_SOURCE_TZ:BOOL=ON
CPACK_SOURCE_ZIP:BOOL=OFF
CTEST_SUBMIT_RETRY_COUNT:STRING=3
CTEST_SUBMIT_RETRY_DELAY:STRING=5
CVSCOMMAND:FILEPATH=CVSCOMMAND-NOTFOUND
CVS_UPDATE_OPTIONS:STRING=-d -A -P
DART_TESTING_TIMEOUT:STRING=1500
GITCOMMAND:FILEPATH=/usr/bin/git
GIT_EXECUTABLE:FILEPATH=/usr/bin/git
HGCOMMAND:FILEPATH=HGCOMMAND-NOTFOUND
LSB_RELEASE_EXECUTABLE:FILEPATH=/usr/bin/lsb_release
MAKECOMMAND:STRING=/usr/bin/cmake --build . --config "${CTEST_CONFIGURATION_TYPE}"
MEMORYCHECK_COMMAND:FILEPATH=/usr/bin/valgrind
MEMORYCHECK_SUPPRESSIONS_FILE:FILEPATH=
P4COMMAND:FILEPATH=P4COMMAND-NOTFOUND
PYTHON_EXECUTABLE:FILEPATH=/usr/bin/python3
SCPCOMMAND:FILEPATH=/usr/bin/scp
SITE:STRING=dxy-ubuntu
SLURM_SBATCH_COMMAND:FILEPATH=SLURM_SBATCH_COMMAND-NOTFOUND
SLURM_SRUN_COMMAND:FILEPATH=SLURM_SRUN_COMMAND-NOTFOUND
SVNCOMMAND:FILEPATH=SVNCOMMAND-NOTFOUND
WITH_GUROBI:BOOL=OFF
WITH_MOSEK:BOOL=OFF
WITH_ROBOTLOCOMOTION_SNOPT:BOOL=OFF
WITH_SNOPT:BOOL=OFF
Git revision 53d57507e
Looking at https://drake.mit.edu/developers.html#supported-configurations, GCC 7.5 is the supported version for Ubuntu 18.04.
Seeing /usr/bin/gcc show up as "GCC 8.4.0" in the bug report above is unusual. On my system, I have:
$ file /usr/bin/gcc
/usr/bin/gcc: symbolic link to gcc-7
$ gcc --version
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Per https://github.com/RobotLocomotion/drake/blob/e4209905da25dd54b5e45daf0dc19d3cdad31250/common/filesystem.h#L13 it looks like Drake uses <filesystem> if available, so perhaps GCC 8 is providing that header, but not in a way that Drake is able to correctly link to.
Are you able to use GCC 7.5, instead? That should work fine.
Related
I'm trying to link together:
libFuzzer.a, compiled with clang++-5.0 and -std=c++11
my fuzz driver, compiled with clang++-5.0 and -std=c++11 -stdlib=libc++
libcurl, compiled with clang-5.0
Specifically, this linker command is being executed:
/bin/bash ../../libtool --silent --tag=CXX --mode=link clang++-5.0 -I../../include -I../../lib -I../../lib -I../../tests/fuzz -fsanitize=address -fsanitize-address-use-after-scope -fsanitize-coverage=trace-pc-guard,trace-cmp -std=c++11 -stdlib=libc++ -o curl_fuzzer curl_fuzzer-curl_fuzzer.o ../../lib/libcurl.la /root/checkouts/Fuzzer/libFuzzer.a -lssh2 -lssl -lcrypto -lssl -lcrypto -lz -lpthread -lm
Executing this command outputs the following:
/bin/bash ../../libtool --silent --tag=CXX --mode=link clang++-5.0 -I../../include -I../../lib -I../../lib -I../../tests/fuzz -fsanitize=address -fsanitize-address-use-after-scope -fsanitize-coverage=trace-pc-guard,trace-cmp -std=c++11 -stdlib=libc++ -o curl_fuzzer curl_fuzzer-curl_fuzzer.o ../../lib/libcurl.la /root/checkouts/Fuzzer/libFuzzer.a -lssh2 -lssl -lcrypto -lssl -lcrypto -lz -lpthread -lm > /tmp/cat.txt 2>&1; head -20 /tmp/cat.txt
/root/checkouts/Fuzzer/libFuzzer.a(FuzzerIO.o): In function `fuzzer::FileToVector(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, bool)':
/root/checkouts/Fuzzer/./FuzzerIO.cpp:34: undefined reference to `std::basic_ifstream<char, std::char_traits<char> >::basic_ifstream(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::_Ios_Openmode)'
/root/checkouts/Fuzzer/./FuzzerIO.cpp:40: undefined reference to `std::istream::seekg(long, std::_Ios_Seekdir)'
/root/checkouts/Fuzzer/./FuzzerIO.cpp:41: undefined reference to `std::istream::tellg()'
/root/checkouts/Fuzzer/./FuzzerIO.cpp:47: undefined reference to `std::istream::seekg(long, std::_Ios_Seekdir)'
/root/checkouts/Fuzzer/./FuzzerIO.cpp:49: undefined reference to `std::istream::read(char*, long)'
/root/checkouts/Fuzzer/libFuzzer.a(FuzzerIO.o): In function `~basic_ifstream':
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/fstream:534: undefined reference to `VTT for std::basic_ifstream<char, std::char_traits<char> >'
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/fstream:534: undefined reference to `std::basic_ifstream<char, std::char_traits<char> >::~basic_ifstream()'
/root/checkouts/Fuzzer/libFuzzer.a(FuzzerIO.o): In function `~basic_ios':
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/basic_ios.h:282: undefined reference to `std::ios_base::~ios_base()'
/root/checkouts/Fuzzer/libFuzzer.a(FuzzerIO.o): In function `~basic_ifstream':
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/fstream:534: undefined reference to `VTT for std::basic_ifstream<char, std::char_traits<char> >'
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/fstream:534: undefined reference to `std::basic_ifstream<char, std::char_traits<char> >::~basic_ifstream()'
/root/checkouts/Fuzzer/libFuzzer.a(FuzzerIO.o): In function `~basic_ios':
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/basic_ios.h:282: undefined reference to `std::ios_base::~ios_base()'
/root/checkouts/Fuzzer/libFuzzer.a(FuzzerIO.o): In function `fuzzer::FileToString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/root/checkouts/Fuzzer/./FuzzerIO.cpp:54: undefined reference to `std::basic_ifstream<char, std::char_traits<char> >::basic_ifstream(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::_Ios_Openmode)'
/root/checkouts/Fuzzer/libFuzzer.a(FuzzerIO.o): In function `~basic_ifstream':
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/fstream:534: undefined reference to `VTT for std::basic_ifstream<char, std::char_traits<char> >'
<snip>
I've tried doing the following to fix this:
Adding -lc++ - doesn't do anything
Adding -lc++abi - doesn't do anything
It feels like I'm missing something obvious but I'm not sure what...
My installation of clang-5.0 comes from clang-5.0/kali-rolling.
You have compiled part of your code with libstdc++ and part with libc++. When you link them together (using libc++), the parts that have references to libstdc++ don't get resolved.
For example, std::__cxx11::basic_string is definitely a libstdc++ symbol.
Looks like for whatever reason kali's version of clang-5.0 doesn't link binaries with libc++ properly. I tested the same code with google's ossfuzz version of clang (clang-6.0) and everything linked together successfully.
The OP mentioned (2017):
Looks like for whatever reason kali's version of clang-5.0 doesn't link binaries with libc++ properly.
I tested the same code with google's ossfuzz version of clang (clang-6.0) and everything linked together successfully.
At the time, libstdc++ was needed.
But now, from the current LibFuzzer documentation (March 2021)
Recent versions of Clang (starting from 6.0) include libFuzzer, and no extra installation is necessary.
As an illustration of that new ("new" meaning "post CLang 5") usage, Git 2.31.1 (Q1 2021), references the same LibFuzzer 11.0 documentation section:
See commit 68b5c3a (08 Mar 2021) by Andrzej Hunt (ahunt).
(Merged by Junio C Hamano -- gitster -- in commit af10702, 19 Mar 2021)
Makefile: update 'make fuzz-all' docs to reflect modern clang
Signed-off-by: Andrzej Hunt
Clang no longer produces a libFuzzer.a.
Instead, you can include libFuzzer by using -fsanitize=fuzzer.
Therefore we should use that in the example command for building fuzzers.
We also add -fsanitize=fuzzer-no-link to the CFLAGS to ensure that all the required instrumentation is added when compiling git 1, and remove -fsanitize-coverage=trace-pc-guard as it is deprecated.
I happen to have tested with LLVM 11 - however -fsanitize=fuzzer appears to work in a wide range of reasonably modern clangs.
(On my system: what used to be libFuzzer.a now lives under the following path, which is tricky albeit not impossible for a novice such as myself to find:
/usr/lib64/clang/11.0.0/lib/linux/libclang_rt.fuzzer-x86_64.a )
I am trying to compile the software OpenPose on an Ubuntu 14 machine. The installation script installs Caffe. While installing Caffe, I get the following error message:
CXX tools/upgrade_net_proto_text.cpp
CXX/LD -o .build_release/tools/upgrade_net_proto_text.bin
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > const&)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imdecode(cv::_InputArray const&, int)'
collect2: error: ld returned 1 exit status
make: *** [.build_release/tools/upgrade_net_proto_text.bin] Error 1
From here, I have tried running ldconfig, I use OpenCV 3.2.0, so I have uncommented that in the makefile. I have also tried updating the OpenCV path in ~/.bashrc but I am not sure if I did it correctly. I did:
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
After each of these steps, I ran the install script again but it fails with the same error message (shown above) every time.
I haven't seen anyone so far who successfully installed caffe with openCV 3.2.0,i faced the same problem and what i did was to downgrade to OpenCV 3.1.Another problem that came along was missing modules that are in open_contrib that you should install along opencv,i d refer you to this answer also related to OpenPose here
I have linked to all the appropriate libraries and headers in my Xcode project (where I have the samples files from OpenCV for scene_reconstruction), after building and installing OpenCV with the contrib module.
I have also applied the #define CERES_FOUND true fix that is recommended here:
https://github.com/Itseez/opencv_contrib/issues/476
The editor prompts me with the correct functions completions from the sfm module and the reconstruct.hpp file (except that the prompts I get have the last boolean is_projective flag missing from all reconstruct()'s i.e.:
one of the prompts is:
reconstruct(<#const std::vector<std::string> images#>, <#OutputArray Rs#>, <#OutputArray Ts#>, <#InputOutputArray K#>, <#OutputArray points3d#>)
I however get:
Undefined symbols for architecture x86_64:
"cv::sfm::reconstruct(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >, cv::_OutputArray const&, cv::_OutputArray const&, cv::_InputOutputArray const&, cv::_OutputArray const&, bool)", referenced from:
_main in scene_reconstruction.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
when I build the project.
I did a camera calibration in the same project and it ran fine, and everything else is alright, I have been using OpenCV built from source for years now, so I've taken care of the basics.
How do I proceed to fix/probe the issue further?
It was an issue with CERES_FOUND not being set because of a version mismatch between eigen and ceres.
I'm new to opencv in ubuntu. I've follow the tutorial from here for setting up the opencv in linux. However, I have failed to make the sample program runs. After I type the following,
$ g++ DisplayImage.cpp
These error appears,
/tmp/cc3GTOtQ.o: In function `main':
DisplayImage.cpp:(.text+0x53): undefined reference to `cv::imread(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
DisplayImage.cpp:(.text+0xe5): undefined reference to `cv::namedWindow(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
DisplayImage.cpp:(.text+0x113): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
DisplayImage.cpp:(.text+0x147): undefined reference to `cv::imshow(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::_InputArray const&)'
DisplayImage.cpp:(.text+0x169): undefined reference to `cv::waitKey(int)'
/tmp/cc3GTOtQ.o: In function `cv::Mat::~Mat()':
DisplayImage.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x39): undefined reference to `cv::fastFree(void*)'
/tmp/cc3GTOtQ.o: In function `cv::Mat::operator=(cv::Mat const&)':
DisplayImage.cpp:(.text._ZN2cv3MataSERKS0_[cv::Mat::operator=(cv::Mat const&)]+0x111): undefined reference to `cv::Mat::copySize(cv::Mat const&)'
/tmp/cc3GTOtQ.o: In function `cv::Mat::release()':
DisplayImage.cpp:(.text._ZN2cv3Mat7releaseEv[cv::Mat::release()]+0x47): undefined reference to `cv::Mat::deallocate()'
collect2: ld returned 1 exit status
Here is the full command line build C++ program with OpenCV Libraries.
g++ -I/usr/local/include/opencv -I/usr/local/include/opencv2 -L/usr/local/lib/ -g -o binaryName main.cpp -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy
If you installed OpenCV in different location, you should change the path of 'include' and lib 'directory' to appropriate location.
Edit:-
Instead of running this command every time just create a file build.sh in your project directory, change it's permission to executable by running chmod 777 build.sh and for building the project just run this file.
You need to link with the opencv libraries: probably you'll need to add at least -lcv and maybe -lcxcore and -lhighgui to your command line. See this similar question.
I have tried asking this question on ROS answers with no luck so I am going to try here.
I am trying to compile the ROS Roboearth package and there seem to be some linking errors with vision_opencv.
When I first tried compiling via the instructions provided I was not able to do build because I had old compiler and I did not have Fuerte. So, I upgraded my Ubuntu to 12.04 and updated to ROS Fuerte.
I then realized that 12.04 does not have the required ros-fuerte-vision-opencv2 dependency. So, I compiled and built OpenCV 2.4.3 from source, that went great. I then realized that I am also not able to pull ros-fuerte-vision-opencv which I again got from here, checked out the "fuerte" branch and compiled in /opt/ros/fuerte/stacks/vision_opencv.
Now, when I try to make roboearth via
rosmake roboearth
I get the following linking errors.
Thank you for your help. It may be just my lack of knowledge of C++ but I tried everything from checking dependencies to re-setting the order of compiler flags and dependencies and I just can't seem to get this to work.
[rosmake-1] Starting >>> ar_pose [ make ]
[ rosmake ] Last 40 lines_vision: 30.7 sec ] [ ar_pose: 4.2 sec ] [ 2 Active 47/103 Complete ]
{-------------------------------------------------------------------------------
make[3]: Leaving directory `/home/sasha/ros/stacks/ccny_vision/ar_pose/build'
[ 70%] Built target rosbuild_precompile
make[3]: Entering directory `/home/sasha/ros/stacks/ccny_vision/ar_pose/build'
make[3]: Leaving directory `/home/sasha/ros/stacks/ccny_vision/ar_pose/build'
make[3]: Entering directory `/home/sasha/ros/stacks/ccny_vision/ar_pose/build'
Linking CXX executable ../bin/ar_multi
CMakeFiles/ar_multi.dir/src/ar_multi.o: In function `ar_pose::ARSinglePublisher::arInit()':
/home/sasha/ros/stacks/ccny_vision/ar_pose/src/ar_multi.cpp:140: undefined reference to `cvCreateImage'
CMakeFiles/ar_multi.dir/src/ar_multi.o: In function `CvBridge':
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:67: undefined reference to `cvCreateImageHeader'
CMakeFiles/ar_multi.dir/src/ar_multi.o: In function `~CvBridge':
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:73: undefined reference to `cvReleaseImageHeader'
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:78: undefined reference to `cvReleaseImage'
CMakeFiles/ar_multi.dir/src/ar_multi.o: In function `sensor_msgs::CvBridge::reallocIfNeeded_(_IplImage**, CvSize, int, int)':
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:91: undefined reference to `cvReleaseImage'
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:97: undefined reference to `cvCreateImage'
CMakeFiles/ar_multi.dir/src/ar_multi.o: In function `sensor_msgs::CvBridge::reallocIfNeeded(_IplImage**, int, int)':
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:109: undefined reference to `cvGetSize'
CMakeFiles/ar_multi.dir/src/ar_multi.o: In function `sensor_msgs::CvBridge::fromImage(sensor_msgs::Image_<std::allocator<void> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:199: undefined reference to `cvInitMatHeader'
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:200: undefined reference to `cvGetImage'
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:229: undefined reference to `cvCreateMat'
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:230: undefined reference to `cvConvertScale'
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:236: undefined reference to `cvConvertScale'
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:243: undefined reference to `cvCvtColor'
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:245: undefined reference to `cvCvtColor'
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:247: undefined reference to `cvCvtColor'
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:249: undefined reference to `cvCvtColor'
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:253: undefined reference to `cvCvtColor'
CMakeFiles/ar_multi.dir/src/ar_multi.o:/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:255: more undefined references to `cvCvtColor' follow
CMakeFiles/ar_multi.dir/src/ar_multi.o: In function `sensor_msgs::CvBridge::fromImage(sensor_msgs::Image_<std::allocator<void> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:293: undefined reference to `cvReleaseMat'
collect2: ld returned 1 exit status
make[3]: *** [../bin/ar_multi] Error 1
make[3]: Leaving directory `/home/sasha/ros/stacks/ccny_vision/ar_pose/build'
make[2]: *** [CMakeFiles/ar_multi.dir/all] Error 2
make[2]: Leaving directory `/home/sasha/ros/stacks/ccny_vision/ar_pose/build'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/sasha/ros/stacks/ccny_vision/ar_pose/build'
-------------------------------------------------------------------------------}
[ rosmake ] Output from build of package ar_pose written to:
[ rosmake ] /home/sasha/.ros/rosmake/rosmake_output-20130212-145046/ar_pose/build_output.log
[rosmake-1] Finished <<< ar_pose [FAIL] [ 4.31 seconds ]
[ rosmake ] Halting due to failure in package ar_pose.
[ rosmake ] Waiting for other threads to complete.
[ rosmake ] Last 40 lines_vision: 182.3 sec ] [ 1 Active 47/103 Complete ]
{-------------------------------------------------------------------------------
../lib/libObjectDetectorFunctions.so: undefined reference to `cvReleaseMat'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::Mat::reshape(int, int, int const*) const'
../lib/libObjectDetectorFunctions.so: undefined reference to `cvSetZero'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::warpPerspective(cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&, cv::Size_<int>, int, int, cv::Scalar_<double> const&)'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::getTextSize(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, double, int, int*)'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::Mat::zeros(int, int, int)'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::_InputArray::_InputArray(cv::MatExpr const&)'
../lib/libDVision.so: undefined reference to `cv::read(cv::FileNode const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&)'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::DescriptorMatcher::DescriptorCollection::~DescriptorCollection()'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::FlannBasedMatcher::train()'
../lib/libObjectDetectorFunctions.so: undefined reference to `cvCvtColor'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::MatConstIterator::seek(int const*, bool)'
../lib/libDVision.so: undefined reference to `cv::FeatureDetector::~FeatureDetector()'
../lib/libDUtilsCV.so: undefined reference to `cv::line(cv::Mat&, cv::Point_<int>, cv::Point_<int>, cv::Scalar_<double> const&, int, int, int)'
../lib/libDVision.so: undefined reference to `cv::Exception::Exception(int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::initUndistortRectifyMap(cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::Size_<int>, int, cv::_OutputArray const&, cv::_OutputArray const&)'
../lib/libDVision.so: undefined reference to `cv::WriteStructContext::~WriteStructContext()'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::Mat::copySize(cv::Mat const&)'
../lib/libObjectDetectorFunctions.so: undefined reference to `cvCreateImageHeader'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::Mat::inv(int) const'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::Mat::copyTo(cv::_OutputArray const&) const'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::Mat::Mat(cv::Mat const&, cv::Range const&, cv::Range const&)'
../lib/libDVision.so: undefined reference to `cv::operator<<(cv::FileStorage&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::flann::IndexParams::~IndexParams()'
../lib/libObjectDetectorFunctions.so: undefined reference to `cvGetSize'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::Mat::deallocate()'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::_InputArray::_InputArray(double const&)'
../lib/libObjectDetectorFunctions.so: undefined reference to `cvCreateImage'
../lib/libDUtilsCV.so: undefined reference to `cv::namedWindow(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::Algorithm::~Algorithm()'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::FlannBasedMatcher::FlannBasedMatcher(cv::Ptr<cv::flann::IndexParams> const&, cv::Ptr<cv::flann::SearchParams> const&)'
../lib/libDVision.so: undefined reference to `cv::Algorithm::set(char const*, bool)'
collect2: ld returned 1 exit status
make[3]: *** [../bin/ObjectDetector] Error 1
make[3]: Leaving directory `/home/sasha/ros/stacks/roboearth/re_vision/build'
make[2]: *** [CMakeFiles/ObjectDetector.dir/all] Error 2
make[2]: Leaving directory `/home/sasha/ros/stacks/roboearth/re_vision/build'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/sasha/ros/stacks/roboearth/re_vision/build'
-------------------------------------------------------------------------------}
[ rosmake ] Output from build of package re_vision written to:
[ rosmake ] /home/sasha/.ros/rosmake/rosmake_output-20130212-145046/re_vision/build_output.log
[rosmake-0] Finished <<< re_vision [FAIL] [ 182.31 seconds ]
[ rosmake ] Halting due to failure in package re_vision.
Ok so I was able to solve the problem.
First I did sudo apt-get update and I saw that I was getting the following message:
W: Duplicate sources.list entry http://archive.canonical.com/ubuntu/ precise/partner i386 Packages (/var/lib/apt/lists/archive.canonical.com_ubuntu_dists_precise_partner_binary-i386_Packages)
To resolve this I went to `Synaptic Package Manager-> Settings -> Repositories -> Other Software' and unchecked "Canonical Partners - Added by software center".
Then did sudo apt-get update again. This solved the above problem.
Then, I went to the following file /etc/apt/sources.list.d/ros-latest.list and saw that the url was commented out. I uncommented the following line deb http://packages.ros.org/ros/ubuntu precise main and ran sudo apt-get update again.
After this point I was able to install all of the dependencies which are needed for roboearth and via apt-get and was able to successfully make roboearth with rosmake roboearth