Build fails on Ubuntu 20.04
Describe the bug
The build fails with errors in several files.
Expected behavior
Should be able to compile with cmake --build build.
Environment:
- OS: Ubuntu 20.04
- Compiler/IDE: Clang 12.0.1, GCC 9.3.0, Intel oneAPI 2021.3.0
- Version: commit 223084c
Additional context
> CC=clang CXX=clang++ cmake ..
-- The C compiler identification is Clang 12.0.1
-- The CXX compiler identification is Clang 12.0.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- ORC third-party: creating target 'stlab::stlab'...
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
CMake Warning (dev) at build/_deps/stlab-src/stlab/concurrency/CMakeLists.txt:1 (target_sources):
Policy CMP0076 is not set: target_sources() command converts relative paths
to absolute. Run "cmake --help-policy CMP0076" for policy details. Use
the cmake_policy command to set the policy and suppress this warning.
An interface source of target "stlab" has a relative path.
This warning is for project developers. Use -Wno-dev to suppress it.
-- stlab: Task System: header
-- ORC third-party: creating target 'tomlplusplus::tomlplusplus'...
-- ORC third-party: creating target 'TBB::tbb'...
CMake Warning (dev) at build/_deps/tbb-src/CMakeLists.txt:95 (option):
Policy CMP0077 is not set: option() honors normal variables. Run "cmake
--help-policy CMP0077" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
For compatibility with older versions of CMake, option is clearing the
normal variable 'TBB_TEST'.
This warning is for project developers. Use -Wno-dev to suppress it.
-- CMAKE_BUILD_TYPE is not specified. Using default: RelWithDebInfo
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Checking for one of the modules 'hwloc'
-- The tbbbind_2_0 target will be configured using the HWLOC 2.1.0
-- Configuring done
-- Generating done
-- Build files have been written to: $HOME/Projects/orc/build
> make
[ 0%] Building CXX object _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/address_waiter.cpp.o
[ 1%] Building CXX object _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/allocator.cpp.o
[ 1%] Building CXX object _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/arena.cpp.o
[ 1%] Building CXX object _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/arena_slot.cpp.o
[ 2%] Building CXX object _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/concurrent_bounded_queue.cpp.o
[ 2%] Building CXX object _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/dynamic_link.cpp.o
[ 2%] Building CXX object _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/exception.cpp.o
[ 3%] Building CXX object _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/governor.cpp.o
[ 3%] Building CXX object _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/global_control.cpp.o
[ 3%] Building CXX object _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/itt_notify.cpp.o
[ 3%] Building CXX object _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/main.cpp.o
[ 4%] Building CXX object _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/market.cpp.o
[ 4%] Building CXX object _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/misc.cpp.o
[ 4%] Building CXX object _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/misc_ex.cpp.o
[ 5%] Building CXX object _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/observer_proxy.cpp.o
[ 5%] Building CXX object _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/parallel_pipeline.cpp.o
[ 5%] Building CXX object _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/private_server.cpp.o
[ 5%] Building CXX object _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/profiling.cpp.o
[ 6%] Building CXX object _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/rml_tbb.cpp.o
[ 6%] Building CXX object _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/rtm_mutex.cpp.o
[ 6%] Building CXX object _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/rtm_rw_mutex.cpp.o
[ 7%] Building CXX object _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/semaphore.cpp.o
[ 7%] Building CXX object _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/small_object_pool.cpp.o
[ 7%] Building CXX object _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/task.cpp.o
[ 8%] Building CXX object _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/task_dispatcher.cpp.o
[ 8%] Building CXX object _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/task_group_context.cpp.o
[ 8%] Building CXX object _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/version.cpp.o
[ 8%] Building CXX object _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/queuing_rw_mutex.cpp.o
[ 9%] Linking CXX shared library ../../../../clang_12.0_cxx11_64_relwithdebinfo/libtbb.so
[ 9%] Built target tbb
[ 9%] Building CXX object CMakeFiles/orc_orc.dir/src/ar.cpp.o
In file included from $HOME/Projects/orc/src/ar.cpp:8:
In file included from $HOME/Projects/orc/include/orc/ar.hpp:13:
$HOME/Projects/orc/include/orc/parse_file.hpp:78:17: error: enumeration value '_S_ios_seekdir_end' not handled in switch [-Werror,-Wswitch]
switch (dir) {
^
$HOME/Projects/orc/include/orc/parse_file.hpp:93:14: error: no member named 'memcpy' in namespace 'std'
std::memcpy(p, _p, n);
~~~~~^
$HOME/Projects/orc/include/orc/parse_file.hpp:211:37: error: no template named 'function' in namespace 'std'
using register_dies_callback = std::function<void(dies)>;
~~~~~^
$HOME/Projects/orc/include/orc/parse_file.hpp:212:31: error: no template named 'function' in namespace 'std'
using do_work_callback = std::function<void(std::function<void()>)>;
~~~~~^
$HOME/Projects/orc/include/orc/parse_file.hpp:212:50: error: no member named 'function' in namespace 'std'
using do_work_callback = std::function<void(std::function<void()>)>;
~~~~~^
$HOME/Projects/orc/include/orc/parse_file.hpp:212:66: error: expected expression
using do_work_callback = std::function<void(std::function<void()>)>;
^
$HOME/Projects/orc/include/orc/parse_file.hpp:213:30: error: no template named 'function' in namespace 'std'
using empool_callback = std::function<pool_string(std::string_view)>;
~~~~~^
$HOME/Projects/orc/include/orc/parse_file.hpp:216:5: error: unknown type name 'register_dies_callback'
register_dies_callback _register_die;
^
$HOME/Projects/orc/include/orc/parse_file.hpp:217:5: error: unknown type name 'do_work_callback'
do_work_callback _do_work;
^
$HOME/Projects/orc/include/orc/parse_file.hpp:218:5: error: unknown type name 'empool_callback'
empool_callback _empool;
^
10 errors generated.
make[2]: *** [CMakeFiles/orc_orc.dir/build.make:76: CMakeFiles/orc_orc.dir/src/ar.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:665: CMakeFiles/orc_orc.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
@kc9jud thank you for this report - I'm working through these build issues now, but am bumping up against the Mach-O headers being missing. Given that this tool was originally intended for use with Mac OS X, it assumes the DWARF data will be embedded within object files formatted as Mach-O. Ubuntu doesn't use Mach-O as its object file format, so there would have to be some work required to get this tool working on that platform. Would you be able to help in this effort?
Please see PR #19. The code will now compile under Ubuntu, however there is more work to be done to enable the tool for Ubuntu's object file format. It would be amazing if this could get lit up, however I'm not sure how much time I can dedicate to such an effort currently.
@fosterbrereton would Agner Fog's object converter be a short-term solution? https://www.agner.org/optimize/#objconv
I guess that might not help with the Mach-O headers, though.
@kc9jud That would certainly allow for ORC to rely on it's current Mach-O underpinnings. The one task that remains there would be to port the Mach-O structures to platforms that do not have them. This should be straightforward, but again, not something I can dedicate time to currently.
PR #21 adds the necessary mach-o types to the project. There's something not building right with the TBB dependency that I cannot figure out. Other than that, the tool should work on Ubuntu now (though still requires Mach-O object files.)