OpenGL 4.3 development setup in Ubuntu 14.04 - c++
I've just started working my way through the OpenGL SuperBible 6th ed and am having a very hard time getting any of the samples to compile on Ubuntu 14.04. I installed the dev packages dependencies:
sudo apt-get install xorg-dev libglu1-mesa-dev libglfw-dev nvidia-331-dev cmake
I grabbed gl3w from skaslev's github, ran the python script and then sudo copied gl3w.h and glcorearb.h to /usr/include/GL/
I grabbed the samples from the SuperBible github and the media files, unzipped the media files into bin/media. Then I went back to the root of the sb6 files (the folder is called sb6code_2013_11_10 in my case) where and ran:
cmake .
make
cmake works fine, but make throws:
[ 6%] Built target sb6
Linking CXX executable bin/alienrain
CMakeFiles/alienrain.dir/src/alienrain/alienrain.cpp.o: In function `sb6::application::run(sb6::application*)':
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x21): undefined reference to `glfwInit'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x7a): undefined reference to `glfwOpenWindowHint'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x90): undefined reference to `glfwOpenWindowHint'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x9f): undefined reference to `glfwOpenWindowHint'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0xae): undefined reference to `glfwOpenWindowHint'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0xc4): undefined reference to `glfwOpenWindowHint'
CMakeFiles/alienrain.dir/src/alienrain/alienrain.cpp.o:alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0xee): more undefined references to `glfwOpenWindowHint' follow
CMakeFiles/alienrain.dir/src/alienrain/alienrain.cpp.o: In function `sb6::application::run(sb6::application*)':
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x12c): undefined reference to `glfwGetDesktopMode'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x18e): undefined reference to `glfwOpenWindow'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x1a8): undefined reference to `glfwSwapInterval'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x1f2): undefined reference to `glfwOpenWindow'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x22e): undefined reference to `glfwSetWindowTitle'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x238): undefined reference to `glfwSetWindowSizeCallback'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x242): undefined reference to `glfwSetKeyCallback'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x24c): undefined reference to `glfwSetMouseButtonCallback'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x256): undefined reference to `glfwSetMousePosCallback'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x260): undefined reference to `glfwSetMouseWheelCallback'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x277): undefined reference to `glfwEnable'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x27e): undefined reference to `glfwDisable'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x28f): undefined reference to `glfwGetWindowParam'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x373): undefined reference to `glfwGetTime'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x393): undefined reference to `glfwSwapBuffers'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x39d): undefined reference to `glfwGetKey'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x3bd): undefined reference to `glfwGetWindowParam'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x3f5): undefined reference to `glfwTerminate'
lib/libsb6.a(gl3w.c.o): In function `open_libgl':
gl3w.c:(.text+0xf): undefined reference to `dlopen'
lib/libsb6.a(gl3w.c.o): In function `close_libgl':
gl3w.c:(.text+0x2b): undefined reference to `dlclose'
lib/libsb6.a(gl3w.c.o): In function `get_proc':
gl3w.c:(.text+0x45): undefined reference to `glXGetProcAddress'
gl3w.c:(.text+0x66): undefined reference to `dlsym'
collect2: error: ld returned 1 exit status
make[2]: *** [bin/alienrain] Error 1
make[1]: *** [CMakeFiles/alienrain.dir/all] Error 2
make: *** [all] Error 2
So I decided to try and write my own small program based on Listing 2.1 in the book:
#include "sb6.h"
class my_application : public sb6::application
{
void init()
{
static const char title[] = "OpenGL SuperBible - Listing 2.1";
sb6::application::init();
memcpy(info.title, title, sizeof(title));
}
void render(double currentTime)
{
static const GLfloat red[] = {1.0f, 0.0f, 0.0f, 1.0f};
glClearBufferfv(GL_COLOR, 0, red);
}
};
DECLARE_MAIN(my_application)
Then I try to compile it:
g++ listing2.1.cpp -o listing2.1 -lGL -lGLU -lX11 -lglfw -D_LINUX
But that gives me a different set of errors:
In file included from sb6.h:65:0,
from listing2.1.cpp:1:
GL/gl3w.h:546:8: error: ‘PFNGLGETNMAPDVARBPROC’ does not name a type
extern PFNGLGETNMAPDVARBPROC gl3wGetnMapdvARB;
^
GL/gl3w.h:547:8: error: ‘PFNGLGETNMAPFVARBPROC’ does not name a type
extern PFNGLGETNMAPFVARBPROC gl3wGetnMapfvARB;
^
GL/gl3w.h:548:8: error: ‘PFNGLGETNMAPIVARBPROC’ does not name a type
extern PFNGLGETNMAPIVARBPROC gl3wGetnMapivARB;
^
GL/gl3w.h:549:8: error: ‘PFNGLGETNPIXELMAPFVARBPROC’ does not name a type
extern PFNGLGETNPIXELMAPFVARBPROC gl3wGetnPixelMapfvARB;
^
GL/gl3w.h:550:8: error: ‘PFNGLGETNPIXELMAPUIVARBPROC’ does not name a type
extern PFNGLGETNPIXELMAPUIVARBPROC gl3wGetnPixelMapuivARB;
^
GL/gl3w.h:551:8: error: ‘PFNGLGETNPIXELMAPUSVARBPROC’ does not name a type
extern PFNGLGETNPIXELMAPUSVARBPROC gl3wGetnPixelMapusvARB;
^
GL/gl3w.h:552:8: error: ‘PFNGLGETNPOLYGONSTIPPLEARBPROC’ does not name a type
extern PFNGLGETNPOLYGONSTIPPLEARBPROC gl3wGetnPolygonStippleARB;
^
GL/gl3w.h:553:8: error: ‘PFNGLGETNCOLORTABLEARBPROC’ does not name a type
extern PFNGLGETNCOLORTABLEARBPROC gl3wGetnColorTableARB;
^
GL/gl3w.h:554:8: error: ‘PFNGLGETNCONVOLUTIONFILTERARBPROC’ does not name a type
extern PFNGLGETNCONVOLUTIONFILTERARBPROC gl3wGetnConvolutionFilterARB;
^
GL/gl3w.h:555:8: error: ‘PFNGLGETNSEPARABLEFILTERARBPROC’ does not name a type
extern PFNGLGETNSEPARABLEFILTERARBPROC gl3wGetnSeparableFilterARB;
^
GL/gl3w.h:556:8: error: ‘PFNGLGETNHISTOGRAMARBPROC’ does not name a type
extern PFNGLGETNHISTOGRAMARBPROC gl3wGetnHistogramARB;
^
GL/gl3w.h:557:8: error: ‘PFNGLGETNMINMAXARBPROC’ does not name a type
extern PFNGLGETNMINMAXARBPROC gl3wGetnMinmaxARB;
^
I checked in sb6.h that gl3w.h is included before any of the OpenGL dependencies and that's true so I'll really not sure what to try next. Seems to be a linking problem but it's been a long time since I've been developing in C++ and I'm not sure what to try next.
Update
I followed didierc's suggestion and found that there was a sb6code_2013_11_10/include/GL folder with gl3w.h and glcorearb.h. I temporarily moved the GL folder out of sb6code_2013_11_10/include and then ran cmake and make again and then received the following error:
Scanning dependencies of target sb6
[ 1%] Building CXX object CMakeFiles/sb6.dir/src/sb6/sb6.cpp.o
In file included from /home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10/include/sb6ext.h:29:0,
from /home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10/include/sb6.h:71,
from /home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10/src/sb6/sb6.cpp:26:
/usr/include/GL/glext.h:6184:181: error: conflicting declaration ‘typedef void (* PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC)(GLuint, GLenum, GLsizeiptr, GLsizeiptr, GLenum, GLenum, const void*)’
typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLsizeiptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
^
In file included from /usr/include/GL/gl3w.h:4:0,
from /home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10/include/sb6.h:65,
from /home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10/src/sb6/sb6.cpp:26:
/usr/include/GL/glcorearb.h:4348:25: error: ‘PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC’ has a previous declaration as ‘typedef void (* PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC)(GLuint, GLenum, GLenum, GLenum, GLsizeiptr, GLsizeiptr, const void*)’
typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, GLsizeiptr offset, GLsizeiptr size, const void *data);
^
make[2]: *** [CMakeFiles/sb6.dir/src/sb6/sb6.cpp.o] Error 1
make[1]: *** [CMakeFiles/sb6.dir/all] Error 2
make: *** [all] Error 2
Then I thought "Ok, then maybe I'll try using the gl3w.h and glcorearb.h that came with the sb6 package." So I restored the GL folder and then deleted the gl3w.h and glcorearb.h I previously generated with the python script and placed in /usr/include/GL. After a cmake and make I then get this error:
[ 1%] Building CXX object CMakeFiles/sb6.dir/src/sb6/sb6.cpp.o
[ 2%] Building CXX object CMakeFiles/sb6.dir/src/sb6/sb6ktx.cpp.o
[ 3%] Building CXX object CMakeFiles/sb6.dir/src/sb6/sb6object.cpp.o
[ 5%] Building CXX object CMakeFiles/sb6.dir/src/sb6/sb6shader.cpp.o
[ 6%] Building C object CMakeFiles/sb6.dir/src/sb6/gl3w.c.o
Linking CXX static library lib/libsb6.a
[ 6%] Built target sb6
Linking CXX executable bin/alienrain
CMakeFiles/alienrain.dir/src/alienrain/alienrain.cpp.o: In function `sb6::application::run(sb6::application*)':
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x21): undefined reference to `glfwInit'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x7a): undefined reference to `glfwOpenWindowHint'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x90): undefined reference to `glfwOpenWindowHint'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x9f): undefined reference to `glfwOpenWindowHint'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0xae): undefined reference to `glfwOpenWindowHint'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0xc4): undefined reference to `glfwOpenWindowHint'
CMakeFiles/alienrain.dir/src/alienrain/alienrain.cpp.o:alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0xee): more undefined references to `glfwOpenWindowHint' follow
CMakeFiles/alienrain.dir/src/alienrain/alienrain.cpp.o: In function `sb6::application::run(sb6::application*)':
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x12c): undefined reference to `glfwGetDesktopMode'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x18e): undefined reference to `glfwOpenWindow'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x1a8): undefined reference to `glfwSwapInterval'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x1f2): undefined reference to `glfwOpenWindow'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x22e): undefined reference to `glfwSetWindowTitle'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x238): undefined reference to `glfwSetWindowSizeCallback'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x242): undefined reference to `glfwSetKeyCallback'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x24c): undefined reference to `glfwSetMouseButtonCallback'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x256): undefined reference to `glfwSetMousePosCallback'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x260): undefined reference to `glfwSetMouseWheelCallback'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x277): undefined reference to `glfwEnable'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x27e): undefined reference to `glfwDisable'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x28f): undefined reference to `glfwGetWindowParam'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x373): undefined reference to `glfwGetTime'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x393): undefined reference to `glfwSwapBuffers'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x39d): undefined reference to `glfwGetKey'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x3bd): undefined reference to `glfwGetWindowParam'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x3f5): undefined reference to `glfwTerminate'
lib/libsb6.a(gl3w.c.o): In function `open_libgl':
gl3w.c:(.text+0xf): undefined reference to `dlopen'
lib/libsb6.a(gl3w.c.o): In function `close_libgl':
gl3w.c:(.text+0x2b): undefined reference to `dlclose'
lib/libsb6.a(gl3w.c.o): In function `get_proc':
gl3w.c:(.text+0x45): undefined reference to `glXGetProcAddress'
gl3w.c:(.text+0x66): undefined reference to `dlsym'
collect2: error: ld returned 1 exit status
make[2]: *** [bin/alienrain] Error 1
make[1]: *** [CMakeFiles/alienrain.dir/all] Error 2
make: *** [all] Error 2
So I'm not sure if that's progress but at least is exposes some of the snakes. Any advice on what to do next would be appreciated!
Update 2
Here's what I get from running make VERBOSE=1 with the GL folder intact (ie just as it was when I downloaded the sb6 files, but I also have glw3.h and glcorearb.h in /usr/include/GL):
/usr/bin/cmake -H/home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10 -B/home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10 --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10/CMakeFiles /home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10'
make -f CMakeFiles/sb6.dir/build.make CMakeFiles/sb6.dir/depend
make[2]: Entering directory `/home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10'
cd /home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10 && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10 /home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10 /home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10 /home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10 /home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10/CMakeFiles/sb6.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10'
make -f CMakeFiles/sb6.dir/build.make CMakeFiles/sb6.dir/build
make[2]: Entering directory `/home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10'
/usr/bin/cmake -E cmake_progress_report /home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10/CMakeFiles 51
[ 1%] Building CXX object CMakeFiles/sb6.dir/src/sb6/sb6.cpp.o
/usr/bin/c++ -D_LINUX -I/home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10/include -I/home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10/extern/glfw-2.7.6/include -o CMakeFiles/sb6.dir/src/sb6/sb6.cpp.o -c /home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10/src/sb6/sb6.cpp
Linking CXX static library lib/libsb6.a
/usr/bin/cmake -P CMakeFiles/sb6.dir/cmake_clean_target.cmake
/usr/bin/cmake -E cmake_link_script CMakeFiles/sb6.dir/link.txt --verbose=1
/usr/bin/ar cr lib/libsb6.a CMakeFiles/sb6.dir/src/sb6/sb6.cpp.o CMakeFiles/sb6.dir/src/sb6/sb6ktx.cpp.o CMakeFiles/sb6.dir/src/sb6/sb6object.cpp.o CMakeFiles/sb6.dir/src/sb6/sb6shader.cpp.o CMakeFiles/sb6.dir/src/sb6/gl3w.c.o
/usr/bin/ranlib lib/libsb6.a
make[2]: Leaving directory `/home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10'
/usr/bin/cmake -E cmake_progress_report /home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10/CMakeFiles 51 52 53 54 55
[ 6%] Built target sb6
make -f CMakeFiles/alienrain.dir/build.make CMakeFiles/alienrain.dir/depend
make[2]: Entering directory `/home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10'
cd /home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10 && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10 /home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10 /home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10 /home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10 /home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10/CMakeFiles/alienrain.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10'
make -f CMakeFiles/alienrain.dir/build.make CMakeFiles/alienrain.dir/build
make[2]: Entering directory `/home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10'
/usr/bin/cmake -E cmake_progress_report /home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10/CMakeFiles 1
[ 7%] Building CXX object CMakeFiles/alienrain.dir/src/alienrain/alienrain.cpp.o
/usr/bin/c++ -D_LINUX -I/home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10/include -I/home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10/extern/glfw-2.7.6/include -o CMakeFiles/alienrain.dir/src/alienrain/alienrain.cpp.o -c /home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10/src/alienrain/alienrain.cpp
Linking CXX executable bin/alienrain
/usr/bin/cmake -E cmake_link_script CMakeFiles/alienrain.dir/link.txt --verbose=1
/usr/bin/c++ -D_LINUX CMakeFiles/alienrain.dir/src/alienrain/alienrain.cpp.o -o bin/alienrain -L/home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10/lib -rdynamic lib/libsb6.a -Wl,-rpath,/home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10/lib
CMakeFiles/alienrain.dir/src/alienrain/alienrain.cpp.o: In function `sb6::application::run(sb6::application*)':
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x21): undefined reference to `glfwInit'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x7a): undefined reference to `glfwOpenWindowHint'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x90): undefined reference to `glfwOpenWindowHint'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x9f): undefined reference to `glfwOpenWindowHint'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0xae): undefined reference to `glfwOpenWindowHint'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0xc4): undefined reference to `glfwOpenWindowHint'
CMakeFiles/alienrain.dir/src/alienrain/alienrain.cpp.o:alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0xee): more undefined references to `glfwOpenWindowHint' follow
CMakeFiles/alienrain.dir/src/alienrain/alienrain.cpp.o: In function `sb6::application::run(sb6::application*)':
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x12c): undefined reference to `glfwGetDesktopMode'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x18e): undefined reference to `glfwOpenWindow'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x1a8): undefined reference to `glfwSwapInterval'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x1f2): undefined reference to `glfwOpenWindow'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x22e): undefined reference to `glfwSetWindowTitle'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x238): undefined reference to `glfwSetWindowSizeCallback'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x242): undefined reference to `glfwSetKeyCallback'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x24c): undefined reference to `glfwSetMouseButtonCallback'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x256): undefined reference to `glfwSetMousePosCallback'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x260): undefined reference to `glfwSetMouseWheelCallback'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x277): undefined reference to `glfwEnable'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x27e): undefined reference to `glfwDisable'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x28f): undefined reference to `glfwGetWindowParam'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x373): undefined reference to `glfwGetTime'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x393): undefined reference to `glfwSwapBuffers'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x39d): undefined reference to `glfwGetKey'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x3bd): undefined reference to `glfwGetWindowParam'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x3f5): undefined reference to `glfwTerminate'
lib/libsb6.a(gl3w.c.o): In function `open_libgl':
gl3w.c:(.text+0xf): undefined reference to `dlopen'
lib/libsb6.a(gl3w.c.o): In function `close_libgl':
gl3w.c:(.text+0x2b): undefined reference to `dlclose'
lib/libsb6.a(gl3w.c.o): In function `get_proc':
gl3w.c:(.text+0x45): undefined reference to `glXGetProcAddress'
gl3w.c:(.text+0x66): undefined reference to `dlsym'
collect2: error: ld returned 1 exit status
make[2]: *** [bin/alienrain] Error 1
make[2]: Leaving directory `/home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10'
make[1]: *** [CMakeFiles/alienrain.dir/all] Error 2
make[1]: Leaving directory `/home/lewa/workspace-cpp/opengl-superbible/sb6code_2013_11_10'
make: *** [all] Error 2
Update 3
I was able to find a solution to the build problem with the sb6 sample code. It turns out there is a error in the CMakeLists.txt included with the sample code where on line 13 the 'elif (UNIX)' should be 'elseif (UNIX)'. See references:
trouble trying to build opengl superbible example code
https://github.com/openglsuperbible/sb6code/issues/12
https://github.com/openglsuperbible/sb6code/issues/8
With that fix the sb6 sample code now compiles for me. However, when I try to use sb6.h in my own sample code (listed in my_application above) I still get
In file included from sb6ext.h:29:0,
from sb6.h:71,
from listing2.1.cpp:1:
/usr/include/GL/glext.h:6184:181: error: conflicting declaration ‘typedef void (* PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC)(GLuint, GLenum, GLsizeiptr, GLsizeiptr, GLenum, GLenum, const void*)’
typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLsizeiptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
^
In file included from /usr/include/GL/gl3w.h:4:0,
from sb6.h:65,
from listing2.1.cpp:1:
/usr/include/GL/glcorearb.h:4348:25: error: ‘PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC’ has a previous declaration as ‘typedef void (* PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC)(GLuint, GLenum, GLenum, GLenum, GLsizeiptr, GLsizeiptr, const void*)’
typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, GLsizeiptr offset, GLsizeiptr size, const void *data);
^
I was able to solve the sb6 sample code compilation problems by fixing a bug in CMakeLists.txt where on line 13 the 'elif (UNIX)' should be 'elseif (UNIX)'. See the following for references:
trouble trying to build opengl superbible example code
https://github.com/openglsuperbible/sb6code/issues/12
https://github.com/openglsuperbible/sb6code/issues/8
I have not solve my compilation problems when I use sb6.h in my own code yet but will update this answer when I do
Related
How can I successfully Build gRPC in 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.
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?
Including c++ libraries (opencv) on remote build raspberry pi
I'm stuck trying to get some openCV code working on my raspberry pi. I'm almost certain the problem is caused by the linker not knowing where the openCV library files are but I'm unfamiliar with both Linux and Netbeans so I'm in a bit of a pickle! So, in short, my set-up is: attempting to build my code to my raspberryPi via remote C++ build host (G++). I am writing my code in Netbeans. The builds worked fine up until the point I wrote two new classes using the "opencv2/core/core.hpp" Now, when I attempt to build, I get the following error/s: Copying project files to /home/pi/.netbeans/remote/192.168.1.99/desktop-g6lev01-Windows-x86_64 at pi#192.168.1.99 Building project files list... Checking directory structure... Checking previously uploaded files... Checking links... Uploading changed files: Zipping 1 changed files... Uploading zip to pi#192.168.1.99... Unzipping changed files... Checking exec permissions... Uploading changed files finished successfully. cd '/home/pi/.netbeans/remote/192.168.1.99/desktop-g6lev01-Windows-x86_64/E/Work/RasberryPi/Code/Raspberrypi_Test' /usr/bin/make -f Makefile CONF=Release "/usr/bin/make" -f nbproject/Makefile-Release.mk QMAKE= SUBPROJECTS= .build-conf make[1]: Entering directory '/home/pi/.netbeans/remote/192.168.1.99/desktop-g6lev01-Windows-x86_64/E/Work/RasberryPi/Code/Raspberrypi_Test' "/usr/bin/make" -f nbproject/Makefile-Release.mk IOTestBuild make[2]: Entering directory '/home/pi/.netbeans/remote/192.168.1.99/desktop-g6lev01-Windows-x86_64/E/Work/RasberryPi/Code/Raspberrypi_Test' g++ -o IOTestBuild build/Release/GNU-Linux/CommsManager.o build/Release/GNU-Linux/ImageManager.o build/Release/GNU-Linux/Server.o build/Release/GNU-Linux/main.o -L../../opencv- -lwiringPi -opencv build/Release/GNU-Linux/ImageManager.o: In function `ImageManager::getStoredImg()': ImageManager.cpp:(.text+0xcc): undefined reference to `cv::Mat::copySize(cv::Mat const&)' build/Release/GNU-Linux/ImageManager.o: In function `ImageManager::ImageManager()': ImageManager.cpp:(.text+0x134): undefined reference to `cv::VideoCapture::VideoCapture()' ImageManager.cpp:(.text+0x1c0): undefined reference to `cv::Mat::deallocate()' ImageManager.cpp:(.text+0x288): undefined reference to `cv::Mat::deallocate()' ImageManager.cpp:(.text+0x2b8): undefined reference to `cv::fastFree(void*)' ImageManager.cpp:(.text+0x2c0): undefined reference to `cv::VideoCapture::VideoCapture()' ImageManager.cpp:(.text+0x32c): undefined reference to `cv::VideoCapture::~VideoCapture()' ImageManager.cpp:(.text+0x344): undefined reference to `cv::Mat::copySize(cv::Mat const&)' ImageManager.cpp:(.text+0x350): undefined reference to `cv::Ptr<CvCapture>::delete_obj()' ImageManager.cpp:(.text+0x358): undefined reference to `cv::fastFree(void*)' ImageManager.cpp:(.text+0x36c): undefined reference to `cv::VideoCapture::~VideoCapture()' ImageManager.cpp:(.text+0x388): undefined reference to `cv::VideoCapture::~VideoCapture()' build/Release/GNU-Linux/ImageManager.o: In function `ImageManager::~ImageManager()': ImageManager.cpp:(.text+0x3a0): undefined reference to `cv::VideoCapture::~VideoCapture()' ImageManager.cpp:(.text+0x404): undefined reference to `cv::fastFree(void*)' ImageManager.cpp:(.text+0x414): undefined reference to `cv::Mat::deallocate()' build/Release/GNU-Linux/ImageManager.o: In function `ImageManager::getRawImg(cv::Mat*)': ImageManager.cpp:(.text+0x43c): undefined reference to `cv::VideoCapture::open(int)' ImageManager.cpp:(.text+0x450): undefined reference to `cv::VideoCapture::operator>>(cv::Mat&)' ImageManager.cpp:(.text+0x494): undefined reference to `cv::VideoCapture::release()' build/Release/GNU-Linux/ImageManager.o: In function `ImageManager::updateFrame()': ImageManager.cpp:(.text+0x5f0): undefined reference to `cv::Mat::copySize(cv::Mat const&)' ImageManager.cpp:(.text+0x67c): undefined reference to `cv::fastFree(void*)' ImageManager.cpp:(.text+0x6b8): undefined reference to `cv::Mat::deallocate()' ImageManager.cpp:(.text+0x6c4): undefined reference to `cv::Mat::deallocate()' build/Release/GNU-Linux/ImageManager.o: In function `cv::Mat::~Mat()': ImageManager.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x68): undefined reference to `cv::fastFree(void*)' ImageManager.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x74): undefined reference to `cv::Mat::deallocate()' collect2: error: ld returned 1 exit status nbproject/Makefile-Release.mk:65: recipe for target 'IOTestBuild' failed make[2]: *** [IOTestBuild] Error 1 make[2]: Leaving directory '/home/pi/.netbeans/remote/192.168.1.99/desktop-g6lev01-Windows-x86_64/E/Work/RasberryPi/Code/Raspberrypi_Test' nbproject/Makefile-Release.mk:62: recipe for target '.build-conf' failed make[1]: *** [.build-conf] Error 2 make[1]: Leaving directory '/home/pi/.netbeans/remote/192.168.1.99/desktop-g6lev01-Windows-x86_64/E/Work/RasberryPi/Code/Raspberrypi_Test' nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed make: *** [.build-impl] Error 2 BUILD FAILED (exit value 2, total time: 701ms) Any ideas? I'm sure I just need to point the linker to the appropriate libs but I've no idea how to specify that relative path when using a build host. Regards Guy
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).
Linking to boost libraries when building pcl-1.7.1 from source
I have downloaded the pcl-1.7.1 release from github and have tried to build the code using cd PCL-1.6.0 && mkdir build && cd build cmake -DCMAKE_BUILD_TYPE=Release .. make sudo make install The cmake command runs successful and and writes this concerning boost -- Boost version: 1.55.0 -- Found the following Boost libraries: -- system -- filesystem -- thread -- date_time -- iostreams The problem comes with the make command which after some time returns the following error: Scanning dependencies of target pcl_convert_pcd_ascii_binary [ 12%] Building CXX object io/tools/CMakeFiles/pcl_convert_pcd_ascii_binary.dir/convert_pcd_ascii_binary.cpp.o Linking CXX executable ../../bin/pcl_convert_pcd_ascii_binary ../../lib/libpcl_common.so.1.7.1: error: undefined reference to 'boost::thread::join_noexcept()' ../../lib/libpcl_common.so.1.7.1: error: undefined reference to 'boost::thread::start_thread_noexcept()' ../../lib/libpcl_io.so.1.7.1: error: undefined reference to 'boost::filesystem::detail::permissions(boost::filesystem::path const&, boost::filesystem::perms, boost::system::error_code*)' ../../lib/libpcl_io.so.1.7.1: error: undefined reference to 'boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' ../../lib/libpcl_io.so.1.7.1: error: undefined reference to 'boost::filesystem::path::extension() const' ../../lib/libpcl_io.so.1.7.1: error: undefined reference to 'boost::filesystem::detail::dir_itr_close(void*&, void*&)' ../../lib/libpcl_io.so.1.7.1: error: undefined reference to 'boost::filesystem::path::stem() const' ../../lib/libpcl_io.so.1.7.1: error: undefined reference to 'boost::filesystem::detail::directory_iterator_construct(boost::filesystem::directory_iterator&, boost::filesystem::path const&, boost::system::error_code*)' ../../lib/libpcl_io.so.1.7.1: error: undefined reference to 'boost::filesystem::detail::directory_iterator_increment(boost::filesystem::directory_iterator&, boost::system::error_code*)' ../../lib/libpcl_io.so.1.7.1: error: undefined reference to 'boost::filesystem::directory_entry::m_get_status(boost::system::error_code*) const' ../../lib/libpcl_io.so.1.7.1: error: undefined reference to 'boost::thread::do_try_join_until_noexcept(timespec const&, bool&)' collect2: ld returned 1 exit status make[2]: *** [bin/pcl_convert_pcd_ascii_binary] Error 1 make[1]: *** [io/tools/CMakeFiles/pcl_convert_pcd_ascii_binary.dir/all] Error 2 make: *** [all] Error 2 Is it correct that this is a linking problem? can it be the boost installation that causes the problem? I have built the boost library from source (version 1.55.0) by executing the following inside the boost_1_55_0 directory sudo ./bootstrap sudo ./b2 install The boost is then installed in /usr/local/include and /usr/local/lib I use 32 bit Ubuntu 12.04
I found some libboost files in /usr/lib which I forgot to delete from the last install of boost (as pointed out by #D.J.Duff). Removing those files and intstalling boost again fixed the problem.