How can I successfully Build gRPC in C++? - c++

I am trying to build gRPC in C++ by following c++ gRPC installation. My OS is Ubuntu20.4 LTS installed on Raspberry Pi 4.
When I typed this command "make -j"
$ cd grpc
$ mkdir -p cmake/build
$ pushd cmake/build
$ cmake -DgRPC_INSTALL=ON \
-DgRPC_BUILD_TESTS=OFF \
-DCMAKE_INSTALL_PREFIX=$MY_INSTALL_DIR \
../..
$ make -j
this error occurs.
[ 1%] Built target zlibstatic
・
・
[ 97%] Built target mimics_pcre_test
[ 97%] Built target possible_match_test
[ 97%] Built target set_test
[ 97%] Built target regexp_test
[ 97%] Built target search_test
[ 97%] Linking CXX executable bssl
/usr/bin/ld: CMakeFiles/bssl.dir/src/tool/transport_common.cc.o: in function `PrintConnectionInfo(bio_st*, ssl_st const*)':
transport_common.cc:(.text+0xd40): undefined reference to `X509_NAME_print_ex'
/usr/bin/ld: transport_common.cc:(.text+0xd74): undefined reference to `X509_NAME_print_ex'
/usr/bin/ld: libcrypto.a(trust_token.c.o):(.data.rel.ro+0x50): undefined reference to `voprf_exp2_generate_key'
/usr/bin/ld: libcrypto.a(trust_token.c.o):(.data.rel.ro+0x58): undefined reference to `voprf_exp2_client_key_from_bytes'
/usr/bin/ld: libcrypto.a(trust_token.c.o):(.data.rel.ro+0x60): undefined reference to `voprf_exp2_issuer_key_from_bytes'
/usr/bin/ld: libcrypto.a(trust_token.c.o):(.data.rel.ro+0x68): undefined reference to `voprf_exp2_blind'
/usr/bin/ld: libcrypto.a(trust_token.c.o):(.data.rel.ro+0x70): undefined reference to `voprf_exp2_sign'
/usr/bin/ld: libcrypto.a(trust_token.c.o):(.data.rel.ro+0x78): undefined reference to `voprf_exp2_unblind'
/usr/bin/ld: libcrypto.a(trust_token.c.o):(.data.rel.ro+0x80): undefined reference to `voprf_exp2_read'
/usr/bin/ld: libcrypto.a(x509_vfy.c.o): in function `reject_dns_name_in_common_name':
x509_vfy.c:(.text+0x16dc): undefined reference to `ASN1_STRING_to_UTF8'
/usr/bin/ld: libcrypto.a(x_name.c.o): in function `asn1_string_canon':
x_name.c:(.text+0xe94): undefined reference to `ASN1_STRING_to_UTF8'
/usr/bin/ld: libcrypto.a(v3_crld.c.o): in function `print_distpoint':
v3_crld.c:(.text+0x1304): undefined reference to `X509_NAME_print_ex'
/usr/bin/ld: libcrypto.a(v3_utl.c.o): in function `do_check_string':
v3_utl.c:(.text+0x288c): undefined reference to `ASN1_STRING_to_UTF8'
/usr/bin/ld: libcrypto.a(algorithm.c.o): in function `x509_digest_sign_algorithm':
algorithm.c:(.text+0xac): undefined reference to `x509_rsa_ctx_to_pss'
/usr/bin/ld: libcrypto.a(algorithm.c.o): in function `x509_digest_verify_init':
algorithm.c:(.text+0x2c4): undefined reference to `x509_rsa_pss_to_ctx'
/usr/bin/ld: libcrypto.a(v3_alt.c.o): in function `GENERAL_NAME_print':
v3_alt.c:(.text+0x7c4): undefined reference to `X509_NAME_print_ex'
/usr/bin/ld: libcrypto.a(t_x509.c.o): in function `X509_print_ex':
t_x509.c:(.text+0x404): undefined reference to `X509_NAME_print_ex'
/usr/bin/ld: t_x509.c:(.text+0x52c): undefined reference to `X509_NAME_print_ex'
/usr/bin/ld: libcrypto.a(t_x509.c.o): in function `X509_signature_print':
t_x509.c:(.text+0xb7c): undefined reference to `x509_print_rsa_pss_params'
collect2: error: ld returned 1 exit status
make[2]: *** [third_party/boringssl-with-bazel/CMakeFiles/bssl.dir/build.make:339: third_party/boringssl-with-bazel/bssl] Error 1
make[1]: *** [CMakeFiles/Makefile2:4800: third_party/boringssl-with-bazel/CMakeFiles/bssl.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
Please help me to fix this problem.

Can you show what value the gRPC_SSL_PROVIDER variable has? If has module than you just init submodules and build with BoringSSL (see and see). Another option, you can build with OpenSSL, just set -DgRPC_SSL_PROVIDER=package.

Related

Building FLTK Project with CMAKE/CONAN

I'm fairly new to C++ / CMake, but I'd like to create a project with FLTK using CMAKE and CONAN as package manager. I'm using Windows 11, but trying to get it to run under WSL (Ubuntu 20.04). My WSL-version supports GUI applications.
When I install everything without Conan and compile the official "fltk-hello-world" from the command line using fltk-config, everything works okay. However, when I try to set it up using Conan und Cmake I get following errors:
/usr/bin/ld: /home/bfl/.conan/data/fltk/1.3.8/_/_/package/b6898709771003e31b8ea824ee836cf119580bd8/lib/libfltk.a(fl_font.cxx.o): in function `Fl_Font_Descriptor::Fl_Font_Descriptor(char const*, int, int)':
fl_font.cxx:(.text+0x232): undefined reference to `XftFontOpenXlfd'
/usr/bin/ld: fl_font.cxx:(.text+0x47e): undefined reference to `XftFontMatch'
/usr/bin/ld: fl_font.cxx:(.text+0x48f): undefined reference to `XftFontOpenPattern'
/usr/bin/ld: fl_font.cxx:(.text+0x4e1): undefined reference to `XftFontOpen'
/usr/bin/ld: /home/bfl/.conan/data/fltk/1.3.8/_/_/package/b6898709771003e31b8ea824ee836cf119580bd8/lib/libfltk.a(fl_font.cxx.o): in function `Fl_Xlib_Graphics_Driver::width(char const*, int)':
fl_font.cxx:(.text+0x954): undefined reference to `XftTextExtents32'
/usr/bin/ld: /home/bfl/.conan/data/fltk/1.3.8/_/_/package/b6898709771003e31b8ea824ee836cf119580bd8/lib/libfltk.a(fl_font.cxx.o): in function `Fl_Xlib_Graphics_Driver::width(unsigned int)':
fl_font.cxx:(.text+0xa5e): undefined reference to `XftTextExtents32'
/usr/bin/ld: /home/bfl/.conan/data/fltk/1.3.8/_/_/package/b6898709771003e31b8ea824ee836cf119580bd8/lib/libfltk.a(fl_font.cxx.o): in function `Fl_Xlib_Graphics_Driver::text_extents(char const*, int, int&, int&, int&, int&)':
fl_font.cxx:(.text+0xb07): undefined reference to `XftTextExtents32'
/usr/bin/ld: /home/bfl/.conan/data/fltk/1.3.8/_/_/package/b6898709771003e31b8ea824ee836cf119580bd8/lib/libfltk.a(fl_font.cxx.o): in function `Fl_Xlib_Graphics_Driver::draw(char const*, int, int, int)':
fl_font.cxx:(.text+0x1140): undefined reference to `XftDrawChange'
/usr/bin/ld: fl_font.cxx:(.text+0x1176): undefined reference to `XftDrawSetClip'
/usr/bin/ld: fl_font.cxx:(.text+0x1209): undefined reference to `XftDrawString32'
/usr/bin/ld: fl_font.cxx:(.text+0x12d9): undefined reference to `XftDrawCreate'
/usr/bin/ld: /home/bfl/.conan/data/fltk/1.3.8/_/_/package/b6898709771003e31b8ea824ee836cf119580bd8/lib/libfltk.a(fl_font.cxx.o): in function `Fl_Xlib_Graphics_Driver::rtl_draw(char const*, int, int, int)':
fl_font.cxx:(.text+0x149b): undefined reference to `XftTextExtents32'
/usr/bin/ld: fl_font.cxx:(.text+0x14cc): undefined reference to `XftDrawChange'
/usr/bin/ld: fl_font.cxx:(.text+0x1502): undefined reference to `XftDrawSetClip'
/usr/bin/ld: fl_font.cxx:(.text+0x1595): undefined reference to `XftDrawString32'
/usr/bin/ld: fl_font.cxx:(.text+0x15f9): undefined reference to `XftDrawCreate'
/usr/bin/ld: /home/bfl/.conan/data/fltk/1.3.8/_/_/package/b6898709771003e31b8ea824ee836cf119580bd8/lib/libfltk.a(fl_font.cxx.o): in function `fl_destroy_xft_draw(unsigned long)':
fl_font.cxx:(.text+0x10d9): undefined reference to `XftDrawChange'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/hello.dir/build.make:84: bin/hello] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/hello.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
So I assume that i am probably not linking XFT? But I am not sure how to do that, do I need to include the correct name in target-link-libraries? My Cmake-File looks like this:
cmake_minimum_required(VERSION 3.2.3)
project(Hello VERSION 0.1.0)
set(EXECUTABLE_NAME hello)
set(EXE_SOURCES hello.cc)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
add_executable(${EXECUTABLE_NAME} ${EXE_SOURCES})
target_include_directories(hello PUBLIC ${FLTK_INCLUDE_DIRS})
target_link_libraries(hello
${CONAN_LIBS})
I'm grateful for any suggestion.
Thanks,
GB
The conan recipe for fltk does not correctly deal with the cmake system of fltk.
Fltk auto-detects if the system it compiles on has Xft. If it does, then it enables the HAS_XFT variable and compiles some code into the library that uses it.
Conan does not pick up on this and doesn't add Xft to the dependent libraries.
The easiest way around this bug is to manually add the xft dependency.
If you have libXft installed on your system you can simply add an entry of Xft to the target_link_libraries of the target that uses fltk.
Like this:
target_link_libraries(hello ${CONAN_LIBS} Xft)

CMake C++ Project librealsense: undefined reference to OpenGL with CLion

I am trying to integrate librealsense C++ CLion Project on Ubuntu 20.04.
Compiling the Librealsense separately in the terminal works just as expected.
the Project looks like this:
RS_Pipeline
.
├── build
├── main.cpp
├── CMakeLists.txt
└── librealsense // the integrated lib
├── CMakeLists.txt
├── third-party // libs like GLFW and GLAD which are use in the examples
├── examples //
| ├── example.hpp // with class to generate OpenGL Window
└── ...
The CMakeLists.txt in the base Folder looks rather simple:
cmake_minimum_required(VERSION 3.2)
project(RS_Pipeline LANGUAGES CXX C)
set(CMAKE_CXX_STANDARD 11)
set(OpenGL_GL_PREFERENCE LEGACY)
add_executable(RS_Pipeline main.cpp librealsense/examples/example.hpp)
add_subdirectory(librealsense)
target_link_libraries(${PROJECT_NAME} realsense2)
As soon as i try to include the submodul into my CLion Project i get a ton of: main.cpp:(.text+0x23c): undefined reference to glViewport error messages and building my main.cpp in the base dir fails.
somehow the #include <librealsense2/rs.hpp> #include "librealsense/examples/example.hpp"
works fine and even the intellisense finds all the functions.
PLUS: the included examples within the librealsense Library also compile without any problem. (They use exactly the same #include "librealsense/examples/example.hpp".
It looks like, that CLion just dose not link find the right openGL in my own main.cpp resp. if i include it from example.hpp.
====================[ Build | RS_Pipeline | Release ]===========================
/snap/clion/175/bin/cmake/linux/bin/cmake --build /home/lukas/Development/Cpp/RS_Pipeline/cmake-build-release --target RS_Pipeline
[0/1] Re-running CMake...
-- Checking internet connection...
-- Internet connection identified
-- Info: REALSENSE_VERSION_STRING=2.50.0
-- Setting Unix configurations
-- Building libcurl enabled
-- using RS2_USE_V4L2_BACKEND
-- Could NOT find apriltag (missing: APRILTAG_INC APRILTAG_LIB)
-- Unable to find apriltag library, skipping pose-apriltag example
-- Check for updates capability added to realsense-viewer
-- Check for updates capability added to realsense-depth-quality
-- Building with TM2
-- Fetching recommended firmwares:
-- D4XX_FW_VERSION: 5.13.0.50
-- SR3XX_FW_VERSION: 3.26.1.0
-- T26X_FW_VERSION: 0.2.0.951
-- L51X_FW_VERSION: 1.5.8.1
-- L53X_FW_VERSION: 3.5.5.1
-- https://librealsense.intel.com/Releases/RS4xx/FW/D4XX_FW_Image-5.13.0.50.bin
-- Download firmware 0;"returning early; file already exists with expected SHA1 hash" for D4XX_FW_Image-5.13.0.50.bin
-- https://librealsense.intel.com/Releases/SR300/FW/SR3XX_FW_Image-3.26.1.0.bin
-- Download firmware 0;"returning early; file already exists with expected SHA1 hash" for SR3XX_FW_Image-3.26.1.0.bin
-- https://librealsense.intel.com/Releases/TM2/FW/target/0.2.0.951/target-0.2.0.951.mvcmd
-- Download firmware 0;"returning early; file already exists with expected SHA1 hash" for target-0.2.0.951.mvcmd
-- https://librealsense.intel.com/Releases/L5xx/FW/L51X_FW_Image-1.5.8.1.bin
-- Download firmware 0;"returning early; file already exists with expected SHA1 hash" for L51X_FW_Image-1.5.8.1.bin
-- https://librealsense.intel.com/Releases/L5xx/FW/L53X_FW_Image-3.5.5.1.bin
-- Download firmware 0;"returning early; file already exists with expected SHA1 hash" for L53X_FW_Image-3.5.5.1.bin
-- Configuring done
-- Generating done
-- Build files have been written to: /home/lukas/Development/Cpp/RS_Pipeline/cmake-build-release
[1/1] Linking CXX executable RS_Pipeline
FAILED: RS_Pipeline
: && /usr/bin/c++ -O3 -DNDEBUG -rdynamic CMakeFiles/RS_Pipeline.dir/main.cpp.o -o RS_Pipeline -Wl,-rpath,/home/lukas/Development/Cpp/RS_Pipeline/cmake-build-release/librealsense librealsense/librealsense2.so.2.50.0 -lglfw && :
/usr/bin/ld: CMakeFiles/RS_Pipeline.dir/main.cpp.o: in function `set_viewport(rect const&)':
main.cpp:(.text+0x23c): undefined reference to `glViewport'
/usr/bin/ld: main.cpp:(.text+0x241): undefined reference to `glLoadIdentity'
/usr/bin/ld: main.cpp:(.text+0x24b): undefined reference to `glMatrixMode'
/usr/bin/ld: CMakeFiles/RS_Pipeline.dir/main.cpp.o: in function `draw_pointcloud(float, float, glfw_state&, rs2::points&)':
main.cpp:(.text+0x2bb): undefined reference to `glLoadIdentity'
/usr/bin/ld: main.cpp:(.text+0x2c5): undefined reference to `glPushAttrib'
/usr/bin/ld: main.cpp:(.text+0x2e0): undefined reference to `glClearColor'
/usr/bin/ld: main.cpp:(.text+0x2ea): undefined reference to `glClear'
/usr/bin/ld: main.cpp:(.text+0x2f4): undefined reference to `glMatrixMode'
/usr/bin/ld: main.cpp:(.text+0x2f9): undefined reference to `glPushMatrix'
/usr/bin/ld: main.cpp:(.text+0x32a): undefined reference to `gluPerspective'
/usr/bin/ld: main.cpp:(.text+0x334): undefined reference to `glMatrixMode'
/usr/bin/ld: main.cpp:(.text+0x339): undefined reference to `glPushMatrix'
/usr/bin/ld: main.cpp:(.text+0x36c): undefined reference to `gluLookAt'
/usr/bin/ld: main.cpp:(.text+0x394): undefined reference to `glTranslatef'
/usr/bin/ld: main.cpp:(.text+0x3b2): undefined reference to `glRotated'
/usr/bin/ld: main.cpp:(.text+0x3cf): undefined reference to `glRotated'
/usr/bin/ld: main.cpp:(.text+0x3e3): undefined reference to `glTranslatef'
/usr/bin/ld: main.cpp:(.text+0x3f6): undefined reference to `glPointSize'
/usr/bin/ld: main.cpp:(.text+0x400): undefined reference to `glEnable'
/usr/bin/ld: main.cpp:(.text+0x40a): undefined reference to `glEnable'
/usr/bin/ld: main.cpp:(.text+0x417): undefined reference to `glBindTexture'
/usr/bin/ld: main.cpp:(.text+0x437): undefined reference to `glTexParameterfv'
/usr/bin/ld: main.cpp:(.text+0x44b): undefined reference to `glTexParameteri'
/usr/bin/ld: main.cpp:(.text+0x45f): undefined reference to `glTexParameteri'
/usr/bin/ld: main.cpp:(.text+0x466): undefined reference to `glBegin'
/usr/bin/ld: main.cpp:(.text+0x516): undefined reference to `glEnd'
/usr/bin/ld: main.cpp:(.text+0x51b): undefined reference to `glPopMatrix'
/usr/bin/ld: main.cpp:(.text+0x525): undefined reference to `glMatrixMode'
/usr/bin/ld: main.cpp:(.text+0x52a): undefined reference to `glPopMatrix'
/usr/bin/ld: main.cpp:(.text+0x52f): undefined reference to `glPopAttrib'
/usr/bin/ld: main.cpp:(.text+0x558): undefined reference to `glVertex3fv'
/usr/bin/ld: main.cpp:(.text+0x566): undefined reference to `glTexCoord2fv'
/usr/bin/ld: CMakeFiles/RS_Pipeline.dir/main.cpp.o: in function `draw_pointcloud_wrt_world(float, float, glfw_state&, rs2::points&, rs2_pose&, float*, std::vector >&)':
main.cpp:(.text+0x98b): undefined reference to `glLoadIdentity'
/usr/bin/ld: main.cpp:(.text+0x995): undefined reference to `glPushAttrib'
/usr/bin/ld: main.cpp:(.text+0x9b0): undefined reference to `glClearColor'
/usr/bin/ld: main.cpp:(.text+0x9ba): undefined reference to `glClear'
/usr/bin/ld: main.cpp:(.text+0x9c4): undefined reference to `glMatrixMode'
/usr/bin/ld: main.cpp:(.text+0x9c9): undefined reference to `glPushMatrix'
/usr/bin/ld: main.cpp:(.text+0x9fa): undefined reference to `gluPerspective'
/usr/bin/ld: main.cpp:(.text+0xa04): undefined reference to `glMatrixMode'
/usr/bin/ld: main.cpp:(.text+0xa09): undefined reference to `glPushMatrix'
/usr/bin/ld: main.cpp:(.text+0xa2f): undefined reference to `glTranslatef'
/usr/bin/ld: main.cpp:(.text+0xa4a): undefined reference to `glRotated'
/usr/bin/ld: main.cpp:(.text+0xa65): undefined reference to `glRotated'
/usr/bin/ld: main.cpp:(.text+0xa79): undefined reference to `glTranslatef'
/usr/bin/ld: main.cpp:(.text+0xa83): undefined reference to `glEnable'
/usr/bin/ld: main.cpp:(.text+0xa90): undefined reference to `glLineWidth'
/usr/bin/ld: main.cpp:(.text+0xa9a): undefined reference to `glBegin'
/usr/bin/ld: main.cpp:(.text+0xac4): undefined reference to `glColor3f'
/usr/bin/ld: main.cpp:(.text+0xad8): undefined reference to `glVertex3f'
/usr/bin/ld: main.cpp:(.text+0xae2): undefined reference to `glEnd'
/usr/bin/ld: main.cpp:(.text+0xaef): undefined reference to `glLineWidth'
/usr/bin/ld: main.cpp:(.text+0xb02): undefined reference to `glColor3f'
/usr/bin/ld: main.cpp:(.text+0xb2f): undefined reference to `glMultMatrixf'
/usr/bin/ld: main.cpp:(.text+0xb37): undefined reference to `glMultMatrixf'
/usr/bin/ld: main.cpp:(.text+0xb4a): undefined reference to `glPointSize'
/usr/bin/ld: main.cpp:(.text+0xb54): undefined reference to `glEnable'
/usr/bin/ld: main.cpp:(.text+0xb5e): undefined reference to `glEnable'
/usr/bin/ld: main.cpp:(.text+0xb71): undefined reference to `glBindTexture'
/usr/bin/ld: main.cpp:(.text+0xb91): undefined reference to `glTexParameterfv'
/usr/bin/ld: main.cpp:(.text+0xba5): undefined reference to `glTexParameteri'
/usr/bin/ld: main.cpp:(.text+0xbb9): undefined reference to `glTexParameteri'
/usr/bin/ld: main.cpp:(.text+0xbc0): undefined reference to `glBegin'
/usr/bin/ld: main.cpp:(.text+0xc76): undefined reference to `glEnd'
/usr/bin/ld: main.cpp:(.text+0xc7b): undefined reference to `glPopMatrix'
/usr/bin/ld: main.cpp:(.text+0xc85): undefined reference to `glMatrixMode'
/usr/bin/ld: main.cpp:(.text+0xc8a): undefined reference to `glPopMatrix'
/usr/bin/ld: main.cpp:(.text+0xc8f): undefined reference to `glPopAttrib'
/usr/bin/ld: main.cpp:(.text+0xcc0): undefined reference to `glVertex3fv'
/usr/bin/ld: main.cpp:(.text+0xcce): undefined reference to `glTexCoord2fv'
/usr/bin/ld: CMakeFiles/RS_Pipeline.dir/main.cpp.o: in function `set_viewport(rect const&)':
main.cpp:(.text+0x27b): undefined reference to `glOrtho'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
The examples all include this file, while you don't:
find_package(OpenGL REQUIRED)
set(DEPENDENCIES realsense2 glfw ${OPENGL_LIBRARIES})
which makes the realsense2 library depend on GLFW and your OpenGL stack.
Add the following to your CMakeLists.txt:
find_package(OpenGL REQUIRED)
target_link_libraries(${PROJECT_NAME} glfw OpenGL::GL )
#Botje Thanks a lot, that was fast! now it is working with the following CMakeLists:
cmake_minimum_required(VERSION 3.2)
project(RS_Pipeline LANGUAGES CXX C)
set(CMAKE_CXX_STANDARD 11)
set(OpenGL_GL_PREFERENCE LEGACY)
find_package(OpenGL REQUIRED)
add_executable(RS_Pipeline main.cpp librealsense/examples/example.hpp)
add_subdirectory(librealsense)
target_link_libraries(${PROJECT_NAME}
realsense2
glfw OpenGL::GL
glfw OpenGL::GLU
)
looks like this topic can be closed already.

