I'm trying to build and run an wxWidgets application in CLion under Ubuntu. Following this topic, I could get the feel of the file I need. As I use VSCode, I used the output of the command wx-config --cxxflags to include it to the includePath on c_cpp_properties.json in VSCode.
-I/usr/local/lib/wx/include/gtk3-unicode-3.3 -I/usr/local/include/wx-3.3 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread
"/usr/local/include/wx-3.3",
"/usr/local/lib/wx/include/gtk3-unicode-3.3"
So, I used this same path for the CLion and using the same skeleton from the topic above and I'm getting a lot of errors:
====================[ Build | FirstC | Debug ]==================================
/snap/clion/203/bin/cmake/linux/bin/cmake --build /home/leandro/Desktop/Biblioteca-Motora/cmake-build-debug --target FirstC -j 9
[1/5] Building CXX object CMakeFiles/FirstC.dir/cDataBase.cpp.o
FAILED: CMakeFiles/FirstC.dir/cDataBase.cpp.o
/usr/bin/c++ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/home/leandro/Desktop/Biblioteca-Motora/. -I/home/leandro/Desktop/Biblioteca-Motora/sqlite -isystem /usr/local/lib/wx/include/gtk3-unicode-3.3 -isystem /usr/local/include/wx-3.3 -pthread -g -std=gnu++14 -MD -MT CMakeFiles/FirstC.dir/cDataBase.cpp.o -MF CMakeFiles/FirstC.dir/cDataBase.cpp.o.d -o CMakeFiles/FirstC.dir/cDataBase.cpp.o -c /home/leandro/Desktop/Biblioteca-Motora/cDataBase.cpp
In file included from /home/leandro/Desktop/Biblioteca-Motora/cDataBase.cpp:1:
/home/leandro/Desktop/Biblioteca-Motora/cDataBase.h:18:21: error: ‘filesystem’ is not a namespace-name; did you mean ‘system’?
18 | namespace fs = std::filesystem;
| ^~~~~~~~~~
| system
[2/5] Building CXX object CMakeFiles/FirstC.dir/cApp.cpp.o
FAILED: CMakeFiles/FirstC.dir/cApp.cpp.o
/usr/bin/c++ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/home/leandro/Desktop/Biblioteca-Motora/. -I/home/leandro/Desktop/Biblioteca-Motora/sqlite -isystem /usr/local/lib/wx/include/gtk3-unicode-3.3 -isystem /usr/local/include/wx-3.3 -pthread -g -std=gnu++14 -MD -MT CMakeFiles/FirstC.dir/cApp.cpp.o -MF CMakeFiles/FirstC.dir/cApp.cpp.o.d -o CMakeFiles/FirstC.dir/cApp.cpp.o -c /home/leandro/Desktop/Biblioteca-Motora/cApp.cpp
In file included from /home/leandro/Desktop/Biblioteca-Motora/cMotor.h:21,
from /home/leandro/Desktop/Biblioteca-Motora/cMain.h:14,
from /home/leandro/Desktop/Biblioteca-Motora/cApp.h:12,
from /home/leandro/Desktop/Biblioteca-Motora/cApp.cpp:1:
/home/leandro/Desktop/Biblioteca-Motora/cDataBase.h:18:21: error: ‘filesystem’ is not a namespace-name; did you mean ‘system’?
18 | namespace fs = std::filesystem;
| ^~~~~~~~~~
| system
In file included from /home/leandro/Desktop/Biblioteca-Motora/cApp.cpp:1:
/home/leandro/Desktop/Biblioteca-Motora/cApp.h:16:21: error: ‘filesystem’ is not a namespace-name; did you mean ‘system’?
16 | namespace fs = std::filesystem;
| ^~~~~~~~~~
| system
[3/5] Building CXX object CMakeFiles/FirstC.dir/cMotor.cpp.o
FAILED: CMakeFiles/FirstC.dir/cMotor.cpp.o
/usr/bin/c++ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/home/leandro/Desktop/Biblioteca-Motora/. -I/home/leandro/Desktop/Biblioteca-Motora/sqlite -isystem /usr/local/lib/wx/include/gtk3-unicode-3.3 -isystem /usr/local/include/wx-3.3 -pthread -g -std=gnu++14 -MD -MT CMakeFiles/FirstC.dir/cMotor.cpp.o -MF CMakeFiles/FirstC.dir/cMotor.cpp.o.d -o CMakeFiles/FirstC.dir/cMotor.cpp.o -c /home/leandro/Desktop/Biblioteca-Motora/cMotor.cpp
In file included from /home/leandro/Desktop/Biblioteca-Motora/cMotor.h:21,
from /home/leandro/Desktop/Biblioteca-Motora/cMotor.cpp:1:
/home/leandro/Desktop/Biblioteca-Motora/cDataBase.h:18:21: error: ‘filesystem’ is not a namespace-name; did you mean ‘system’?
18 | namespace fs = std::filesystem;
| ^~~~~~~~~~
| system
/home/leandro/Desktop/Biblioteca-Motora/cMotor.cpp: In member function ‘bool cMotor::InsertAndCheck(sqlite3_stmt*, sqlite3*)’:
/home/leandro/Desktop/Biblioteca-Motora/cMotor.cpp:437:165: error: use of deleted function ‘wxMessageDialog::wxMessageDialog(wxMessageDialog&&)’
437 | wxMessageDialog dlg = wxMessageDialog(this, _("Motor inserido com sucesso. Dejesa adicionar outro?"), _("Inserção concluída"), wxYES_NO | wxICON_INFORMATION);
| ^
In file included from /usr/local/include/wx-3.3/wx/msgdlg.h:307,
from /usr/local/include/wx-3.3/wx/wx.h:66,
from /home/leandro/Desktop/Biblioteca-Motora/cMotor.h:9,
from /home/leandro/Desktop/Biblioteca-Motora/cMotor.cpp:1:
/usr/local/include/wx-3.3/wx/gtk/msgdlg.h:14:24: note: ‘wxMessageDialog::wxMessageDialog(wxMessageDialog&&)’ is implicitly deleted because the default definition would be ill-formed:
14 | class WXDLLIMPEXP_CORE wxMessageDialog : public wxMessageDialogBase
| ^~~~~~~~~~~~~~~
/usr/local/include/wx-3.3/wx/gtk/msgdlg.h:14:24: error: use of deleted function ‘wxMessageDialogBase::wxMessageDialogBase(const wxMessageDialogBase&)’
In file included from /usr/local/include/wx-3.3/wx/wxprec.h:12,
from /home/leandro/Desktop/Biblioteca-Motora/cMotor.h:2,
from /home/leandro/Desktop/Biblioteca-Motora/cMotor.cpp:1:
/usr/local/include/wx-3.3/wx/msgdlg.h:292:5: note: declared here
292 | wxDECLARE_NO_COPY_CLASS(wxMessageDialogBase);
| ^~~~~~~~~~~~~~~~~~~~~~~
/home/leandro/Desktop/Biblioteca-Motora/cMotor.cpp: In member function ‘void cMotor::EditMotor()’:
/home/leandro/Desktop/Biblioteca-Motora/cMotor.cpp:678:129: error: use of deleted function ‘wxMessageDialog::wxMessageDialog(wxMessageDialog&&)’
678 | wxMessageDialog dlg = wxMessageDialog(this, wxString::Format("%s.", sqlite3_errmsg(db)), _("Erro"), wxICON_ERROR);
| ^
/home/leandro/Desktop/Biblioteca-Motora/cMotor.cpp:683:126: error: use of deleted function ‘wxMessageDialog::wxMessageDialog(wxMessageDialog&&)’
683 | wxMessageDialog dlg = wxMessageDialog(this, _("Motor editado com sucesso."), _("Sucesso"), wxICON_INFORMATION);
| ^
/home/leandro/Desktop/Biblioteca-Motora/cMotor.cpp: In member function ‘void cMotor::TellErrorOnData()’:
/home/leandro/Desktop/Biblioteca-Motora/cMotor.cpp:695:32: error: use of deleted function ‘wxMessageDialog::wxMessageDialog(wxMessageDialog&&)’
695 | _("Erro"), wxICON_ERROR);
| ^
/home/leandro/Desktop/Biblioteca-Motora/cMotor.cpp: In member function ‘void cMotor::TellUnkownError()’:
/home/leandro/Desktop/Biblioteca-Motora/cMotor.cpp:703:32: error: use of deleted function ‘wxMessageDialog::wxMessageDialog(wxMessageDialog&&)’
703 | _("Erro"), wxICON_ERROR);
| ^
[4/5] Building CXX object CMakeFiles/FirstC.dir/cMain.cpp.o
FAILED: CMakeFiles/FirstC.dir/cMain.cpp.o
/usr/bin/c++ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/home/leandro/Desktop/Biblioteca-Motora/. -I/home/leandro/Desktop/Biblioteca-Motora/sqlite -isystem /usr/local/lib/wx/include/gtk3-unicode-3.3 -isystem /usr/local/include/wx-3.3 -pthread -g -std=gnu++14 -MD -MT CMakeFiles/FirstC.dir/cMain.cpp.o -MF CMakeFiles/FirstC.dir/cMain.cpp.o.d -o CMakeFiles/FirstC.dir/cMain.cpp.o -c /home/leandro/Desktop/Biblioteca-Motora/cMain.cpp
In file included from /home/leandro/Desktop/Biblioteca-Motora/cMotor.h:21,
from /home/leandro/Desktop/Biblioteca-Motora/cMain.h:14,
from /home/leandro/Desktop/Biblioteca-Motora/cMain.cpp:1:
/home/leandro/Desktop/Biblioteca-Motora/cDataBase.h:18:21: error: ‘filesystem’ is not a namespace-name; did you mean ‘system’?
18 | namespace fs = std::filesystem;
| ^~~~~~~~~~
| system
/home/leandro/Desktop/Biblioteca-Motora/cMain.cpp: In constructor ‘cMain::cMain(cDataBase*)’:
/home/leandro/Desktop/Biblioteca-Motora/cMain.cpp:30:22: error: ‘fs’ has not been declared
30 | log->LogText(fs::current_path().string());
| ^~
ninja: build stopped: subcommand failed.
My CMakeLists.txt is like this:
cmake_minimum_required(VERSION 3.23)
project(Biblioteca_Motora)
set(CMAKE_CXX_STANDARD 14)
include_directories(.)
include_directories(sqlite)
set(wxWidgets_ROOT_DIR /usr/local/include/wx-3.3)
set(wxWidgets_CONFIGURATION mswu)
find_package(wxWidgets COMPONENTS core base std REQUIRED)
include(${wxWidgets_USE_FILE})
set(SOURCE_FILES cApp.cpp cMain.cpp cMotor.cpp cImageViewer.cpp cDataBase.cpp cLog.cpp sqlite/sqlite3.o)
add_executable(FirstC ${SOURCE_FILES})
target_link_libraries(FirstC ${wxWidgets_LIBRARIES})
And for some reason, CLion isn't finding the std::filesystem library...
Thank you.
Related
I want to compile a CMake project using SDL2 and SDL_ttf library.
I copied "SDL_ttf.c" & "SDL_ttf.h" into my src folder.
(EDIT: removed it, see comments)
I also added this to my CMakeLists.txt:
include_directories(${SDL2_TTF_INCLUDE_DIR})
freetype2 is also installed
but i get the error after calling make
src/SDL_ttf.c:28:10: fatal error: ft2build.h: No such file or directory
28 | #include <ft2build.h>
How do i properly install SDL_ttf to my system?
(https://github.com/libsdl-org/SDL_ttf/blob/main/CMakeLists.txt)
EDIT:
my CMakeLists.txt:
cmake_minimum_required(VERSION 3.7)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_definitions(-std=c++17)
set(CXX_FLAGS "-Wall")
set(CMAKE_CXX_FLAGS, "${CXX_FLAGS}")
project(SDL2Test)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
find_package(SDL2 REQUIRED)
find_package(SDL2_ttf REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS} src)
include_directories(${SDL2_TTF_INCLUDE_DIR})
add_executable(Zokoban src/main.cpp src/game.cpp src/controller.cpp src/renderer.cpp src/hero.cpp src/level.cpp)
string(STRIP ${SDL2_LIBRARIES} SDL2_LIBRARIES)
target_link_libraries(Zokoban ${SDL2_LIBRARIES} ${SDL2_TTF_INCLUDE_DIR})
EDIT2:
after sudo make install (SDL_ttf source) and removing the SDL-source files from my repo:
[ 57%] Building CXX object CMakeFiles/Zokoban.dir/src/renderer.cpp.o
/07_Capstone/Zokoban/src/renderer.cpp:9:10: fatal error: SDL_ttf.h: No such file or directory
9 | #include <SDL_ttf.h>
EDIT3
On another machine (debian11) i couldn't even compile the SDL_ttf - source
19:46 $
✔ ~/ThirdParty/SDL_ttf/build [main|✚ 3…1]
19:46 $ make
/bin/bash ./libtool --tag=CC --mode=compile gcc -DPACKAGE_NAME=\"SDL2_ttf\" -DPACKAGE_TARNAME=\"SDL2_ttf\" -DPACKAGE_VERSION=\"2.21.0\" -DPACKAGE_STRING=\"SDL2_ttf\ 2.21.0\" -DPACKAGE_BUGREPORT=\"https://github.com/libsdl-org/SDL_ttf/issues\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DSDL_BUILD_MAJOR_VERSION=2 -DSDL_BUILD_MINOR_VERSION=21 -DSDL_BUILD_MICRO_VERSION=0 -DPACKAGE=\"SDL2_ttf\" -DVERSION=\"2.21.0\" -DTTF_USE_HARFBUZZ=1 -DHAVE_CXX11=1 -DALIGNOF_STRUCT_CHAR__=1 -I. -I.. -I../external/freetype/include -DFT2_BUILD_LIBRARY -DFT_PUBLIC_FUNCTION_ATTRIBUTE= -I../external/harfbuzz -I../external/harfbuzz/src -DHAVE_CONFIG_H -DFT_CONFIG_OPTION_USE_HARFBUZZ -g -O2 -D_REENTRANT -I/usr/include/SDL2 -Wall -fvisibility=hidden -DHAVE_OPENGL -MT libSDL2_ttf_la-SDL_ttf.lo -MD -MP -MF .deps/libSDL2_ttf_la-SDL_ttf.Tpo -c -o libSDL2_ttf_la-SDL_ttf.lo `test -f 'SDL_ttf.c' || echo '../'`SDL_ttf.c
libtool: compile: gcc -DPACKAGE_NAME=\"SDL2_ttf\" -DPACKAGE_TARNAME=\"SDL2_ttf\" -DPACKAGE_VERSION=\"2.21.0\" "-DPACKAGE_STRING=\"SDL2_ttf 2.21.0\"" -DPACKAGE_BUGREPORT=\"https://github.com/libsdl-org/SDL_ttf/issues\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DSDL_BUILD_MAJOR_VERSION=2 -DSDL_BUILD_MINOR_VERSION=21 -DSDL_BUILD_MICRO_VERSION=0 -DPACKAGE=\"SDL2_ttf\" -DVERSION=\"2.21.0\" -DTTF_USE_HARFBUZZ=1 -DHAVE_CXX11=1 -DALIGNOF_STRUCT_CHAR__=1 -I. -I.. -I../external/freetype/include -DFT2_BUILD_LIBRARY -DFT_PUBLIC_FUNCTION_ATTRIBUTE= -I../external/harfbuzz -I../external/harfbuzz/src -DHAVE_CONFIG_H -DFT_CONFIG_OPTION_USE_HARFBUZZ -g -O2 -D_REENTRANT -I/usr/include/SDL2 -Wall -fvisibility=hidden -DHAVE_OPENGL -MT libSDL2_ttf_la-SDL_ttf.lo -MD -MP -MF .deps/libSDL2_ttf_la-SDL_ttf.Tpo -c ../SDL_ttf.c -fPIC -DPIC -o .libs/libSDL2_ttf_la-SDL_ttf.o
../SDL_ttf.c:28:10: fatal error: ft2build.h: No such file or directory
28 | #include <ft2build.h>
| ^~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:1539: libSDL2_ttf_la-SDL_ttf.lo] Error 1
.. although ft2build.h is obviously installed:
ls /usr/include/freetype2/
freetype ft2build.h
EDIT4:
I downloaded from https://github.com/libsdl-org/SDL_ttf/releases "SDL2_ttf-2.20.0.tar.gz". And could configure, make and sudo make install SDL_ttf.
... but make my project is still not possible
18:03 $ make
[ 14%] Building CXX object CMakeFiles/Zokoban.dir/src/main.cpp.o
[ 28%] Building CXX object CMakeFiles/Zokoban.dir/src/game.cpp.o
[ 42%] Building CXX object CMakeFiles/Zokoban.dir/src/controller.cpp.o
[ 57%] Building CXX object CMakeFiles/Zokoban.dir/src/renderer.cpp.o
/home/Zokoban/src/renderer.cpp:9:10: fatal error: SDL_ttf.h: No such file or directory
9 | #include <SDL_ttf.h>
| ^~~~~~~~~~~
When i tried it with the released sourcecode i get still the error.
~/learning/ThirdParty/SDL_ttf-release-2.20.0/build$ make
depbase=`echo showfont.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
gcc -DPACKAGE_NAME=\"SDL2_ttf\" -DPACKAGE_TARNAME=\"SDL2_ttf\" -DPACKAGE_VERSION=\"2.20.0\" -DPACKAGE_STRING=\"SDL2_ttf\ 2.20.0\" -DPACKAGE_BUGREPORT=\"https://github.com/libsdl-org/SDL_ttf/issues\" -DPACKAGE_URL=\"\" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DSDL_BUILD_MAJOR_VERSION=2 -DSDL_BUILD_MINOR_VERSION=20 -DSDL_BUILD_MICRO_VERSION=0 -DPACKAGE=\"SDL2_ttf\" -DVERSION=\"2.20.0\" -DTTF_USE_HARFBUZZ=1 -DHAVE_CXX11=1 -DALIGNOF_STRUCT_CHAR__=1 -I. -I.. -g -O2 -D_REENTRANT -I/usr/include/SDL2 -Wall -fvisibility=hidden -DHAVE_OPENGL -MT showfont.o -MD -MP -MF $depbase.Tpo -c -o showfont.o ../showfont.c &&\
mv -f $depbase.Tpo $depbase.Po
/bin/bash ./libtool --tag=CC --mode=compile gcc -DPACKAGE_NAME=\"SDL2_ttf\" -DPACKAGE_TARNAME=\"SDL2_ttf\" -DPACKAGE_VERSION=\"2.20.0\" -DPACKAGE_STRING=\"SDL2_ttf\ 2.20.0\" -DPACKAGE_BUGREPORT=\"https://github.com/libsdl-org/SDL_ttf/issues\" -DPACKAGE_URL=\"\" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DSDL_BUILD_MAJOR_VERSION=2 -DSDL_BUILD_MINOR_VERSION=20 -DSDL_BUILD_MICRO_VERSION=0 -DPACKAGE=\"SDL2_ttf\" -DVERSION=\"2.20.0\" -DTTF_USE_HARFBUZZ=1 -DHAVE_CXX11=1 -DALIGNOF_STRUCT_CHAR__=1 -I. -I.. -I../external/freetype/include -DFT2_BUILD_LIBRARY -DFT_PUBLIC_FUNCTION_ATTRIBUTE= -I../external/harfbuzz -I../external/harfbuzz/src -DHAVE_CONFIG_H -DFT_CONFIG_OPTION_USE_HARFBUZZ -g -O2 -D_REENTRANT -I/usr/include/SDL2 -Wall -fvisibility=hidden -DHAVE_OPENGL -MT libSDL2_ttf_la-SDL_ttf.lo -MD -MP -MF .deps/libSDL2_ttf_la-SDL_ttf.Tpo -c -o libSDL2_ttf_la-SDL_ttf.lo `test -f 'SDL_ttf.c' || echo '../'`SDL_ttf.c
libtool: compile: gcc -DPACKAGE_NAME=\"SDL2_ttf\" -DPACKAGE_TARNAME=\"SDL2_ttf\" -DPACKAGE_VERSION=\"2.20.0\" "-DPACKAGE_STRING=\"SDL2_ttf 2.20.0\"" -DPACKAGE_BUGREPORT=\"https://github.com/libsdl-org/SDL_ttf/issues\" -DPACKAGE_URL=\"\" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DSDL_BUILD_MAJOR_VERSION=2 -DSDL_BUILD_MINOR_VERSION=20 -DSDL_BUILD_MICRO_VERSION=0 -DPACKAGE=\"SDL2_ttf\" -DVERSION=\"2.20.0\" -DTTF_USE_HARFBUZZ=1 -DHAVE_CXX11=1 -DALIGNOF_STRUCT_CHAR__=1 -I. -I.. -I../external/freetype/include -DFT2_BUILD_LIBRARY -DFT_PUBLIC_FUNCTION_ATTRIBUTE= -I../external/harfbuzz -I../external/harfbuzz/src -DHAVE_CONFIG_H -DFT_CONFIG_OPTION_USE_HARFBUZZ -g -O2 -D_REENTRANT -I/usr/include/SDL2 -Wall -fvisibility=hidden -DHAVE_OPENGL -MT libSDL2_ttf_la-SDL_ttf.lo -MD -MP -MF .deps/libSDL2_ttf_la-SDL_ttf.Tpo -c ../SDL_ttf.c -fPIC -DPIC -o .libs/libSDL2_ttf_la-SDL_ttf.o
../SDL_ttf.c:28:10: fatal error: ft2build.h: No such file or directory
28 | #include <ft2build.h>
| ^~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:1536: libSDL2_ttf_la-SDL_ttf.lo] Error 1
My ideas run out :(
my project need cross compile for arm aarch64 on ubuntu x86_64, but failed at configure stage, below is log
log
# Execution platform: //platforms:linux_gcc9_aarch64
SUBCOMMAND: # #boost//:filesystem [action 'Linking external/boost/libfilesystem.so', configuration: fc89852de14da3c51e8226c7c5e3087929e4f56710d05ed9ab86ed21b8eb16d4, execution platform: //platforms:linux_gcc9_aarch64]
(cd /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo && \
exec env - \
PATH=/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin:/root/src/go/bin:/usr/local/jdk-11.0.15/bin:/root/.ft:/data/.cache/npm/global/bin \
PWD=/proc/self/cwd \
external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc -shared -o bazel-out/k8-fastbuild/bin/external/boost/libfilesystem.so bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/codecvt_error_category.o bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/directory.o bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/exception.o bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/operations.o bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/path.o bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/path_traits.o bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/portability.o bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/unique_path.o bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/utf8_codecvt_facet.o bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/windows_file_codecvt.o -Wl,-S -lstdc++ -lm -Wl,-no-as-needed -Wl,-z,relro,-z,now -Wall -pass-exit-codes '-fuse-ld=gold')
# Configuration: fc89852de14da3c51e8226c7c5e3087929e4f56710d05ed9ab86ed21b8eb16d4
# Execution platform: //platforms:linux_gcc9_aarch64
ERROR: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/external/rules_foreign_cc/toolchains/BUILD.bazel:130:10: BootstrapGNUMake external/rules_foreign_cc/toolchains/make failed: (Exit 1): bash failed: error executing command
(cd /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo && \
exec env - \
PATH=/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin:/root/src/go/bin:/usr/local/jdk-11.0.15/bin:/root/.ft:/data/.cache/npm/global/bin \
/bin/bash -c bazel-out/k8-opt-exec-277332AD/bin/external/rules_foreign_cc/toolchains/make_tool_foreign_cc/wrapper_build_script.sh)
# Configuration: 920514b75167e08aaf5b08b6fc5ff1721a7e3be841d2c442cd3624a15e568e52
# Execution platform: //platforms:linux_gcc9_aarch64
rules_foreign_cc: Build failed!
rules_foreign_cc: Keeping temp build directory and dependencies directory for debug.
rules_foreign_cc: Please note that the directories inside a sandbox are still cleaned unless you specify --sandbox_debug Bazel command line flag.
rules_foreign_cc: Printing build logs:
_____ BEGIN BUILD LOGS _____
+ AR=/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc-ar
+ ARFLAGS=rcsD
+ CC=/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc
+ CFLAGS='-fPIC -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -march=armv8-a -g0 -O3 -DNDEBUG -D_FORTIFY_SOURCE=2 -ffunction-sections -fdata-sections -funsafe-math-optimizations -ftree-vectorize -std=c99 -no-canonical-prefixes -fno-canonical-system-headers -Wno-builtin-macro-redefined -D__DATE__=redacted -D__TIMESTAMP__=redacted -D__TIME__=redacted'
+ LD=/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc
+ LDFLAGS='-lstdc++ -lm -Wl,-no-as-needed -Wl,-z,relro,-z,now -Wall -pass-exit-codes -fuse-ld=gold -Wl,--gc-sections'
+ ./configure --without-guile --with-guile=no --disable-dependency-tracking --prefix=/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-opt-exec-277332AD/bin/external/rules_foreign_cc/toolchains/make
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports the include directive... yes (GNU style)
checking for gcc... /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-opt-exec-277332AD/bin/external/rules_foreign_cc/toolchains/make.build_tmpdir':
config.log
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by gperftools configure 2.9.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/com_github_gperftools_gperftools/configure --prefix=/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-fastbuild/bin/external/com_github_gperftools_gperftools/gperftools_build.build_tmpdir/gperftools_build --enable-shared=no --enable-frame-pointers --disable-libunwind
## --------- ##
## Platform. ##
## --------- ##
hostname = ubuntu
uname -m = x86_64
uname -r = 5.4.0-109-generic
uname -s = Linux
uname -v = #123-Ubuntu SMP Fri Apr 8 09:10:54 UTC 2022
/usr/bin/uname -p = unknown
/bin/uname -X = unknown
/bin/arch = unknown
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = unknown
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-fastbuild/bin/external/com_github_gperftools_gperftools/gperftools_build.ext_build_deps/bin
PATH: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo
PATH: /root/.cargo/bin
PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /sbin
PATH: /bin
PATH: /usr/games
PATH: /usr/local/games
PATH: /snap/bin
PATH: /usr/local/go/bin
PATH: /root/src/go/bin
PATH: /usr/local/jdk-11.0.15/bin
PATH: /root/.ft
PATH: /data/.cache/npm/global/bin
PATH: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-fastbuild/bin/external/com_github_gperftools_gperftools/gperftools_build.ext_build_deps/bin/toolchains
## ----------- ##
## Core tests. ##
## ----------- ##
configure:2617: checking build system type
configure:2631: result: x86_64-pc-linux-gnu
configure:2651: checking host system type
configure:2664: result: x86_64-pc-linux-gnu
configure:2700: checking for a BSD-compatible install
configure:2768: result: /usr/bin/install -c
configure:2779: checking whether build environment is sane
configure:2834: result: yes
configure:2978: checking for a thread-safe mkdir -p
configure:3017: result: /bin/mkdir -p
configure:3024: checking for gawk
configure:3040: found /usr/bin/gawk
configure:3051: result: gawk
configure:3062: checking whether /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/rules_foreign_cc/toolchains/make/bin/make sets $(MAKE)
configure:3084: result: yes
configure:3113: checking whether /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/rules_foreign_cc/toolchains/make/bin/make supports nested variables
configure:3130: result: yes
configure:3260: checking whether to enable maintainer-specific portions of Makefiles
configure:3269: result: no
configure:3296: checking for git
configure:3314: found /usr/local/bin/git
configure:3327: result: /usr/local/bin/git
configure:3400: checking whether /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/rules_foreign_cc/toolchains/make/bin/make supports the include directive
configure:3415: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/rules_foreign_cc/toolchains/make/bin/make -f confmf.GNU && cat confinc.out
this is the am__doit target
configure:3418: $? = 0
configure:3437: result: yes (GNU style)
configure:3507: checking for gcc
configure:3534: result: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc
configure:3763: checking for C compiler version
configure:3772: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc --version >&5
aarch64-none-linux-gnu-gcc (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)) 9.2.1 20191025
Copyright (C) 2019 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.
configure:3783: $? = 0
configure:3772: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc -v >&5
Using built-in specs.
COLLECT_GCC=/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/external/gcc9_arm_aarch64/bin/../libexec/gcc/aarch64-none-linux-gnu/9.2.1/lto-wrapper
Target: aarch64-none-linux-gnu
Configured with: /tmp/dgboter/bbs/rhev-vm2--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-linux-gnu/build/src/gcc/configure --target=aarch64-none-linux-gnu --prefix= --with-sysroot=/aarch64-none-linux-gnu/libc --with-build-sysroot=/tmp/dgboter/bbs/rhev-vm2--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-linux-gnu/build/build-aarch64-none-linux-gnu/install//aarch64-none-linux-gnu/libc --with-bugurl=https://bugs.linaro.org/ --enable-gnu-indirect-function --enable-shared --disable-libssp --disable-libmudflap --enable-checking=release --enable-languages=c,c++,fortran --with-gmp=/tmp/dgboter/bbs/rhev-vm2--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-linux-gnu/build/build-aarch64-none-linux-gnu/host-tools --with-mpfr=/tmp/dgboter/bbs/rhev-vm2--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-linux-gnu/build/build-aarch64-none-linux-gnu/host-tools --with-mpc=/tmp/dgboter/bbs/rhev-vm2--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-linux-gnu/build/build-aarch64-none-linux-gnu/host-tools --with-isl=/tmp/dgboter/bbs/rhev-vm2--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-linux-gnu/build/build-aarch64-none-linux-gnu/host-tools --enable-fix-cortex-a53-843419 --with-pkgversion='GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)'
Thread model: posix
gcc version 9.2.1 20191025 (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10))
configure:3783: $? = 0
configure:3772: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc -V >&5
aarch64-none-linux-gnu-gcc: error: unrecognized command line option '-V'
aarch64-none-linux-gnu-gcc: fatal error: no input files
compilation terminated.
configure:3783: $? = 1
configure:3772: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc -qversion >&5
aarch64-none-linux-gnu-gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
aarch64-none-linux-gnu-gcc: fatal error: no input files
compilation terminated.
configure:3783: $? = 1
configure:3803: checking whether the C compiler works
configure:3825: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc -fPIC -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -std=c99 -no-canonical-prefixes -fno-canonical-system-headers -Wno-builtin-macro-redefined -D__DATE__=redacted -D__TIMESTAMP__=redacted -D__TIME__=redacted -lstdc++ -lm -Wl,-no-as-needed -Wl,-z,relro,-z,now -Wall -pass-exit-codes -fuse-ld=gold -lpthread conftest.c >&5
configure:3829: $? = 0
configure:3877: result: yes
configure:3880: checking for C compiler default output file name
configure:3882: result: a.out
configure:3888: checking for suffix of executables
configure:3895: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc -o conftest -fPIC -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -std=c99 -no-canonical-prefixes -fno-canonical-system-headers -Wno-builtin-macro-redefined -D__DATE__=redacted -D__TIMESTAMP__=redacted -D__TIME__=redacted -lstdc++ -lm -Wl,-no-as-needed -Wl,-z,relro,-z,now -Wall -pass-exit-codes -fuse-ld=gold -lpthread conftest.c >&5
configure:3899: $? = 0
configure:3921: result:
configure:3943: checking whether we are cross compiling
configure:3951: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc -o conftest -fPIC -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -std=c99 -no-canonical-prefixes -fno-canonical-system-headers -Wno-builtin-macro-redefined -D__DATE__=redacted -D__TIMESTAMP__=redacted -D__TIME__=redacted -lstdc++ -lm -Wl,-no-as-needed -Wl,-z,relro,-z,now -Wall -pass-exit-codes -fuse-ld=gold -lpthread conftest.c >&5
configure:3955: $? = 0
configure:3962: ./conftest
/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/com_github_gperftools_gperftools/configure: line 3964: ./conftest: cannot execute binary file: Exec format error
configure:3966: $? = 126
configure:3973: error: in `/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-fastbuild/bin/external/com_github_gperftools_gperftools/gperftools_build.build_tmpdir':
configure:3975: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
bazel toolchain configuration:
toolchain:
http_archive(
name = "gcc9_arm_aarch64",
build_file = "#bazel_build_file_repo//bazel:gcc_arm_aarch64.BUILD",
sha256 = "8dfe681531f0bd04fb9c53cf3c0a3368c616aa85d48938eebe2b516376e06a66",
strip_prefix = "gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu",
#urls = ["https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz"],
urls = ["file:///root/src/cpp/toolchains/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz"],
)
platform config
constraint_setting(name = "gcc_version")
constraint_value(
name = "gcc_9",
constraint_setting = ":gcc_version",
)
constraint_value(
name = "gcc_10",
constraint_setting = ":gcc_version",
)
constraint_value(
name = "gcc_11",
constraint_setting = ":gcc_version",
)
platform(
name = "linux_gcc9_aarch64",
constraint_values = [
"#platforms//cpu:aarch64",
"#platforms//os:linux",
":gcc_9",
],
)
toolchain config
toolchain(
name = "gcc9_arm_aarch64_xcompile_toolchain",
exec_compatible_with = [
"#platforms//cpu:x86_64",
"#platforms//os:linux",
],
target_compatible_with = [
"#platforms//cpu:aarch64",
"#platforms//os:linux",
"//platforms:gcc_9",
],
toolchain = "#gcc9_arm_aarch64//:cc_toolchain",
toolchain_type = "#bazel_tools//tools/cpp:toolchain_type",
)
here is a very tiny demo to reproduce it:
[enter link description here][https://github.com/xiedeacc/bazel_simple_demo.git]
I am trying to build OpenCV tag 4.2 with CUDA 11.1 in an RHEL 7 docker image and are running into issues.
First issue/warning is this:
THRUST_COMPILER_DEPRECATION(C++14, pass -std=c++14 to your compiler);
Which can be resolved by removing --std=c++11 from cmake/OpenCVDetectCUDA.cmake:265.
Alright, simple enough to handle that warning. Although it would have been better to change it using a cmake option/define. The compile errors for gpu_mat.cu are there with or without the above change.
Then main problem is the build errors that are happening for gpu_mat.cu. Here is my current CMake line. I have tried a bunch of different options and at this point I'm just throwing everything and kitchen sink at it.
cmake ../ \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DENABLE_CXX11=OFF \ # I have tried it set to ON \
-DCMAKE_CXX_FLAGS="-std=c++14" \ # and without this line.
-DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules/ \
-DWITH_EIGEN=OFF \
-DBUILD_TESTS=OFF \
-DBUILD_PERF_TESTS=OFF \
-DOPENCV_ENABLE_NONFREE:BOOL=ON \
-DWITH_CUDA:BOOL=ON \
-DCMAKE_PREFIX_PATH=/usr/local/cuda-11.1 \
-DCUDA_ARCH_BIN="52 60 61 70 75 80 86" \
-DCUDA_SEPARABLE_COMPILATION=ON \
-DCUDA_VERBOSE_BUILD=ON \
-DCUDA_NVCC_FLAGS="--std=c++14" \ # even passing this didn't resolve THRUST warning
-DCUDA_FAST_MATH=ON \
-DCUDA_PROPAGATE_HOST_FLAGS=OFF \
-DCUDA_BUILD_CUBIN=ON \
-DCUDA_HOST_COMPILER=/opt/rh/devtoolset-8/root/usr/bin/c++
Here is the VERBOSE output for gpu_mat.cu build:
[ 26%] Building NVCC (Device) object modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o
cd /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda && /usr/bin/cmake -E make_directory /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/.
cd /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda && /usr/bin/cmake -D verbose:BOOL=ON -D build_configuration:STRING=Release -D generated_file:STRING=/opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o -D generated_cubin_file:STRING=/opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o.cubin.txt -P /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.Release.cmake
-- Removing /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o
/usr/bin/cmake -E rm -f /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o
-- Generating dependency file: /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.NVCC-depend
/usr/local/cuda-11.1/bin/nvcc -M -D__CUDACC__ /opt/tmp/opencv/modules/core/src/cuda/gpu_mat.cu -o /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.NVCC-depend -ccbin /opt/rh/devtoolset-8/root/usr/bin/c++ -m64 -D__OPENCV_BUILD=1 -D_USE_MATH_DEFINES -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -DOPENCV_WITH_ITT=1 --std=c++14 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -D_FORCE_INLINES --use_fast_math -Xcompiler -DCVAPI_EXPORTS -Xcompiler -fPIC -DNVCC -I/usr/local/cuda-11.1/include -I/opt/tmp/opencv/build/3rdparty/ippicv/ippicv_lnx/icv/include -I/opt/tmp/opencv/build/3rdparty/ippicv/ippicv_lnx/iw/include -I/opt/tmp/opencv/build -I/opt/tmp/opencv/modules/core/include -I/opt/tmp/opencv/build/modules/core -I/opt/tmp/opencv_contrib/modules/cudev/include -I/opt/tmp/opencv/3rdparty/include/opencl/1.2 -I/opt/tmp/opencv/3rdparty/ittnotify/include
-- Generating temporary cmake readable file: /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.depend.tmp
/usr/bin/cmake -D input_file:FILEPATH=/opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.NVCC-depend -D output_file:FILEPATH=/opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.depend.tmp -D verbose=ON -P /usr/share/cmake-3.18/Modules/FindCUDA/make2cmake.cmake
-- Copy if different /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.depend.tmp to /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.depend
/usr/bin/cmake -E copy_if_different /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.depend.tmp /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.depend
-- Removing /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.depend.tmp and /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.NVCC-depend
/usr/bin/cmake -E rm -f /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.depend.tmp /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.NVCC-depend
-- Generating /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o
/usr/local/cuda-11.1/bin/nvcc /opt/tmp/opencv/modules/core/src/cuda/gpu_mat.cu -dc -o /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o -ccbin /opt/rh/devtoolset-8/root/usr/bin/c++ -m64 -D__OPENCV_BUILD=1 -D_USE_MATH_DEFINES -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -DOPENCV_WITH_ITT=1 --std=c++14 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -D_FORCE_INLINES --use_fast_math -Xcompiler -DCVAPI_EXPORTS -Xcompiler -fPIC -DNVCC -I/usr/local/cuda-11.1/include -I/opt/tmp/opencv/build/3rdparty/ippicv/ippicv_lnx/icv/include -I/opt/tmp/opencv/build/3rdparty/ippicv/ippicv_lnx/iw/include -I/opt/tmp/opencv/build -I/opt/tmp/opencv/modules/core/include -I/opt/tmp/opencv/build/modules/core -I/opt/tmp/opencv_contrib/modules/cudev/include -I/opt/tmp/opencv/3rdparty/include/opencl/1.2 -I/opt/tmp/opencv/3rdparty/ittnotify/include
And a snippet of the errors that immedately follow:
/opt/rh/devtoolset-8/root/usr/include/c++/8/bits/functional_hash.h: In member function 'std::size_t std::hash<float>::operator()(float) const':
/opt/rh/devtoolset-8/root/usr/include/c++/8/bits/functional_hash.h:232:22: error: expected ')' before numeric constant
return __val != 0.0f ? std::_Hash_impl::hash(__val) : 0;
~ ^~~
)
/opt/rh/devtoolset-8/root/usr/include/c++/8/bits/functional_hash.h:232:15: error: invalid operands of types 'float' and 'double(const char*) throw ()' {aka 'double(const char*)'} to binary 'operator!='
return __val != 0.0f ? std::_Hash_impl::hash(__val) : 0;
~~~~~~^~~~~~~~~~
/opt/rh/devtoolset-8/root/usr/include/c++/8/bits/functional_hash.h:232:64: error: expected ')' before ';' token
return __val != 0.0f ? std::_Hash_impl::hash(__val) : 0;
~ ^
)
/opt/rh/devtoolset-8/root/usr/include/c++/8/bits/functional_hash.h: In member function 'std::size_t std::hash<double>::operator()(double) const':
/opt/rh/devtoolset-8/root/usr/include/c++/8/bits/functional_hash.h:244:22: error: expected ')' before numeric constant
return __val != 0.0 ? std::_Hash_impl::hash(__val) : 0;
~ ^~
)
/opt/rh/devtoolset-8/root/usr/include/c++/8/bits/functional_hash.h:244:15: error: invalid operands of types 'double' and 'double(const char*) throw ()' {aka 'double(const char*)'} to binary 'operator!='
return __val != 0.0 ? std::_Hash_impl::hash(__val) : 0;
.................................
~~~
/opt/tmp/opencv/modules/core/src/cuda/gpu_mat.cu:382:4: note: to match this '('
if (value[0] == 0.0 && value[1] == 0.0 && value[2] == 0.0 && value[3] == 0.0)
^
/opt/tmp/opencv/modules/core/src/cuda/gpu_mat.cu:415:14: error: 'func_t' does not name a type; did you mean 'fpos_t'?
static const func_t funcs[7][4] =
^~~~~~
fpos_t
/opt/tmp/opencv/modules/core/src/cuda/gpu_mat.cu:426:3: error: 'funcs' was not declared in this scope
funcs[depth()][channels() - 1](*this, value, stream);
^ ~~~
-- Removing /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o
/usr/bin/cmake -E rm -f /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o
CMake Error at cuda_compile_1_generated_gpu_mat.cu.o.Release.cmake:276 (message):
Error generating file
/opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o
make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/build.make:84: modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o] Error 1
make[2]: Leaving directory '/opt/tmp/opencv/build'
make[1]: *** [CMakeFiles/Makefile2:3852: modules/core/CMakeFiles/opencv_core.dir/all] Error 2
make[1]: Leaving directory '/opt/tmp/opencv/build'
make: *** [Makefile:182: all] Error 2
I am running the build process after enabling devtools
scl enable devtoolset-8 bash # also tried with devtoolset-7
I have searched for these errors, but I guess my google-fu is weak for this. I didn't have these errors/problems when I built OpenCV 4.5.1 w/ CUDA in an Ubuntu 18 Docker image.
So I'm totally missing something and have been working on this for a couple of days. I am just out of ideas of what to do next.
Thanks for any input.
I'm seeing some very similar build errors as you are, so you're not alone! I'm told it has something to do with a recent change to centos 7, which has broken nvcc. Hopefully, it gets fixed soon.
https://gitlab.com/nvidia/container-images/cuda/-/issues/109#note_503061879
There was a reported issue with RHEL/CentOS and has since been resolved.
https://access.redhat.com/errata/RHBA-2021:0439
I'm trying to build this application from source: https://gitlab.com/TheFrozenWatchers/LeagueDisplays
Whenever I try running the make command, it fails with 'gtk/gtk.h' file not found. Is there a known way to install libgtk2.0-dev in Nix (the lack of which I'm assuming is the issue here)?
For reference, I'm using these nix-shell arguments: nix-shell -p xorg.libX11 gtk2. I imagine libgtk2 isn't included in the gtk2 package, but I'm not sure how to actually get the proper headers into the environment for this to work.
Here's a shell.nix you can use:
with import <nixpkgs> {};
stdenv.mkDerivation rec {
name = "league-displays-${version}";
version = "master";
src = ./.;
doCheck = true;
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ gtk2-x11 clang rapidjson ];
preBuild = ''
substituteAllInPlace src/themes_service.h --replace "include/rapidjson/document.h" "rapidjson/document.h"
substituteInPlace Makefile --replace "pkg-config --libs --cflags gtk+-2.0" "pkg-config --libs --cflags gtk+-2.0 RapidJSON"
'';
}
When you enter the shell, instead of make run buildPhase. That way the preBuild step runs and applies some patches.
Even though I've accounted for all known dependencies, the project still doesn't build due to what appears to be some app-specific errors:
build flags: SHELL=/nix/store/mcyvp1s45scjkkhyb1m16aqlsb8wr6hs-bash-interactive-4.4-p23/bin/bash
clang++ -O3 -g -w -I. -I./src/ -Wl,-rpath,. -L./bin/ -std=c++14 -Wall -lX11 -lXt -lcef -pthread -lrt -lz `pkg-config --libs --cflags gtk+-2.0 RapidJSON` -I./thirdparty/ -c src/background_daemon.cc
src/background_daemon.cc:23:9: error: unknown type name 'AppConfig'
AppConfig* cfg = AppConfig::Acquire();
^
src/background_daemon.cc:23:26: error: use of undeclared identifier 'AppConfig'
AppConfig* cfg = AppConfig::Acquire();
^
src/background_daemon.cc:26:9: error: use of undeclared identifier 'AppConfig'
AppConfig::Release();
^
src/background_daemon.cc:71:9: error: unknown type name 'AppConfig'
AppConfig* cfg;
^
src/background_daemon.cc:76:19: error: use of undeclared identifier 'AppConfig'
cfg = AppConfig::Acquire();
^
src/background_daemon.cc:110:37: error: use of undeclared identifier 'fnvHash'
unsigned int hash = fnvHash(wp.c_str());
^
src/background_daemon.cc:133:13: error: use of undeclared identifier 'AppConfig'
AppConfig::Release();
^
7 errors generated.
make: *** [Makefile:37: background_daemon.o] Error 1
I am building a network application with Qt and Protocol Buffer. I have a server, which can be compiled successfully, and a Qt client, which cannot be compiled with Protocol Buffer.
The server is built by running make on the following Makefile
PWD := $(shell pwd)
CXX := g++
LINKER := g++
INCDIRS := -I. -I$(PWD)/lib -I$(PWD)/lib/protobuf-2.6.1/src
LIBDIRS := $(PWD)/lib/protobuf-2.6.1/src/.libs
LIBS := -l protobuf
CXXFLAGS := -std=c++11 -pthread -g #-Wall -Wextra
BUILD_DIR=build
BIN := $(BUILD_DIR)/bin
PROTO := $(shell bash -c "pwd")/lib/protobuf-2.6.1/src/protoc
MODEL_DIR := model
MODEL_BUILD_DIR := build
BIN := $(BUILD_DIR)/bin
MODELS := $(shell bash -c "cd $(MODEL_DIR) && ls *.proto")
MODELS_SRCFILES := $(patsubst %.proto, %.pb.cc, $(MODELS))
MODELS_OBJFILES := $(addprefix $(MODEL_DIR)/$(MODEL_BUILD_DIR)/, $(patsubst %.cc,%.o,$(MODELS_SRCFILES)))
INCDIRS += -I$(MODEL_DIR)/$(MODEL_BUILD_DIR)
SERVER_DIR := server
SERVER_SRCFILES := $(wildcard $(SERVER_DIR)/*.cpp)
SERVER_OBJFILES := $(addprefix $(BIN)/, $(patsubst %.cpp,%.o,$(SERVER_SRCFILES)))
SERVER_BUILD := $(BUILD_DIR)/server
CLIENT_DIR := client
QMAKE := qmake
LIB_DIR := lib
LIB_SRCFILES := $(wildcard $(LIB_DIR)/*.cpp)
LIB_OBJFILES := $(addprefix $(BIN)/, $(patsubst %.cpp,%.o,$(LIB_SRCFILES)))
.PHONY: init_dir clean client model
all: init_dir model $(SERVER_BUILD)
run:
#export LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(LIBDIRS) && ./build/server
run_client:
#export LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(LIBDIRS) && ./build/client
init_dir:
#mkdir -p $(BIN)/$(SERVER_DIR) $(BIN)/$(MODEL_DIR) $(MODEL_DIR)/$(MODEL_BUILD_DIR) $(BIN)/$(LIB_DIR)
model: $(addprefix, $(MODEL_DIR)/, $(MODELS))
#cd $(MODEL_DIR) && \
for model in $(MODELS); do echo proto compiling $$model; \
$(PROTO) -I=. --cpp_out=./$(MODEL_BUILD_DIR) $$model; done && \
cd $(MODEL_BUILD_DIR) && \
for modelcc in $(MODELS_SRCFILES); do echo compiling $$modelcc; $(CXX) $(CXXFLAGS) $(INCDIRS) -c $$modelcc ; done
$(SERVER_BUILD): $(LIB_OBJFILES) $(MODELS_OBJFILES) $(SERVER_OBJFILES)
$(LINKER) $^ -L $(LIBDIRS) $(LIBS) -o $#
$(BIN)/$(SERVER_DIR)/%.o: $(SERVER_DIR)/%.cpp
$(CXX) $(CXXFLAGS) $(INCDIRS) -c $< -o $#
$(BIN)/$(LIB_DIR)/%.o: $(LIB_DIR)/%.cpp
$(CXX) $(CXXFLAGS) $(INCDIRS) -c $< -o $#
client:
#cd $(CLIENT_DIR) && $(QMAKE) && $(MAKE)
clean:
rm -rf $(BUILD_DIR) $(MODEL_DIR)/$(MODEL_BUILD_DIR)/*
The client Qt project uses this .pro:
QT += core gui
CONFIG += c++11
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = client
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp \
../model/build/main.model.pb.cc \
../model/build/guess.model.pb.cc \
../model/build/jack.model.pb.cc \
../model/build/system.model.pb.cc \
changename.cpp
HEADERS += mainwindow.h \
../model/build/main.model.pb.h \
../model/build/guess.model.pb.h \
../model/build/jack.model.pb.h \
../model/build/system.model.pb.h \
FORMS += mainwindow.ui \
DESTDIR=../build
OBJECTS_DIR=../build/bin/client
MOC_DIR=../build/bin/client
unix:!macx: LIBS += -L../lib/protobuf-2.6.1/src/.libs/ -lprotoc
INCLUDEPATH += ../lib/protobuf-2.6.1/src/.libs ../lib ../model/build/
DEPENDPATH += ../lib/protobuf-2.6.1/src/.libs
unix:!macx: PRE_TARGETDEPS += ../lib/protobuf-2.6.1/src/.libs/libprotoc.a
The four protoc generated files, i.e. ../model/build/*.model.pb.h, is generated by make model.
My issue is that running make model alone can successfully compile the protocol buffer implementation files. But including them as SOURCES and compile them with qmake generated Makefile does not work.
The error is as follow:
g++ -c -m64 -pipe -O2 -std=c++0x -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -I. -I../lib/protobuf-2.6.1/src/.libs -I../lib -I../model/build -I/usr/include/qt5 -I/usr/include/qt5/QtWidgets -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtCore -I../build/bin/client -I. -o ../build/bin/client/main.o main.cpp
In file included from mainwindow.h:6:0,
from main.cpp:1:
../model/build/main.model.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
#error This file was generated by a newer version of protoc which is
^
../model/build/main.model.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
#error incompatible with your Protocol Buffer headers. Please update
^
../model/build/main.model.pb.h:14:2: error: #error your headers.
#error your headers.
^
In file included from ../model/build/main.model.pb.h:27:0,
from mainwindow.h:6,
from main.cpp:1:
../model/build/jack.model.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
#error This file was generated by a newer version of protoc which is
^
../model/build/jack.model.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
#error incompatible with your Protocol Buffer headers. Please update
^
../model/build/jack.model.pb.h:14:2: error: #error your headers.
#error your headers.
^
In file included from ../model/build/main.model.pb.h:28:0,
from mainwindow.h:6,
from main.cpp:1:
../model/build/system.model.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
#error This file was generated by a newer version of protoc which is
^
../model/build/system.model.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
#error incompatible with your Protocol Buffer headers. Please update
^
../model/build/system.model.pb.h:14:2: error: #error your headers.
#error your headers.
^
In file included from ../model/build/system.model.pb.h:28:0,
from ../model/build/main.model.pb.h:28,
from mainwindow.h:6,
from main.cpp:1:
../model/build/guess.model.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
#error This file was generated by a newer version of protoc which is
^
../model/build/guess.model.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
#error incompatible with your Protocol Buffer headers. Please update
^
../model/build/guess.model.pb.h:14:2: error: #error your headers.
#error your headers.
^
In file included from ../model/build/main.model.pb.h:27:0,
from mainwindow.h:6,
from main.cpp:1:
../model/build/jack.model.pb.h: In member function ‘void BlackJack::Request::clear_command()’:
../model/build/jack.model.pb.h:297:20: error: ‘GetEmptyStringAlreadyInited’ is not a member of ‘google::protobuf::internal’
if (command_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
^
../model/build/jack.model.pb.h: In member function ‘void BlackJack::Request::set_command(const string&)’:
../model/build/jack.model.pb.h:308:20: error: ‘GetEmptyStringAlreadyInited’ is not a member of ‘google::protobuf::internal’
if (command_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
^
../model/build/jack.model.pb.h: In member function ‘void BlackJack::Request::set_command(const char*)’:
../model/build/jack.model.pb.h:316:20: error: ‘GetEmptyStringAlreadyInited’ is not a member of ‘google::protobuf::internal’
if (command_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
^
../model/build/jack.model.pb.h: In member function ‘void BlackJack::Request::set_command(const char*, size_t)’:
../model/build/jack.model.pb.h:324:20: error: ‘GetEmptyStringAlreadyInited’ is not a member of ‘google::protobuf::internal’
if (command_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
^
../model/build/jack.model.pb.h: In member function ‘std::string* BlackJack::Request::mutable_command()’:
../model/build/jack.model.pb.h:332:20: error: ‘GetEmptyStringAlreadyInited’ is not a member of ‘google::protobuf::internal’
if (command_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
^
../model/build/jack.model.pb.h: In member function ‘std::string* BlackJack::Request::release_command()’:
../model/build/jack.model.pb.h:340:20: error: ‘GetEmptyStringAlreadyInited’ is not a member of ‘google::protobuf::internal’
if (command_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
^
../model/build/jack.model.pb.h:344:45: error: ‘GetEmptyStringAlreadyInited’ is not a member of ‘google::protobuf::internal’
command_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
^
../model/build/jack.model.pb.h: In member function ‘void BlackJack::Request::set_allocated_command(std::string*)’:
../model/build/jack.model.pb.h:349:20: error: ‘GetEmptyStringAlreadyInited’ is not a member of ‘google::protobuf::internal’
if (command_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
^
../model/build/jack.model.pb.h:357:45: error: ‘GetEmptyStringAlreadyInited’ is not a member of ‘google::protobuf::internal’
command_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
^
What could be the problem??
Thanks for your help