cryfs icon indicating copy to clipboard operation
cryfs copied to clipboard

Does not build with LLVM/clang and LTO

Open tpgxyz opened this issue 6 years ago • 4 comments

Expected Behavior

Compile with succes and program runs without segfaults

Actual Behavior

Does not to compile with LLVM/clang and LTO More logs available here: https://abf.openmandriva.org/build_lists/27478

FAILED: src/cryfs-cli/libcryfs-cli.so 
: && /usr/bin/clang++ -fPIC -Os -fomit-frame-pointer -gdwarf-4 -Wstrict-aliasing=2 -pipe -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4  -m64 -mtune=generic -flto -O3 -fPIC -Os -fomit-frame-pointer -gdwarf-4 -Wstrict-aliasing=2 -pipe -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4  -m64 -mtune=generic -flto -O3 -fPIC  -Os -fomit-frame-pointer -gdwarf-4 -Wstrict-aliasing=2 -pipe -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4  -m64 -mtune=generic -flto -O3 -fPIC -Wl,-O2  -Wl,--no-undefined -shared -Wl,-soname,libcryfs-cli.so -o src/cryfs-cli/libcryfs-cli.so src/cryfs-cli/CMakeFiles/cryfs-cli.dir/Cli.cpp.o src/cryfs-cli/CMakeFiles/cryfs-cli.dir/VersionChecker.cpp.o src/cryfs-cli/CMakeFiles/cryfs-cli.dir/CallAfterTimeout.cpp.o src/cryfs-cli/CMakeFiles/cryfs-cli.dir/Environment.cpp.o src/cryfs-cli/CMakeFiles/cryfs-cli.dir/program_options/utils.cpp.o src/cryfs-cli/CMakeFiles/cryfs-cli.dir/program_options/ProgramOptions.cpp.o src/cryfs-cli/CMakeFiles/cryfs-cli.dir/program_options/Parser.cpp.o  src/cryfs/libcryfs.a src/cpp-utils/libcpp-utils.a src/gitversion/libgitversion.a src/fspp/fuse/libfspp-fuse.a src/blobstore/libblobstore.a src/blockstore/libblockstore.a src/fspp/fs_interface/libfspp-interface.a src/cpp-utils/libcpp-utils.a -lcurl -lpthread -ldl vendor/spdlog/libspdlog.a vendor/cryptopp/libcryptopp.so -fopenmp=libomp -lomp -lpthread -lrt -lfuse && :
ld: ../lib/Linker/IRMover.cpp:1006: llvm::Error (anonymous namespace)::IRLinker::linkFunctionBody(llvm::Function &, llvm::Function &): Assertion `Dst.isDeclaration() && !Src.isDeclaration()' failed.
clang-8: error: unable to execute command: Aborted (core dumped)
clang-8: error: linker command failed due to signal (use -v to see invocation)
[360/364] Linking CXX shared library src/cryfs-unmount/libcryfs-unmount.so
FAILED: src/cryfs-unmount/libcryfs-unmount.so 
: && /usr/bin/clang++ -fPIC -Os -fomit-frame-pointer -gdwarf-4 -Wstrict-aliasing=2 -pipe -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4  -m64 -mtune=generic -flto -O3 -fPIC -Os -fomit-frame-pointer -gdwarf-4 -Wstrict-aliasing=2 -pipe -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4  -m64 -mtune=generic -flto -O3 -fPIC  -Os -fomit-frame-pointer -gdwarf-4 -Wstrict-aliasing=2 -pipe -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4  -m64 -mtune=generic -flto -O3 -fPIC -Wl,-O2  -Wl,--no-undefined -shared -Wl,-soname,libcryfs-unmount.so -o src/cryfs-unmount/libcryfs-unmount.so src/cryfs-unmount/CMakeFiles/cryfs-unmount.dir/program_options/ProgramOptions.cpp.o src/cryfs-unmount/CMakeFiles/cryfs-unmount.dir/program_options/Parser.cpp.o src/cryfs-unmount/CMakeFiles/cryfs-unmount.dir/Cli.cpp.o  src/cpp-utils/libcpp-utils.a src/cryfs/libcryfs.a src/fspp/fuse/libfspp-fuse.a src/blobstore/libblobstore.a src/blockstore/libblockstore.a src/gitversion/libgitversion.a src/fspp/fs_interface/libfspp-interface.a src/cpp-utils/libcpp-utils.a -lcurl -lpthread -ldl vendor/spdlog/libspdlog.a vendor/cryptopp/libcryptopp.so -fopenmp=libomp -lomp -lpthread -lrt -lfuse && :
/tmp/lto-llvm-1606ab.o:ld-temp.o:function cryfs_unmount::program_options::ProgramOptions::ProgramOptions(boost::filesystem::path): error: undefined reference to 'boost::filesystem::detail::current_path(boost::system::error_code*)'
/tmp/lto-llvm-1606ab.o:ld-temp.o:function cryfs_unmount::program_options::ProgramOptions::ProgramOptions(boost::filesystem::path): error: undefined reference to 'boost::filesystem::absolute(boost::filesystem::path const&, boost::filesystem::path const&)'

Steps to Reproduce the Problem

  1. Download spec file https://github.com/OpenMandrivaAssociation/cryfs
  2. Use LLVM/Clang 8.0x and LTO
  3. run rpmbuild

Specifications

  • CryFS Version: 0.10.1
  • Operating System (incl. Version): OpenMandriva Lx 4.0 clang version 8.0.0 (tags/RELEASE_800/final) Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-openmandriva-linux-gnu/8.2.0 Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-openmandriva-linux-gnu/8.3.0 Found candidate GCC installation: /usr/lib64/gcc/x86_64-openmandriva-linux-gnu/8.2.0 Found candidate GCC installation: /usr/lib64/gcc/x86_64-openmandriva-linux-gnu/8.3.0 Selected GCC installation: /usr/bin/../lib64/gcc/x86_64-openmandriva-linux-gnu/8.3.0 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Selected multilib: .;@m64

tpgxyz avatar Apr 25 '19 13:04 tpgxyz

Looks like linking is missing boost libraries. This time i've ran build without LTO. https://abf.openmandriva.org/build_lists/27483

FAILED: src/cryfs-unmount/libcryfs-unmount.so 
: && /usr/bin/clang++ -fPIC -Os -fomit-frame-pointer -gdwarf-4 -Wstrict-aliasing=2 -pipe -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4  -m64 -mtune=generic  -O3 -fPIC -Os -fomit-frame-pointer -gdwarf-4 -Wstrict-aliasing=2 -pipe -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4  -m64 -mtune=generic  -O3 -fPIC  -Os -fomit-frame-pointer -gdwarf-4 -Wstrict-aliasing=2 -pipe -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4  -m64 -mtune=generic  -O3 -fPIC -Wl,-O2  -Wl,--no-undefined -shared -Wl,-soname,libcryfs-unmount.so -o src/cryfs-unmount/libcryfs-unmount.so src/cryfs-unmount/CMakeFiles/cryfs-unmount.dir/program_options/ProgramOptions.cpp.o src/cryfs-unmount/CMakeFiles/cryfs-unmount.dir/program_options/Parser.cpp.o src/cryfs-unmount/CMakeFiles/cryfs-unmount.dir/Cli.cpp.o  src/cpp-utils/libcpp-utils.a src/cryfs/libcryfs.a src/fspp/fuse/libfspp-fuse.a src/blobstore/libblobstore.a src/blockstore/libblockstore.a src/gitversion/libgitversion.a src/fspp/fs_interface/libfspp-interface.a src/cpp-utils/libcpp-utils.a -lcurl -lpthread -ldl vendor/spdlog/libspdlog.a vendor/cryptopp/libcryptopp.so -fopenmp=libomp -lomp -lpthread -lrt -lfuse && :
/usr/include/boost/filesystem/operations.hpp:613: error: undefined reference to 'boost::filesystem::detail::current_path(boost::system::error_code*)'
../src/cryfs-unmount/program_options/ProgramOptions.cpp:15: error: undefined reference to 'boost::filesystem::absolute(boost::filesystem::path const&, boost::filesystem::path const&)'
/usr/include/boost/program_options/variables_map.hpp:155: error: undefined reference to 'boost::program_options::abstract_variables_map::operator[](std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/usr/include/boost/program_options/variables_map.hpp:146: error: undefined reference to 'vtable for boost::program_options::variables_map'
/usr/bin/ld: the vtable symbol may be undefined because the class is missing its key function
/usr/include/boost/program_options/variables_map.hpp:146: error: undefined reference to 'vtable for boost::program_options::variables_map'
/usr/bin/ld: the vtable symbol may be undefined because the class is missing its key function
../src/cryfs-unmount/program_options/Parser.cpp:62: error: undefined reference to 'boost::program_options::options_description::m_default_line_length'
../src/cryfs-unmount/program_options/Parser.cpp:62: error: undefined reference to 'boost::program_options::options_description::options_description(unsigned int, unsigned int)'
../src/cryfs-unmount/program_options/Parser.cpp:63: error: undefined reference to 'boost::program_options::positional_options_description::positional_options_description()'
../src/cryfs-unmount/program_options/Parser.cpp:67: error: undefined reference to 'boost::program_options::variables_map::variables_map()'
/usr/include/boost/program_options/detail/parsers.hpp:36: error: undefined reference to 'boost::program_options::detail::cmdline::set_options_description(boost::program_options::options_description const&)'
/usr/include/boost/program_options/detail/parsers.hpp:46: error: undefined reference to 'boost::program_options::detail::cmdline::set_positional_options(boost::program_options::positional_options_description const&)'
../src/cryfs-unmount/program_options/Parser.cpp:69: error: undefined reference to 'boost::program_options::store(boost::program_options::basic_parsed_options<char> const&, boost::program_options::variables_map&, bool)'
../src/cryfs-unmount/program_options/Parser.cpp:77: error: undefined reference to 'boost::program_options::notify(boost::program_options::variables_map&)'
/usr/include/boost/program_options/variables_map.hpp:146: error: undefined reference to 'vtable for boost::program_options::variables_map'
/usr/bin/ld: the vtable symbol may be undefined because the class is missing its key function
../src/cryfs-unmount/program_options/Parser.cpp:115: error: undefined reference to 'boost::program_options::options_description::m_default_line_length'
../src/cryfs-unmount/program_options/Parser.cpp:115: error: undefined reference to 'boost::program_options::options_description::options_description(unsigned int, unsigned int)'
../src/cryfs-unmount/program_options/Parser.cpp:117: error: undefined reference to 'boost::program_options::operator<<(std::ostream&, boost::program_options::options_description const&)'
../src/cryfs-unmount/program_options/Parser.cpp:92: error: undefined reference to 'boost::program_options::options_description::m_default_line_length'
../src/cryfs-unmount/program_options/Parser.cpp:92: error: undefined reference to 'boost::program_options::options_description::options_description(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, unsigned int)'

tpgxyz avatar Apr 25 '19 13:04 tpgxyz

LTO works for me, but I am using gcc (9.1) and have not tested LTO with clang.

automorphism88 avatar May 13 '19 18:05 automorphism88

This looks weird because it tries to build a dynamic library libcryfs-cli.so. CryFS should build everything statically by default.

smessmer avatar May 26 '19 03:05 smessmer

CryFS in the develop branch now uses Conan for getting the boost dependency. Can you retry? I think with Conan, it should work now.

smessmer avatar Nov 09 '19 19:11 smessmer