Undefined reference to `proj_context_create' while run PROJ example

I have installed Proj 6.3.1 and I tried to run a Proj example from https://proj.org/development/quickstart.html. I implemented it with CLion on Ubuntu 20.04. And I got many undefined reference errors as follows,
cd "/path_to_the_file/" && g++ transformation.cpp -o transformation && "/path_to_the_file/"transformation
/usr/bin/ld: /tmp/cckO2X58.o: in function `main':
transformation.cpp:(.text+0x1f): undefined reference to `proj_context_create'
/usr/bin/ld: transformation.cpp:(.text+0x42): undefined reference to `proj_create_crs_to_crs'
/usr/bin/ld: transformation.cpp:(.text+0x8a): undefined reference to `proj_normalize_for_visualization'
/usr/bin/ld: transformation.cpp:(.text+0xcb): undefined reference to `proj_destroy'
/usr/bin/ld: transformation.cpp:(.text+0x102): undefined reference to `proj_coord'
/usr/bin/ld: transformation.cpp:(.text+0x14f): undefined reference to `proj_trans'
/usr/bin/ld: transformation.cpp:(.text+0x1c3): undefined reference to `proj_trans'
/usr/bin/ld: transformation.cpp:(.text+0x21c): undefined reference to `proj_destroy'
/usr/bin/ld: transformation.cpp:(.text+0x228): undefined reference to `proj_context_destroy'
collect2: error: ld returned 1 exit status
This problem is similar to https://gis.stackexchange.com/questions/370771/unable-to-run-proj-c-example, but I can't find the solutions accordingly. The <proj.h> header is in my usr/include folder and Clion can detect it automatically. Could anyone help?

QT GStreamer Windows linker problems

I'm trying to compile and run the qml-sink example which is provided inside the gstreamer-good-plugin (QT Example). But currently I get a lot of undefined reference errors during the compile time. It seems that the linker does not link the libraries correctly.
I have checked the list of linked libraries and from my point of view all needed libs are listed.
E.g. gst_object_ref, gst_init, ... are undefined.
My setup:
Windows 10
Qt 5.11
Gstreamer 1.0
Gstremer devel 1.0
Gstreamer plugin good
Installed GStreamer version from here: GStreamer Download => gstreamer-1.0-devel-x86_64-1.14.3.msi and gstreamer-1.0-x86_64-1.14.3.msi
Can anyone please help me, how I can solve this problem?
Errortrace:
"C:\Program Files\CMake\bin\cmake.exe" --build . --target all
"C:\Program Files\CMake\bin\cmake.exe" -HC:\gst-plugins-good-1.14.4\tests\examples\qt\qmlsink -BC:\gst-plugins-good-1.14.4\tests\examples\qt\build-qmlsink-Desktop_Qt_5_11_1_MinGW_32bit-Vorgabe --check-build-system CMakeFiles\Makefile.cmake 0
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_progress_start C:\gst-plugins-good-1.14.4\tests\examples\qt\build-qmlsink-Desktop_Qt_5_11_1_MinGW_32bit-Vorgabe\CMakeFiles C:\gst-plugins-good-1.14.4\tests\examples\qt\build-qmlsink-Desktop_Qt_5_11_1_MinGW_32bit-Vorgabe\CMakeFiles\progress.marks
D:/Qt/Tools/mingw530_32/bin/mingw32-make.exe -f CMakeFiles\Makefile2 all
mingw32-make.exe[1]: Entering directory 'C:/gst-plugins-good-1.14.4/tests/examples/qt/build-qmlsink-Desktop_Qt_5_11_1_MinGW_32bit-Vorgabe'
D:/Qt/Tools/mingw530_32/bin/mingw32-make.exe -f CMakeFiles\qml-example.dir\build.make CMakeFiles/qml-example.dir/depend
mingw32-make.exe[2]: Entering directory 'C:/gst-plugins-good-1.14.4/tests/examples/qt/build-qmlsink-Desktop_Qt_5_11_1_MinGW_32bit-Vorgabe'
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_depends "MinGW Makefiles"
C:\gst-plugins-good-1.14.4\tests\examples\qt\qmlsink C:\gst-plugins-good-1.14.4\tests\examples\qt\qmlsink C:\gst-plugins-good-1.14.4\tests\examples\qt\build-qmlsink-Desktop_Qt_5_11_1_MinGW_32bit-Vorgabe
C:\gst-plugins-good-1.14.4\tests\examples\qt\build-qmlsink-Desktop_Qt_5_11_1_MinGW_32bit-Vorgabe C:\gst-plugins-good-1.14.4\tests\examples\qt\build-qmlsink-Desktop_Qt_5_11_1_MinGW_32bit-Vorgabe\CMakeFiles\qml-example.dir\DependInfo.cmake --color=
mingw32-make.exe[2]: Leaving directory 'C:/gst-plugins-good-1.14.4/tests/examples/qt/build-qmlsink-Desktop_Qt_5_11_1_MinGW_32bit-Vorgabe'
D:/Qt/Tools/mingw530_32/bin/mingw32-make.exe -f CMakeFiles\qml-example.dir\build.make CMakeFiles/qml-example.dir/build
mingw32-make.exe[2]: Entering directory 'C:/gst-plugins-good-1.14.4/tests/examples/qt/build-qmlsink-Desktop_Qt_5_11_1_MinGW_32bit-Vorgabe'
[ 25%] Linking CXX executable qml-example.exe
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_link_script CMakeFiles\qml-example.dir\link.txt --verbose=1
"C:\Program Files\CMake\bin\cmake.exe" -E remove -f CMakeFiles\qml-example.dir/objects.a
D:\Qt\Tools\mingw530_32\bin\ar.exe cr CMakeFiles\qml-example.dir/objects.a #CMakeFiles\qml-example.dir\objects1.rsp
D:\Qt\Tools\mingw530_32\bin\g++.exe -Wl,--whole-archive CMakeFiles\qml-example.dir/objects.a -Wl,--no-whole-archive -o qml-example.exe -Wl,--out-implib,libqml-example.dll.a -Wl,--major-image-version,0,--minor-image-version,0
#CMakeFiles\qml-example.dir\linklibs.rsp
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x2b): undefined reference to `gst_object_ref'
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x87): undefined reference to `gst_object_unref'
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.text+0xa7): undefined reference to `operator delete(void*)'
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.text+0xc8): undefined reference to `operator delete(void*)'
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.text+0xf3): undefined reference to `gst_element_set_state'
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x150): undefined reference to `gst_init'
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x17d): undefined reference to `gst_pipeline_new'
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x194): undefined reference to `gst_element_factory_make'
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x1ab): undefined reference to `gst_element_factory_make'
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x1c2): undefined reference to `gst_element_factory_make'
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x203): undefined reference to `g_assertion_message_expr'
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x208): undefined reference to `gst_bin_get_type'
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x217): undefined reference to `g_type_check_instance_cast'
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x23e): undefined reference to `gst_bin_add_many'
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x25f): undefined reference to `gst_element_link_many'
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x37f): undefined reference to `g_assertion_message_expr'
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x3a1): undefined reference to `g_object_set'
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x3ad): undefined reference to `operator new(unsigned int)'
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x3f6): undefined reference to `gst_element_set_state'
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x401): undefined reference to `gst_object_unref'
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x41e): undefined reference to `gst_deinit'
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x467): undefined reference to `operator delete(void*)'
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.text$_ZN5QListIP7QObjectE13detach_helperEi[__ZN5QListIP7QObjectE13detach_helperEi]+0x8c): undefined reference to `__cxa_begin_catch'
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.text$_ZN5QListIP7QObjectE13detach_helperEi[__ZN5QListIP7QObjectE13detach_helperEi]+0xa3): undefined reference to `__cxa_rethrow'
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.text$_ZN5QListIP7QObjectE13detach_helperEi[__ZN5QListIP7QObjectE13detach_helperEi]+0xaa): undefined reference to `__cxa_end_catch'
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.rdata$_ZTI10SetPlaying[__ZTI10SetPlaying]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.rdata$_ZTI9QRunnable[__ZTI9QRunnable]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.eh_frame+0x13): undefined reference to `__gxx_personality_v0'
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.eh_frame$_ZN5QListIP7QObjectED1Ev+0x13): undefined reference to `__gxx_personality_v0'
CMakeFiles\qml-example.dir/objects.a(main.cpp.obj):main.cpp:(.eh_frame$_ZN5QListIP7QObjectE13detach_helperEi+0x13): undefined reference to `__gxx_personality_v0'
CMakeFiles\qml-example.dir/objects.a(qrc_qml.cpp.obj):qrc_qml.cpp:(.eh_frame+0x8b): undefined reference to `__gxx_personality_v0'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[2]: *** [qml-example.exe] Error 1
mingw32-make.exe[1]: *** [CMakeFiles/qml-example.dir/all] Error 2
CMakeFiles\qml-example.dir\build.make:112: recipe for target 'qml-example.exe' failed
mingw32-make.exe[2]: Leaving directory 'C:/gst-plugins-good-1.14.4/tests/examples/qt/build-qmlsink-Desktop_Qt_5_11_1_MinGW_32bit-Vorgabe'
CMakeFiles\Makefile2:66: recipe for target 'CMakeFiles/qml-example.dir/all' failed
mingw32-make.exe[1]: Leaving directory 'C:/gst-plugins-good-1.14.4/tests/examples/qt/build-qmlsink-Desktop_Qt_5_11_1_MinGW_32bit-Vorgabe'
Makefile:82: recipe for target 'all' failed
mingw32-make.exe: *** [all] Error 2
It looks like you're building for windows. The only way I've compiled the qml plugin on windows is using qmake using the provided .pro file. My experiments with compiling using the mingw toolchain provided by Qt were unsuccessful due to mismatching C++ ABI's between GStreamer and Qt. I ended up using MSVC/Visual Studio for compiling instead.
The undefined references to g_/gst_ probably means you don't have pkg-config setup correctly on your system. pkg-config.exe --modversion gstreamer-1.0 Should output the version of GStreamer you installed.
Where did you download GStreamer from? What GStreamer version exactly? Did you download binaries or did you compile it yourself?

