Cannot compile apache parquet from the source code - c++

This is the exact problem (source code from: https://github.com/apache/parquet-cpp).
I'm using cmake:
parquet-cpp/test-build$ cmake ..
It says:
-- Found the Snappy library: /home/adam/workspace/parquet-cpp/thirdparty/installed/lib/libsnappy.so
-- Found the ZLIB library: /home/adam/workspace/parquet-cpp/thirdparty/installed/lib/libz.so
-- Found the GTest library: /home/adam/workspace/parquet-cpp/thirdparty/googletest-release-1.7.0/libgtest.a
and then make VERBOSE=1: (it adds -ldl ../../../thirdparty/googletest-release-1.7.0/libgtest.a to the c++)
adam#gaia:~/workspace/parquet-cpp/test-build$ make VERBOSE=1
/usr/bin/cmake -H/home/adam/workspace/parquet-cpp -B/home/adam/workspace/parquet-cpp/test-build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/adam/workspace/parquet-cpp/test-build/CMakeFiles /home/adam/workspace/parquet-cpp/test-build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/home/adam/workspace/parquet-cpp/test-build'
make -f src/parquet/thrift/CMakeFiles/parquet_thrift.dir/build.make src/parquet/thrift/CMakeFiles/parquet_thrift.dir/depend
make[2]: Entering directory `/home/adam/workspace/parquet-cpp/test-build'
cd /home/adam/workspace/parquet-cpp/test-build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/adam/workspace/parquet-cpp /home/adam/workspace/parquet-cpp/src/parquet/thrift /home/adam/workspace/parquet-cpp/test-build /home/adam/workspace/parquet-cpp/test-build/src/parquet/thrift /home/adam/workspace/parquet-cpp/test-build/src/parquet/thrift/CMakeFiles/parquet_thrift.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/adam/workspace/parquet-cpp/test-build'
make -f src/parquet/thrift/CMakeFiles/parquet_thrift.dir/build.make src/parquet/thrift/CMakeFiles/parquet_thrift.dir/build
make[2]: Entering directory `/home/adam/workspace/parquet-cpp/test-build'
make[2]: Nothing to be done for `src/parquet/thrift/CMakeFiles/parquet_thrift.dir/build'.
make[2]: Leaving directory `/home/adam/workspace/parquet-cpp/test-build'
/usr/bin/cmake -E cmake_progress_report /home/adam/workspace/parquet-cpp/test-build/CMakeFiles 40 41 42
[ 5%] Built target parquet_thrift
make -f CMakeFiles/parquet_objlib.dir/build.make CMakeFiles/parquet_objlib.dir/depend
make[2]: Entering directory `/home/adam/workspace/parquet-cpp/test-build'
cd /home/adam/workspace/parquet-cpp/test-build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/adam/workspace/parquet-cpp /home/adam/workspace/parquet-cpp /home/adam/workspace/parquet-cpp/test-build /home/adam/workspace/parquet-cpp/test-build /home/adam/workspace/parquet-cpp/test-build/CMakeFiles/parquet_objlib.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/adam/workspace/parquet-cpp/test-build'
make -f CMakeFiles/parquet_objlib.dir/build.make CMakeFiles/parquet_objlib.dir/build
make[2]: Entering directory `/home/adam/workspace/parquet-cpp/test-build'
make[2]: Nothing to be done for `CMakeFiles/parquet_objlib.dir/build'.
make[2]: Leaving directory `/home/adam/workspace/parquet-cpp/test-build'
/usr/bin/cmake -E cmake_progress_report /home/adam/workspace/parquet-cpp/test-build/CMakeFiles 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
[ 50%] Built target parquet_objlib
make -f CMakeFiles/parquet_shared.dir/build.make CMakeFiles/parquet_shared.dir/depend
make[2]: Entering directory `/home/adam/workspace/parquet-cpp/test-build'
cd /home/adam/workspace/parquet-cpp/test-build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/adam/workspace/parquet-cpp /home/adam/workspace/parquet-cpp /home/adam/workspace/parquet-cpp/test-build /home/adam/workspace/parquet-cpp/test-build /home/adam/workspace/parquet-cpp/test-build/CMakeFiles/parquet_shared.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/adam/workspace/parquet-cpp/test-build'
make -f CMakeFiles/parquet_shared.dir/build.make CMakeFiles/parquet_shared.dir/build
make[2]: Entering directory `/home/adam/workspace/parquet-cpp/test-build'
make[2]: Nothing to be done for `CMakeFiles/parquet_shared.dir/build'.
make[2]: Leaving directory `/home/adam/workspace/parquet-cpp/test-build'
/usr/bin/cmake -E cmake_progress_report /home/adam/workspace/parquet-cpp/test-build/CMakeFiles
[ 50%] Built target parquet_shared
make -f CMakeFiles/parquet_static.dir/build.make CMakeFiles/parquet_static.dir/depend
make[2]: Entering directory `/home/adam/workspace/parquet-cpp/test-build'
cd /home/adam/workspace/parquet-cpp/test-build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/adam/workspace/parquet-cpp /home/adam/workspace/parquet-cpp /home/adam/workspace/parquet-cpp/test-build /home/adam/workspace/parquet-cpp/test-build /home/adam/workspace/parquet-cpp/test-build/CMakeFiles/parquet_static.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/adam/workspace/parquet-cpp/test-build'
make -f CMakeFiles/parquet_static.dir/build.make CMakeFiles/parquet_static.dir/build
make[2]: Entering directory `/home/adam/workspace/parquet-cpp/test-build'
make[2]: Nothing to be done for `CMakeFiles/parquet_static.dir/build'.
make[2]: Leaving directory `/home/adam/workspace/parquet-cpp/test-build'
/usr/bin/cmake -E cmake_progress_report /home/adam/workspace/parquet-cpp/test-build/CMakeFiles
[ 50%] Built target parquet_static
make -f src/parquet/util/CMakeFiles/parquet_test_main.dir/build.make src/parquet/util/CMakeFiles/parquet_test_main.dir/depend
make[2]: Entering directory `/home/adam/workspace/parquet-cpp/test-build'
cd /home/adam/workspace/parquet-cpp/test-build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/adam/workspace/parquet-cpp /home/adam/workspace/parquet-cpp/src/parquet/util /home/adam/workspace/parquet-cpp/test-build /home/adam/workspace/parquet-cpp/test-build/src/parquet/util /home/adam/workspace/parquet-cpp/test-build/src/parquet/util/CMakeFiles/parquet_test_main.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/adam/workspace/parquet-cpp/test-build'
make -f src/parquet/util/CMakeFiles/parquet_test_main.dir/build.make src/parquet/util/CMakeFiles/parquet_test_main.dir/build
make[2]: Entering directory `/home/adam/workspace/parquet-cpp/test-build'
make[2]: Nothing to be done for `src/parquet/util/CMakeFiles/parquet_test_main.dir/build'.
make[2]: Leaving directory `/home/adam/workspace/parquet-cpp/test-build'
/usr/bin/cmake -E cmake_progress_report /home/adam/workspace/parquet-cpp/test-build/CMakeFiles 39
[ 51%] Built target parquet_test_main
make -f src/parquet/CMakeFiles/public-api-test.dir/build.make src/parquet/CMakeFiles/public-api-test.dir/depend
make[2]: Entering directory `/home/adam/workspace/parquet-cpp/test-build'
cd /home/adam/workspace/parquet-cpp/test-build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/adam/workspace/parquet-cpp /home/adam/workspace/parquet-cpp/src/parquet /home/adam/workspace/parquet-cpp/test-build /home/adam/workspace/parquet-cpp/test-build/src/parquet /home/adam/workspace/parquet-cpp/test-build/src/parquet/CMakeFiles/public-api-test.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/adam/workspace/parquet-cpp/test-build'
make -f src/parquet/CMakeFiles/public-api-test.dir/build.make src/parquet/CMakeFiles/public-api-test.dir/build
make[2]: Entering directory `/home/adam/workspace/parquet-cpp/test-build'
Linking CXX executable ../../debug/public-api-test
cd /home/adam/workspace/parquet-cpp/test-build/src/parquet && /usr/bin/cmake -E cmake_link_script CMakeFiles/public-api-test.dir/link.txt --verbose=1
/usr/bin/c++ -ggdb -O0 -std=c++11 -Wall -fno-strict-aliasing -fvisibility=hidden -fvisibility-inlines-hidden -g CMakeFiles/public-api-test.dir/public-api-test.cc.o -o ../../debug/public-api-test -rdynamic ../../debug/libparquet_test_main.a ../../debug/libparquet.so -ldl ../../../thirdparty/googletest-release-1.7.0/libgtest.a -lpthread -Wl,-rpath,/home/adam/workspace/parquet-cpp/test-build/debug
CMakeFiles/public-api-test.dir/public-api-test.cc.o: In function `__static_initialization_and_destruction_0':
/home/adam/workspace/parquet-cpp/src/parquet/public-api-test.cc:25: undefined reference to `testing::internal::MakeAndRegisterTestInfo(char const*, char const*, char const*, char const*, testing::internal::CodeLocation, void const*, void (*)(), void (*)(), testing::internal::TestFactoryBase*)'
/home/adam/workspace/parquet-cpp/src/parquet/public-api-test.cc:31: undefined reference to `testing::internal::MakeAndRegisterTestInfo(char const*, char const*, char const*, char const*, testing::internal::CodeLocation, void const*, void (*)(), void (*)(), testing::internal::TestFactoryBase*)'
/home/adam/workspace/parquet-cpp/src/parquet/public-api-test.cc:41: undefined reference to `testing::internal::MakeAndRegisterTestInfo(char const*, char const*, char const*, char const*, testing::internal::CodeLocation, void const*, void (*)(), void (*)(), testing::internal::TestFactoryBase*)'
collect2: error: ld returned 1 exit status
make[2]: *** [debug/public-api-test] Error 1
make[2]: Leaving directory `/home/adam/workspace/parquet-cpp/test-build'
make[1]: *** [src/parquet/CMakeFiles/public-api-test.dir/all] Error 2
make[1]: Leaving directory `/home/adam/workspace/parquet-cpp/test-build'
make: *** [all] Error 2

Related

'ld' Error while compiling a module (Ubuntu 22.04)

I am trying to compile a module https://github.com/In-line/grip
I have installed the below tools
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y gcc-multilib g++-multilib
sudo apt-get install -y build-essential
sudo apt-get install -y libc6-dev libc6-dev-i386
sudo apt-get install -y cmake
I am getting the below error
root#test:/home/ubuntu/grip# make
/usr/bin/cmake -S/home/ubuntu/grip -B/home/ubuntu/grip --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/ubuntu/grip/CMakeFiles /home/ubuntu/grip//CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/ubuntu/grip'
make -f rust/CMakeFiles/grip-rust_target.dir/build.make rust/CMakeFiles/grip-rust_target.dir/depend
make[2]: Entering directory '/home/ubuntu/grip'
cd /home/ubuntu/grip && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/ubuntu/grip /home/ubuntu/grip/rust /home/ubuntu/grip /home/ubuntu/grip/rust /home/ubuntu/grip/rust/CMakeFiles/grip-rust_target.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/ubuntu/grip'
make -f rust/CMakeFiles/grip-rust_target.dir/build.make rust/CMakeFiles/grip-rust_target.dir/build
make[2]: Entering directory '/home/ubuntu/grip'
make[2]: Nothing to be done for 'rust/CMakeFiles/grip-rust_target.dir/build'.
make[2]: Leaving directory '/home/ubuntu/grip'
[ 25%] Built target grip-rust_target
make -f CMakeFiles/grip.dir/build.make CMakeFiles/grip.dir/depend
make[2]: Entering directory '/home/ubuntu/grip'
cd /home/ubuntu/grip && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/ubuntu/grip /home/ubuntu/grip /home/ubuntu/grip /home/ubuntu/grip /home/ubuntu/grip/CMakeFiles/grip.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/ubuntu/grip'
make -f CMakeFiles/grip.dir/build.make CMakeFiles/grip.dir/build
make[2]: Entering directory '/home/ubuntu/grip'
[ 50%] Linking CXX shared library grip_amxx_i386.so
/usr/bin/cmake -E cmake_link_script CMakeFiles/grip.dir/link.txt --verbose=1
/usr/bin/c++ -fPIC -Wall -Wextra -Wzero-as-null-pointer-constant -Wunknown-pragmas -m32 -O3 -mtune=generic -fvisibility=hidden -flto -fPIC -static-libgcc -static-libstdc++ -Wl,--gc-sections -Wl,--version-script=/home/ubuntu/grip/version_script.lds -fuse-ld=lld -shared -Wl,-soname,grip_amxx_i386.so -o grip_amxx_i386.so CMakeFiles/grip.dir/cpp/main.cpp.o CMakeFiles/grip.dir/third_party/amxmodx/public/sdk/amxxmodule.cpp.o rust/i686-unknown-linux-gnu/debug/libgrip_rust.a -lpthread
collect2: fatal error: cannot find ‘ld’
compilation terminated.
make[2]: *** [CMakeFiles/grip.dir/build.make:117: grip_amxx_i386.so] Error 1
make[2]: Leaving directory '/home/ubuntu/grip'
make[1]: *** [CMakeFiles/Makefile2:103: CMakeFiles/grip.dir/all] Error 2
make[1]: Leaving directory '/home/ubuntu/grip'
make: *** [Makefile:94: all] Error 2
root#test:/home/ubuntu/grip#
which ld output
root#test:/home/ubuntu/grip# which ld
/usr/bin/ld
echo $PATH output
/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin
Can someone please help to solve this. I tried searching the web but couldn't get anything relevant.
One of my friend suggested to do
apt install lld
and the issue got resolved.

How to link with binary using mingw32 in wine

I have made this minimal project to reproduce my link problem using mingw32 in wine32:
CMakeLists.txt
cmake_minimum_required(VERSION 3.13)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
project("tst" VERSION 1.1.0)
add_executable("tst" "main.cpp")
add_library("resource" "text.o")
set_target_properties("resource" PROPERTIES LINKER_LANGUAGE CXX)
add_custom_command(OUTPUT "text.o"
MAIN_DEPENDENCY "text"
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/text" "text"
COMMAND ${CMAKE_LINKER} -r -b binary "text" -o "text.o"
)
set_source_files_properties("text" PROPERTIES GENERATED true EXTERNAL_OBJECT true)
target_link_libraries("tst" "resource")
main.cpp
#include <iostream>
#include <string>
extern char _binary_text_start[];
extern char _binary_text_end[];
int main()
{
std::string text{ _binary_text_start, _binary_text_end };
std::cout << text << std::endl;
}
text
Hello, World!
This project builds and runs using mingw-w64 on Linux; however, when I try to build the project in wine32, I got this output:
Z:\cmake-3.19.1-win32-x86\bin\cmake.exe -SZ:\var\cache\deploy\cpp -BZ:\var\cache\deploy\cpp\build\windows --check-build-system CMakeFiles\Makefile.cmake 0
Z:\cmake-3.19.1-win32-x86\bin\cmake.exe -E cmake_progress_start Z:\var\cache\deploy\cpp\build\windows\CMakeFiles Z:\var\cache\deploy\cpp\build\windows\\CMakeFiles\progress.marks
mingw32-make -f CMakeFiles\Makefile2 all
mingw32-make[1]: Entering directory `Z:/var/cache/deploy/cpp/build/windows'
mingw32-make -f CMakeFiles\resource.dir\build.make CMakeFiles/resource.dir/depend
mingw32-make[2]: Entering directory `Z:/var/cache/deploy/cpp/build/windows'
[ 25%] Generating text.o
Z:\cmake-3.19.1-win32-x86\bin\cmake.exe -E copy Z:/var/cache/deploy/cpp/text text
Z:\mingw32\bin\ld.exe -r -b binary text -o text.o
Z:\cmake-3.19.1-win32-x86\bin\cmake.exe -E cmake_depends "MinGW Makefiles" Z:\var\cache\deploy\cpp Z:\var\cache\deploy\cpp Z:\var\cache\deploy\cpp\build\windows Z:\var\cache\deploy\cpp\build\windows Z:\var\cache\deploy\cpp\build\windows\CMakeFiles\resource.dir\DependInfo.cmake --color=
mingw32-make[2]: Leaving directory `Z:/var/cache/deploy/cpp/build/windows'
mingw32-make -f CMakeFiles\resource.dir\build.make CMakeFiles/resource.dir/build
mingw32-make[2]: Entering directory `Z:/var/cache/deploy/cpp/build/windows'
[ 50%] Linking CXX static library libresource.a
Z:\cmake-3.19.1-win32-x86\bin\cmake.exe -P CMakeFiles\resource.dir\cmake_clean_target.cmake
Z:\cmake-3.19.1-win32-x86\bin\cmake.exe -E cmake_link_script CMakeFiles\resource.dir\link.txt --verbose=1
Z:\mingw32\bin\ar.exe qc libresource.a text.o
Z:\mingw32\bin\ranlib.exe libresource.a
mingw32-make[2]: Leaving directory `Z:/var/cache/deploy/cpp/build/windows'
[ 50%] Built target resource
mingw32-make -f CMakeFiles\tst.dir\build.make CMakeFiles/tst.dir/depend
mingw32-make[2]: Entering directory `Z:/var/cache/deploy/cpp/build/windows'
Z:\cmake-3.19.1-win32-x86\bin\cmake.exe -E cmake_depends "MinGW Makefiles" Z:\var\cache\deploy\cpp Z:\var\cache\deploy\cpp Z:\var\cache\deploy\cpp\build\windows Z:\var\cache\deploy\cpp\build\windows Z:\var\cache\deploy\cpp\build\windows\CMakeFiles\tst.dir\DependInfo.cmake --color=
mingw32-make[2]: Leaving directory `Z:/var/cache/deploy/cpp/build/windows'
mingw32-make -f CMakeFiles\tst.dir\build.make CMakeFiles/tst.dir/build
mingw32-make[2]: Entering directory `Z:/var/cache/deploy/cpp/build/windows'
[ 75%] Building CXX object CMakeFiles/tst.dir/main.cpp.obj
Z:\mingw32\bin\g++.exe -O3 -DNDEBUG -o CMakeFiles\tst.dir\main.cpp.obj -c Z:\var\cache\deploy\cpp\main.cpp
[100%] Linking CXX executable tst.exe
Z:\cmake-3.19.1-win32-x86\bin\cmake.exe -E cmake_link_script CMakeFiles\tst.dir\link.txt --verbose=1
Z:\cmake-3.19.1-win32-x86\bin\cmake.exe -E rm -f CMakeFiles\tst.dir/objects.a
Z:\mingw32\bin\ar.exe cr CMakeFiles\tst.dir/objects.a #CMakeFiles\tst.dir\objects1.rsp
Z:\mingw32\bin\g++.exe -O3 -DNDEBUG -Wl,--whole-archive CMakeFiles\tst.dir/objects.a -Wl,--no-whole-archive -o tst.exe -Wl,--out-implib,libtst.dll.a -Wl,--major-image-version,0,--minor-image-version,0 #CMakeFiles\tst.dir\linklibs.rsp
z:/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld.exe: CMakeFiles\tst.dir/objects.a(main.cpp.obj):main.cpp:(.text.startup+0x43): undefined reference to `_binary_text_end'
z:/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld.exe: CMakeFiles\tst.dir/objects.a(main.cpp.obj):main.cpp:(.text.startup+0x48): undefined reference to `_binary_text_start'
z:/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld.exe: CMakeFiles\tst.dir/objects.a(main.cpp.obj):main.cpp:(.text.startup+0x68): undefined reference to `_binary_text_start'
z:/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld.exe: CMakeFiles\tst.dir/objects.a(main.cpp.obj):main.cpp:(.text.startup+0x16f): undefined reference to `_binary_text_start'
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [tst.exe] Error 1
mingw32-make[2]: Leaving directory `Z:/var/cache/deploy/cpp/build/windows'
mingw32-make[1]: *** [CMakeFiles/tst.dir/all] Error 2
mingw32-make[1]: Leaving directory `Z:/var/cache/deploy/cpp/build/windows'
mingw32-make: *** [all] Error 2
nm libresource.a
text.o:
0000000d D _binary_text_end
0000000d A _binary_text_size
00000000 D _binary_text_start
objdump -f libresource.a
In archive libresource.a:
text.o: file format pe-i386
architecture: i386, flags 0x00000038:
HAS_DEBUG, HAS_SYMS, HAS_LOCALS
start address 0x00000000
cmake: https://github.com/Kitware/CMake/releases/download/v3.19.1/cmake-3.19.1-win32-x86.zip
mingw: https://pilotfiber.dl.sourceforge.net/project/mingw-w64/Toolchains%20targetting%20Win32/Personal%20Builds/ray_linn/GCC-10.x-with-ada/mingw32-10.2.0-crt-8.0.0-with-ada.7z
mingw-make: https://phoenixnap.dl.sourceforge.net/project/mingw/MinGW/Extension/make/mingw32-make-3.80-3/mingw32-make-3.80.0-3.tar.gz

How do I debug missing headers in CMake project?

What would be the general algorithm I should follow to debug issues such as this one?
23:28:12: Running steps for project jumper-qt...
23:28:12: Starting: "/usr/bin/cmake" --build . --target all
/usr/bin/cmake -S/home/skrat/Workspace/jumper-qt -B/home/skrat/Workspace/jumper-qt/build/Debug --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/skrat/Workspace/jumper-qt/build/Debug/CMakeFiles /home/skrat/Workspace/jumper-qt/build/Debug/CMakeFiles/progress.marks
/usr/bin/make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/skrat/Workspace/jumper-qt/build/Debug'
/usr/bin/make -f src/CMakeFiles/jumper-qt_autogen.dir/build.make src/CMakeFiles/jumper-qt_autogen.dir/depend
make[2]: Entering directory '/home/skrat/Workspace/jumper-qt/build/Debug'
cd /home/skrat/Workspace/jumper-qt/build/Debug && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/skrat/Workspace/jumper-qt /home/skrat/Workspace/jumper-qt/src /home/skrat/Workspace/jumper-qt/build/Debug /home/skrat/Workspace/jumper-qt/build/Debug/src /home/skrat/Workspace/jumper-qt/build/Debug/src/CMakeFiles/jumper-qt_autogen.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/skrat/Workspace/jumper-qt/build/Debug'
/usr/bin/make -f src/CMakeFiles/jumper-qt_autogen.dir/build.make src/CMakeFiles/jumper-qt_autogen.dir/build
make[2]: Entering directory '/home/skrat/Workspace/jumper-qt/build/Debug'
[ 14%] Automatic MOC and UIC for target jumper-qt
cd /home/skrat/Workspace/jumper-qt/build/Debug/src && /usr/bin/cmake -E cmake_autogen /home/skrat/Workspace/jumper-qt/build/Debug/src/CMakeFiles/jumper-qt_autogen.dir/AutogenInfo.json Debug
make[2]: Leaving directory '/home/skrat/Workspace/jumper-qt/build/Debug'
[ 14%] Built target jumper-qt_autogen
/usr/bin/make -f src/CMakeFiles/jumper-qt.dir/build.make src/CMakeFiles/jumper-qt.dir/depend
make[2]: Entering directory '/home/skrat/Workspace/jumper-qt/build/Debug'
cd /home/skrat/Workspace/jumper-qt/build/Debug && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/skrat/Workspace/jumper-qt /home/skrat/Workspace/jumper-qt/src /home/skrat/Workspace/jumper-qt/build/Debug /home/skrat/Workspace/jumper-qt/build/Debug/src /home/skrat/Workspace/jumper-qt/build/Debug/src/CMakeFiles/jumper-qt.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/skrat/Workspace/jumper-qt/build/Debug'
/usr/bin/make -f src/CMakeFiles/jumper-qt.dir/build.make src/CMakeFiles/jumper-qt.dir/build
make[2]: Entering directory '/home/skrat/Workspace/jumper-qt/build/Debug'
[ 28%] Building CXX object src/CMakeFiles/jumper-qt.dir/magnum_item.cpp.o
cd /home/skrat/Workspace/jumper-qt/build/Debug/src && /usr/bin/g++ -DCORRADE_IS_DEBUG_BUILD -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_QMLMODELS_LIB -DQT_QML_DEBUG -DQT_QML_LIB -DQT_QUICK_LIB -I/home/skrat/Workspace/jumper-qt/build/Debug/src -I/home/skrat/Workspace/jumper-qt/src -I/home/skrat/Workspace/jumper-qt/build/Debug/src/jumper-qt_autogen/include -isystem /usr/include/MagnumExternal/OpenGL -isystem /usr/include/qt -isystem /usr/include/qt/QtCore -isystem /usr/lib/qt/mkspecs/linux-g++ -isystem /usr/include/qt/QtQuick -isystem /usr/include/qt/QtQmlModels -isystem /usr/include/qt/QtQml -isystem /usr/include/qt/QtNetwork -isystem /usr/include/qt/QtGui -DQT_QML_DEBUG -g -DQT_QML_DEBUG -Wall -Wextra -Wold-style-cast -Winit-self -Werror=return-type -Wmissing-declarations -Wpedantic -fvisibility=hidden -fvisibility-inlines-hidden -Wzero-as-null-pointer-constant -Wdouble-promotion -fPIC -std=gnu++14 -o CMakeFiles/jumper-qt.dir/magnum_item.cpp.o -c /home/skrat/Workspace/jumper-qt/src/magnum_item.cpp
In file included from /home/skrat/Workspace/jumper-qt/src/magnum_item.cpp:4:
/usr/include/Magnum/GL/Renderer.h: In static member function ‘static void Magnum::GL::Renderer::flush()’:
/usr/include/Magnum/GL/Renderer.h:1838:31: error: ‘glFlush’ was not declared in this scope; did you mean ‘flush’?
1838 | static void flush() { glFlush(); }
| ^~~~~~~
| flush
/usr/include/Magnum/GL/Renderer.h: In static member function ‘static void Magnum::GL::Renderer::finish()’:
/usr/include/Magnum/GL/Renderer.h:1846:32: error: ‘glFinish’ was not declared in this scope; did you mean ‘finish’?
1846 | static void finish() { glFinish(); }
| ^~~~~~~~
| finish
In file included from /home/skrat/Workspace/jumper-qt/src/magnum_item.cpp:4:
/usr/include/Magnum/GL/Renderer.h: In static member function ‘static Magnum::GL::Renderer::Error Magnum::GL::Renderer::error()’:
/usr/include/Magnum/GL/Renderer.h:2053:58: error: ‘glGetError’ was not declared in this scope
2053 | static Error error() { return static_cast<Error>(glGetError()); }
| ^~~~~~~~~~
make[2]: *** [src/CMakeFiles/jumper-qt.dir/build.make:122: src/CMakeFiles/jumper-qt.dir/magnum_item.cpp.o] Error 1
make[2]: Leaving directory '/home/skrat/Workspace/jumper-qt/build/Debug'
make[1]: Leaving directory '/home/skrat/Workspace/jumper-qt/build/Debug'
make[1]: *** [CMakeFiles/Makefile2:118: src/CMakeFiles/jumper-qt.dir/all] Error 2
make: *** [Makefile:107: all] Error 2
23:28:15: The process "/usr/bin/cmake" exited with code 2.
Error while building/deploying project jumper-qt (kit: Desktop)
When executing step "CMake Build"
23:28:15: Elapsed time: 00:04.
The example project use both Qt (Quick 2) and Magnum, both of these libraries make extensive use of OpenGL. When I start example projects for them separately, they both work well and build with no error. When I try to marry them, it falls a part.
So what would be a procedure to follow in this case? How do I find out out why these (glFlush) declarations are missing? I tried adding find_package(OpenGL.... to my project, with no success. I'm interested in the process of finding out what's the problem, not in a solution to this particular problem.
Thank you SO
UPDATE: CMake files here https://gist.github.com/skrat/c5b20d6753e6476a4a0d60227cb73cda
Before including Magnum, I had the same project, where I included find_package(OpenGL... and was able to use raw OpenGL calls successfully. In a separate Magnum only project, I don't have to find package OpenGL and all is fine, I assume Magnum's CMake files do the hard work.
Also this might be relevant https://github.com/mosra/magnum-bootstrap/blob/base-qt/modules/FindMagnum.cmake

Unable to load shared object: undefined symbol

I'm trying to create simple lib for the R with statically linked boost.
CMakeLists.txt
cmake_minimum_required(VERSION 3.3)
project(TheRPath)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Werror")
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost 1.50.0 REQUIRED COMPONENTS filesystem)
include_directories(${Boost_INCLUDE_DIRS})
include_directories("/usr/share/R/include")
set(SOURCE_FILES Path.cpp Path.h)
add_library(therpath SHARED ${SOURCE_FILES})
target_link_libraries(therpath ${Boost_LIBRARIES})
Interpreter gives me an error when I'm trying to load shared object.
> dyn.load("libtherpath.so")
Error in dyn.load("libtherpath.so") :
unable to load shared object 'libtherpath.so':
libtherpath.so: undefined symbol: _ZN5boost6system15system_categoryEv
I have the following code:
Path.h
#ifndef PATH_H
#define PATH_H
#include <Rinternals.h>
extern "C" SEXP foo(SEXP snapshotPath);
#endif // PATH_H
Path.cpp
#include <string>
#include <boost/filesystem.hpp>
#include "Path.h"
extern "C" SEXP foo(SEXP snapshotPath) {
std::string path(R_CHAR(STRING_ELT(snapshotPath, 0)));
std::cerr << path << boost::filesystem::path::preferred_separator << "file.txt" << std::endl;
return R_NilValue;
}
Could you tell me what I'm doing wrong?
UPD 1
Output of make VERBOSE=1:
/home/user/Soft/clion-latest/bin/cmake/bin/cmake -H/home/user/Workspace/TheRPath -B/home/user/.CLion12/system/cmake/generated/a69e8583/a69e8583/Debug --check-build-system CMakeFiles/Makefile.cmake 0
/home/user/Soft/clion-latest/bin/cmake/bin/cmake -E cmake_progress_start /home/user/.CLion12/system/cmake/generated/a69e8583/a69e8583/Debug/CMakeFiles /home/user/.CLion12/system/cmake/generated/a69e8583/a69e8583/Debug/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/home/user/.CLion12/system/cmake/generated/a69e8583/a69e8583/Debug'
make -f CMakeFiles/therpath.dir/build.make CMakeFiles/therpath.dir/depend
make[2]: Entering directory `/home/user/.CLion12/system/cmake/generated/a69e8583/a69e8583/Debug'
cd /home/user/.CLion12/system/cmake/generated/a69e8583/a69e8583/Debug && /home/user/Soft/clion-latest/bin/cmake/bin/cmake -E cmake_depends "Unix Makefiles" /home/user/Workspace/TheRPath /home/user/Workspace/TheRPath /home/user/.CLion12/system/cmake/generated/a69e8583/a69e8583/Debug /home/user/.CLion12/system/cmake/generated/a69e8583/a69e8583/Debug /home/user/.CLion12/system/cmake/generated/a69e8583/a69e8583/Debug/CMakeFiles/therpath.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/user/.CLion12/system/cmake/generated/a69e8583/a69e8583/Debug'
make -f CMakeFiles/therpath.dir/build.make CMakeFiles/therpath.dir/build
make[2]: Entering directory `/home/user/.CLion12/system/cmake/generated/a69e8583/a69e8583/Debug'
[ 50%] Building CXX object CMakeFiles/therpath.dir/Path.cpp.o
/usr/bin/c++ -Dtherpath_EXPORTS -std=c++11 -Wall -Werror -g -fPIC -I/usr/share/R/include -o CMakeFiles/therpath.dir/Path.cpp.o -c /home/user/Workspace/TheRPath/Path.cpp
[100%] Linking CXX shared library libtherpath.so
/home/user/Soft/clion-latest/bin/cmake/bin/cmake -E cmake_link_script CMakeFiles/therpath.dir/link.txt --verbose=1
/usr/bin/c++ -fPIC -std=c++11 -Wall -Werror -g -shared -Wl,-soname,libtherpath.so -o libtherpath.so CMakeFiles/therpath.dir/Path.cpp.o /usr/lib/x86_64-linux-gnu/libboost_filesystem.a
make[2]: Leaving directory `/home/user/.CLion12/system/cmake/generated/a69e8583/a69e8583/Debug'
[100%] Built target therpath
make[1]: Leaving directory `/home/user/.CLion12/system/cmake/generated/a69e8583/a69e8583/Debug'
/home/user/Soft/clion-latest/bin/cmake/bin/cmake -E cmake_progress_start /home/user/.CLion12/system/cmake/generated/a69e8583/a69e8583/Debug/CMakeFiles 0
UPD 2
/home/user/Soft/clion-latest/bin/cmake/bin/cmake -H/home/user/Workspace/TheRPath -B/home/user/.CLion12/system/cmake/generated/a69e8583/a69e8583/Debug --check-build-system CMakeFiles/Makefile.cmake 0
/home/user/Soft/clion-latest/bin/cmake/bin/cmake -E cmake_progress_start /home/user/.CLion12/system/cmake/generated/a69e8583/a69e8583/Debug/CMakeFiles /home/user/.CLion12/system/cmake/generated/a69e8583/a69e8583/Debug/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/home/user/.CLion12/system/cmake/generated/a69e8583/a69e8583/Debug'
make -f CMakeFiles/therpath.dir/build.make CMakeFiles/therpath.dir/depend
make[2]: Entering directory `/home/user/.CLion12/system/cmake/generated/a69e8583/a69e8583/Debug'
cd /home/user/.CLion12/system/cmake/generated/a69e8583/a69e8583/Debug && /home/user/Soft/clion-latest/bin/cmake/bin/cmake -E cmake_depends "Unix Makefiles" /home/user/Workspace/TheRPath /home/user/Workspace/TheRPath /home/user/.CLion12/system/cmake/generated/a69e8583/a69e8583/Debug /home/user/.CLion12/system/cmake/generated/a69e8583/a69e8583/Debug /home/user/.CLion12/system/cmake/generated/a69e8583/a69e8583/Debug/CMakeFiles/therpath.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/user/.CLion12/system/cmake/generated/a69e8583/a69e8583/Debug'
make -f CMakeFiles/therpath.dir/build.make CMakeFiles/therpath.dir/build
make[2]: Entering directory `/home/user/.CLion12/system/cmake/generated/a69e8583/a69e8583/Debug'
[ 50%] Building CXX object CMakeFiles/therpath.dir/Path.cpp.o
/usr/bin/c++ -Dtherpath_EXPORTS -std=c++11 -Wall -Werror -g -fPIC -I/usr/share/R/include -o CMakeFiles/therpath.dir/Path.cpp.o -c /home/user/Workspace/TheRPath/Path.cpp
[100%] Linking CXX shared library libtherpath.so
/home/user/Soft/clion-latest/bin/cmake/bin/cmake -E cmake_link_script CMakeFiles/therpath.dir/link.txt --verbose=1
/usr/bin/c++ -fPIC -std=c++11 -Wall -Werror -g -shared -Wl,-soname,libtherpath.so -o libtherpath.so CMakeFiles/therpath.dir/Path.cpp.o /usr/lib/x86_64-linux-gnu/libboost_system.a /usr/lib/x86_64-linux-gnu/libboost_filesystem.a
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_system.a(error_code.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/lib/x86_64-linux-gnu/libboost_system.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [libtherpath.so] Error 1
make[2]: Leaving directory `/home/user/.CLion12/system/cmake/generated/a69e8583/a69e8583/Debug'
make[1]: *** [CMakeFiles/therpath.dir/all] Error 2
make[1]: Leaving directory `/home/user/.CLion12/system/cmake/generated/a69e8583/a69e8583/Debug'
make: *** [all] Error 2
libboost_filesystem depends on libboost_system. You need to add it to your CMakeLists.txt:
find_package(Boost REQUIRED COMPONENTS filesystem system)
Note I omitted the optional Boost version number, because you probably don't really need or want to specify it. But you can if you feel compelled.

Errors compiling MinGW for CMake

after making a breakthrough with my earlier MiniGW problem i have come across another. This is very diffrent from my understanding. from what i see everything compiles ok and i dont have a good enough understanding of cmake to know what the problem is.
here is the Error log
||=== Build: Icarus in Icarus (compiler: GNU GCC Compiler) ===|
CMakeFiles\Makefile2|60|recipe for target 'CMakeFiles/Icarus.dir/all' failed|
CMakeFiles\Makefile2|72|recipe for target 'CMakeFiles/Icarus.dir/rule' failed|
D:\Projects\SVN\Icarus\build\Makefile|110|recipe for target 'Icarus' failed|
||=== Build failed: 3 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|
Here is the line in the makefile it points to
# Build rule for target.
Icarus: cmake_check_build_system
$(MAKE) -f CMakeFiles/Makefile2 Icarus
.PHONY : Icarus
And here is the first section it points to in makefile2
CMakeFiles/Icarus.dir/all:
$(MAKE) -f CMakeFiles/Icarus.dir/build.make CMakeFiles/Icarus.dir/depend
$(MAKE) -f CMakeFiles/Icarus.dir/build.make CMakeFiles/Icarus.dir/build
$(CMAKE_COMMAND) -E cmake_progress_report D:/Projects/SVN/Icarus/build/CMakeFiles
#echo "Built target Icarus"
.PHONY : CMakeFiles/Icarus.dir/all
And finally here is the final section
# Build rule for subdir invocation for target.
CMakeFiles/Icarus.dir/rule: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start D:/Projects/SVN/Icarus/build/CMakeFiles 31
$(MAKE) -f CMakeFiles/Makefile2 CMakeFiles/Icarus.dir/all
$(CMAKE_COMMAND) -E cmake_progress_start D:/Projects/SVN/Icarus/build/CMakeFiles 0
.PHONY : CMakeFiles/Icarus.dir/rule
hopefully this is enough information to fix the error.
Edit information from about the error
Running command: c:/MinGW/bin/make.exe -f "D:/Projects/SVN/Icarus/build/Makefile" VERBOSE=1 Icarus
"c:/Program Files (x86)/CMake/bin/cmake.exe" -HD:/Projects/SVN/Icarus -BD:/Projects/SVN/Icarus/build --check-build-system CMakeFiles/Makefile.cmake 0
c:/MinGW/bin/make.exe -f CMakeFiles/Makefile2 Icarus
make.exe[1]: Entering directory 'D:/Projects/SVN/Icarus/build'
"c:/Program Files (x86)/CMake/bin/cmake.exe" -HD:/Projects/SVN/Icarus -BD:/Projects/SVN/Icarus/build --check-build-system CMakeFiles/Makefile.cmake 0
"c:/Program Files (x86)/CMake/bin/cmake.exe" -E cmake_progress_start D:/Projects/SVN/Icarus/build/CMakeFiles 31
c:/MinGW/bin/make.exe -f CMakeFiles/Makefile2 CMakeFiles/Icarus.dir/all
make.exe[2]: Entering directory 'D:/Projects/SVN/Icarus/build'
c:/MinGW/bin/make.exe -f CMakeFiles/Icarus.dir/build.make CMakeFiles/Icarus.dir/depend
make.exe[3]: Entering directory 'D:/Projects/SVN/Icarus/build'
"C:\Program Files (x86)\CMake\bin\cmake.exe" -E cmake_depends "MinGW Makefiles" D:\Projects\SVN\Icarus D:\Projects\SVN\Icarus D:\Projects\SVN\Icarus\build D:\Projects\SVN\Icarus\build D:\Projects\SVN\Icarus\build\CMakeFiles\Icarus.dir\DependInfo.cmake --color=
make.exe[3]: Leaving directory 'D:/Projects/SVN/Icarus/build'