K-3D / k3d

The main K-3D code repository
http://www.k-3d.org/
GNU General Public License v2.0
200 stars 51 forks source link

Cannot build under Ubuntu 16.04 amd64 #25

Open insblank opened 8 years ago

insblank commented 8 years ago

Hi, I am fairly new to compiling from source, and ran into an issue I think is in the code:

[ 23%] Linking CXX executable ../bin/k3d
../lib/libk3dsdk-opengl.so.1: undefined reference to `glewContextInit'
collect2: error: ld returned 1 exit status
application/CMakeFiles/k3d.dir/build.make:132: recipe for target 'bin/k3d' failed
make[2]: *** [bin/k3d] Error 1
CMakeFiles/Makefile2:1257: recipe for target 'application/CMakeFiles/k3d.dir/all' failed
make[1]: *** [application/CMakeFiles/k3d.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

I made it far to compilation, but got hung up here.

Also, an earlier release for Debian Wheezy WORKS ON THE RASPBERRY PI. Should this be possible? I am trying to get the latest .8.0.5 to compile on the Raspberry Pi eventually, but have had no success even in Ubuntu right now. Thanks.

barche commented 8 years ago

This is probably because the build system is trying to use a standard glew. You need the glew-mx package: http://packages.ubuntu.com/xenial/libglewmx-dev

Starting with glew 2.0 this is no longer needed.

insblank commented 8 years ago

I have the package you mentioned installed, but I think the system is still trying to use the wrong glew.

insblank commented 8 years ago

I built and installed glew 2.0 and commenced building k3d. I got a little further, but still got stopped by this error:

In file included from /home/blank/Downloads/k3d-k3d-0.8.0.5/k3dsdk/ngui/document.cpp:47:0: /home/blank/Downloads/k3d-k3d-0.8.0.5/k3dsdk/gl/context.h:50:9: error: ‘GLEWContext’ does not name a type static GLEWContext* current_glew_context(); ^ /home/blank/Downloads/k3d-k3d-0.8.0.5/k3dsdk/gl/context.h:56:2: error: ‘GLEWContext’ does not name a type GLEWContext* glew_context(); ^ /home/blank/Downloads/k3d-k3d-0.8.0.5/k3dsdk/gl/context.h:69:20: error: ‘GLEWContext’ was not declared in this scope boost::scoped_ptr m_glew_context; ^ /home/blank/Downloads/k3d-k3d-0.8.0.5/k3dsdk/gl/context.h:69:31: error: template argument 1 is invalid boost::scoped_ptr m_glew_context; ^ k3dsdk/ngui/CMakeFiles/k3dsdk-ngui.dir/build.make:494: recipe for target 'k3dsdk/ngui/CMakeFiles/k3dsdk-ngui.dir/document.cpp.o' failed make[2]: * [k3dsdk/ngui/CMakeFiles/k3dsdk-ngui.dir/document.cpp.o] Error 1 CMakeFiles/Makefile2:648: recipe for target 'k3dsdk/ngui/CMakeFiles/k3dsdk-ngui.dir/all' failed make[1]: * [k3dsdk/ngui/CMakeFiles/k3dsdk-ngui.dir/all] Error 2 Makefile:127: recipe for target 'all' failed make: *\ [all] Error 2

barche commented 8 years ago

Ah, sorry, I should have mentioned that glew 2 support is in 0.8.0.6 (latest master). It should work with the MX version, if not I will try to debug it myself on a Ubuntu virtual box.

insblank commented 8 years ago

I tried building the .8.0.6 source, and also failed with the following error:

.cpp:26:0: /home/blank/Downloads/k3d-k3d-0.8.0.6/k3dsdk/gl/context.h:54:9: error: ‘GLEWContext’ does not name a type static GLEWContext* current_glew_context(); ^ /home/blank/Downloads/k3d-k3d-0.8.0.6/k3dsdk/gl/context.h:60:2: error: ‘GLEWContext’ does not name a type GLEWContext* glew_context(); ^ /home/blank/Downloads/k3d-k3d-0.8.0.6/k3dsdk/gl/context.h:73:20: error: ‘GLEWContext’ was not declared in this scope boost::scoped_ptr m_glew_context; ^ /home/blank/Downloads/k3d-k3d-0.8.0.6/k3dsdk/gl/context.h:73:31: error: template argument 1 is invalid boost::scoped_ptr m_glew_context; ^ k3dsdk/CMakeFiles/k3dsdk.dir/build.make:2630: recipe for target 'k3dsdk/CMakeFiles/k3dsdk.dir/type_registry.cpp.o' failed make[2]: * [k3dsdk/CMakeFiles/k3dsdk.dir/type_registry.cpp.o] Error 1 CMakeFiles/Makefile2:113: recipe for target 'k3dsdk/CMakeFiles/k3dsdk.dir/all' failed make[1]: * [k3dsdk/CMakeFiles/k3dsdk.dir/all] Error 2 Makefile:127: recipe for target 'all' failed make: *\ [all] Error 2

barche commented 8 years ago

I just tried to reproduce this on a new Ubuntu 16.04 install and it worked for me. You may need to restart from a clean build directory, or at least re-run cmake. These are the packages I installed to get it working:

libglewmx-dev
cmake-qt-gui
libboost-all-dev
libgtkmm-2.4-dev
libgtkglextmm-x11-1.2-dev
libftgl-dev
libjpeg-turbo8-dev
libtiff5-dev
git

I solved some build errors related to building docs (commit 993e2a534572521b4c683258980ba6f9f0fe538a), so now the following sequence should generate a working build:

git clone https://github.com/K-3D/k3d.git
mkdir build
cd build
cmake ../k3d/
make -j2
make run/fast
insblank commented 8 years ago

I reinstalled the libglew packages from the repos to overwrite the glew2.0 I installed and the process completed to 100%. However, make run/fast gave an error, and I had to run sudo make install. When I type k3d it still shows .8.0.4 which is what was shown before in ubuntu and the interface is missing all icons and the learning resources are gone too.

insblank commented 8 years ago

I tried building the .8.0.6 source, and also failed with the following error:

.cpp:26:0: /home/blank/Downloads/k3d-k3d-0.8.0.6/k3dsdk/gl/context.h:54:9: error: ‘GLEWContext’ does not name a type static GLEWContext* current_glew_context(); ^ /home/blank/Downloads/k3d-k3d-0.8.0.6/k3dsdk/gl/context.h:60:2: error: ‘GLEWContext’ does not name a type GLEWContext* glew_context(); ^ /home/blank/Downloads/k3d-k3d-0.8.0.6/k3dsdk/gl/context.h:73:20: error: ‘GLEWContext’ was not declared in this scope boost::scoped_ptr m_glew_context; ^ /home/blank/Downloads/k3d-k3d-0.8.0.6/k3dsdk/gl/context.h:73:31: error: template argument 1 is invalid boost::scoped_ptr m_glew_context; ^ k3dsdk/CMakeFiles/k3dsdk.dir/build.make:2630: recipe for target 'k3dsdk/CMakeFiles/k3dsdk.dir/type_registry.cpp.o' failed make[2]: * [k3dsdk/CMakeFiles/k3dsdk.dir/type_registry.cpp.o] Error 1 CMakeFiles/Makefile2:113: recipe for target 'k3dsdk/CMakeFiles/k3dsdk.dir/all' failed make[1]: * [k3dsdk/CMakeFiles/k3dsdk.dir/all] Error 2 Makefile:127: recipe for target 'all' failed make: *\ [all] Error 2

insblank commented 8 years ago

I also get this error when trying to run 'make run/fast'

CRITICAL: Caught exception [std::runtime_error] - Share path [/home/blank/Downloads/k3d/build/bin/../share/k3d] does not exist.

barche commented 8 years ago

Could you try running the following in a new directory:

git clone https://github.com/K-3D/k3d.git
mkdir build
cd build
cmake ../k3d/

and paste the output here, please? I have both glew and glewmx installed, but it should pick glewmx in that case, and then GLEWContext should exist.

The version number is my fault, I forgot to change it in the code for 2 releases in a row now, so it's stuck at 0.8.0.4 :)

insblank commented 8 years ago

Here is the output. I posted above (it may have been bumped further up) that my build did get to 100% complete but I could not run the program with make run/fast. I used sudo make install, but when I run k3d, the icons are missing as are the introductory resources.

-- The C compiler identification is GNU 5.4.0 -- The CXX compiler identification is GNU 5.4.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- checking the width of std::vector<>::size_type for this platform -- std::vector<>::size_type is 64 bits -- checking for module 'cairomm-1.0' -- found cairomm-1.0, version 1.12.0 -- checking for module 'dbus-glib-1' -- package 'dbus-glib-1' not found -- checking for module 'freetype2' -- found freetype2, version 18.1.12 -- checking for module 'glibmm-2.4' -- found glibmm-2.4, version 2.46.3 -- checking for module 'gnome-vfs-2.0' -- found gnome-vfs-2.0, version 2.24.4 -- checking for module 'gtkglext-1.0' -- found gtkglext-1.0, version 1.2.0 -- checking for module 'gtkmm-2.4' -- found gtkmm-2.4, version 2.24.4 -- checking for module 'gtksourceview-2.0' -- package 'gtksourceview-2.0' not found -- checking for module 'gts' -- found gts, version 0.7.6 -- Found ImageMagick: /usr/lib/x86_64-linux-gnu/libMagick++-6.Q16.so (found version "6.8.9-9") -- checking for module 'OpenEXR' -- found OpenEXR, version 2.2.0 -- Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so
-- checking for one of the modules 'glewmx;glew' -- found glewmx, version 1.13.0 -- checking for module 'osmesa' -- found osmesa, version 8 -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8") -- Found PNG: /usr/lib/x86_64-linux-gnu/libpng.so (found version "1.2.54") -- Found PythonInterp: /usr/bin/python (found version "2.7.12") -- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython2.7.so (found version "2.7.12") -- checking for module 'sigc++-2.0' -- found sigc++-2.0, version 2.6.2 -- checking for package 'EXPAT' -- Found EXPAT: /usr/lib/x86_64-linux-gnu/libexpat.so (found version "2.1.0") -- found EXPAT -- Looking for Q_WS_X11 -- Looking for Q_WS_X11 - found -- Looking for Q_WS_WIN -- Looking for Q_WS_WIN - not found -- Looking for Q_WS_QWS -- Looking for Q_WS_QWS - not found -- Looking for Q_WS_MAC -- Looking for Q_WS_MAC - not found -- Found Qt4: /usr/bin/qmake (found suitable version "4.8.7", minimum required is "4.6.2") -- Boost version: 1.58.0 -- Found the following Boost libraries: -- date_time -- program_options -- regex -- system -- unit_test_framework -- python -- checking for module 'gthread-2.0' -- found gthread-2.0, version 2.48.1 -- generating i18n catalog -- done -- Configuring done -- Generating done -- Build files have been written to: /home/blank/Downloads/build

barche commented 8 years ago

OK, the output looks good. I think I may have introduced the error about the share directory by disabling the docs build, I'll try to reproduce this on a clean build.

barche commented 8 years ago

Allright, indeed my last commit wiped the entire share/k3d directory, not exactly what I intended. It should work with the latest head now.

insblank commented 8 years ago

I finally got it to work! Thank you and we can consider this issue resloved!