MinGW/CMake Undefined Reference to ZLib

I have a project I want to build with CMake and compile with MinGW. The project uses Zlib. When I build with CMake I get no errors but then when I run MinGW Make it gives the following output:
C:\Projects\MultiMCBuild>C:\Qt\Tools\mingw492_32\bin\mingw32-make.exe
.
.
.
[ 50%] Linking CXX shared library ..\libMultiMC_logic.dll
C:/Projects/MultiMCBuild/External/Install/QuaZIP/lib/libquazip.a(unzip.c.obj):unzip.c:(.text+0x1f6c): undefined reference to 'z_inflateEnd'
C:/Projects/MultiMCBuild/External/Install/QuaZIP/lib/libquazip.a(unzip.c.obj):unzip.c:(.text+0x29e2): undefined reference to 'z_inflateInit2_'
C:/Projects/MultiMCBuild/External/Install/QuaZIP/lib/libquazip.a(unzip.c.obj):unzip.c:(.text+0x2a6d): undefined reference to 'z_get_crc_table'
C:/Projects/MultiMCBuild/External/Install/QuaZIP/lib/libquazip.a(unzip.c.obj):unzip.c:(.text+0x2ca7): undefined reference to 'z_inflateEnd'
C:/Projects/MultiMCBuild/External/Install/QuaZIP/lib/libquazip.a(unzip.c.obj):unzip.c:(.text+0x2f52): undefined reference to 'z_inflateInit2_'
C:/Projects/MultiMCBuild/External/Install/QuaZIP/lib/libquazip.a(unzip.c.obj):unzip.c:(.text+0x2f77): undefined reference to 'z_inflateEnd'
C:/Projects/MultiMCBuild/External/Install/QuaZIP/lib/libquazip.a(unzip.c.obj):unzip.c:(.text+0x3239): undefined reference to 'z_inflateInit2_'
C:/Projects/MultiMCBuild/External/Install/QuaZIP/lib/libquazip.a(unzip.c.obj):unzip.c:(.text+0x3317): undefined reference to 'z_inflateEnd'
C:/Projects/MultiMCBuild/External/Install/QuaZIP/lib/libquazip.a(unzip.c.obj):unzip.c:(.text+0x3626): undefined reference to 'z_crc32'
C:/Projects/MultiMCBuild/External/Install/QuaZIP/lib/libquazip.a(unzip.c.obj):unzip.c:(.text+0x371f): undefined reference to 'z_inflate'
C:/Projects/MultiMCBuild/External/Install/QuaZIP/lib/libquazip.a(unzip.c.obj):unzip.c:(.text+0x376a): undefined reference to 'z_crc32'
C:/Projects/MultiMCBuild/External/Install/QuaZIP/lib/libquazip.a(unzip.c.obj):unzip.c:(.text+0x3a57): undefined reference to 'z_inflateEnd'
C:/Qt/Tools/mingw492_32/bin/../lib/gcc/i686-w64- mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ld.exe: C:/Projects/MultiMCBuild/External/Install/QuaZIP/lib/libquazip.a(unzip.c.obj): bad reloc address 0x20 in section `.eh_frame'
collect2.exe: error: ld returned 1 exit status
logic\CMakeFiles\MultiMC_logic.dir\build.make:3186: recipe for target 'libMultiMC_logic.dll' failed
mingw32-make[2]: * * * [libMultiMC_logic.dll] Error 1
CMakeFiles\Makefile2:1806: recipe for target 'logic/CMakeFiles/MultiMC_logic.dir/all' failed
mingw32-make[1]: * * * [logic/CMakeFiles/MultiMC_logic.dir/all] Error 2
makefile:159: recipe for target 'all' failed
mingw32-make: * * * [all] Error 2
Anyone have a clue what I can do to fix this? I read that the code can't find the ZLib library, how do I link it?
EDIT here is my CMakeLists.txt. I got this from the Git project.
I just tried to generate a small example to reproduce your errors. I took my test file from the home page of zlib http://zlib.net/zpipe.c
My initial CMakeLists.txt was
cmake_minimum_required(VERSION 3.4)
project(zlib_test)
set(ZLIB_TEST_SOURCES zpipe.c)
add_executable(${PROJECT_NAME} ${ZLIB_TEST_SOURCES})
And I got the same errors
[ 50%] Building C object CMakeFiles/zlib_test.dir/zpipe.c.o
[100%] Linking C executable zlib_test
CMakeFiles/zlib_test.dir/zpipe.c.o: In function `def':
zpipe.c:(.text+0x65): undefined reference to `deflateInit_'
zpipe.c:(.text+0xcd): undefined reference to `deflateEnd'
zpipe.c:(.text+0x135): undefined reference to `deflate'
zpipe.c:(.text+0x1cf): undefined reference to `deflateEnd'
zpipe.c:(.text+0x25d): undefined reference to `deflateEnd'
CMakeFiles/zlib_test.dir/zpipe.c.o: In function `inf':
zpipe.c:(.text+0x2eb): undefined reference to `inflateInit_'
zpipe.c:(.text+0x353): undefined reference to `inflateEnd'
zpipe.c:(.text+0x3a4): undefined reference to `inflate'
zpipe.c:(.text+0x404): undefined reference to `inflateEnd'
zpipe.c:(.text+0x476): undefined reference to `inflateEnd'
zpipe.c:(.text+0x4a6): undefined reference to `inflateEnd'
collect2: error: ld returned 1 exit status
make[2]: *** [zlib_test] Error 1
make[1]: *** [CMakeFiles/zlib_test.dir/all] Error 2
make: *** [all] Error 2
After changing CMakeLists.txt to this form
cmake_minimum_required(VERSION 3.4)
project(zlib_test)
find_package(ZLIB REQUIRED)
if (ZLIB_FOUND)
include_directories(${ZLIB_INCLUDE_DIRS})
endif()
set(ZLIB_TEST_SOURCES zpipe.c)
add_executable(${PROJECT_NAME} ${ZLIB_TEST_SOURCES})
target_link_libraries(${PROJECT_NAME} ${ZLIB_LIBRARIES})
I could compile the program.
So your problem is: Where is ZLIB added in your CMakeLists.txt? At least, you need the line find_package(ZLIB REQUIRED).