How to compile and install K-3D 0.7.12 on FreeBSD 8? (Update K-3D 0.8.0.0)

Ok, so I found a port that is need of updating. K-3D. FreeBSD has K-3D version 6.7 in ports but K-3D is on release 7.11 and approaching their version 8 release. So lets see what we need to do to get this port updated.

To start out, I have informed both FreeBSD and K-3D that I am going to help with this using their forums.
http://forums.freebsd.org/showthread.php?t=10647
http://www.k-3d.org/forums/topic/updated-port-for-freebsd-8

Step 1 – Build a FreeBSD 8 Desktop Environment
Build yourself a desktop as described here (or however you want if you know what you are doing):
How to install and configure a FreeBSD 8 Desktop with Xorg and KDE?

Step 2 – Install dependencies
The following are dependencies that are required to build K-3D on FreeBSD 8.

  1. Install mercurial
    K-3D uses Mercurial as its version managed system for its code (it used to use subversion but now uses mercurial). So to download the code you need to install Mercurial.

    As root do this:

    # cd /usr/ports/devel/mercurial
    # make install

  2. Install cmake 2.8 or later.
    K-3D now uses cmake as its build management system as opposed to make or gmake. Since cmake is not installed on FreeBSD by default, lets install it.

    # cd /usr/ports/devel/cmake
    # make install

  3. Install cairomm.

    # cd /usr/ports/graphics/cairomm
    # make install

    Note: This will also install glibmm and sigc++.

  4. Install gnome-vfs.

    # cd /usr/ports/devel/gnome-vfs
    # make install

  5. Install gtkglex.

    # cd /usr/ports/x11-toolkits/gtkglext
    # make install

  6. Install gtkmm24.

    # cd /usr/ports/x11-toolkits/gtkmm24
    # make install

  7. Install gtksourceview2.

    # cd /usr/ports/x11-toolkits/gtksourceview2
    # make install

  8. Install gts.

    # cd /usr/ports/graphics/gts
    # make install

  9. Install ImageMagick.

    # cd /usr/ports/graphics/ImageMagick
    # make install

  10. Install e2fsprogs-libuuid.

    # cd /usr/ports/misc/e2fsprogs-libuuid
    # make install

  11. Install Doxygen.

    # cd /usr/ports/devel/doxygen
    # make install

    Note: This took quite a long time to compile because it also had a lot of large depencies.

  12. Install libexecinfo.

    # cd /usr/ports/devel/libexecinfo
    # make install

Step 3 – Download the code and build it

  1. As a regular user, run these commands:

    $ cd ~
    $ hg clone http://k3d.hg.sf.net/hgweb/k3d/k3d

    The code will take a minute or two (or more if you have a slow connection) to download.

  2. – Make a build directory
    K-3D cannot be built in the same directory where the code resides. So lets create a build directory and change to that directory.

    $ mkdir ~/k3d-build
    $ cd k3d-build

  3. Run cmake against k3d

    $ cmake ~/k3d

    Note: If you forget to install the dependencies, you will get errors. Here is the output of my attempt to compile before I installed the dependencies.

    $ cd k3d-build
    $ cmake ~/k3d
    -- checking the width of std::vector<>::size_type for this platform
    --   std::vector<>::size_type is 64 bits
    -- checking for module 'cairomm-1.0'
    gnome-config: not found
    --   package 'cairomm-1.0' not found
    -- checking for module 'dbus-glib-1'
    --   found dbus-glib-1, version 0.82
    -- checking for module 'freetype2'
    --   found freetype2, version 9.20.3
    -- checking for module 'glibmm-2.4'
    gnome-config: not found
    --   package 'glibmm-2.4' not found
    -- checking for module 'gnome-vfs-2.0'
    gnome-config: not found
    --   package 'gnome-vfs-2.0' not found
    -- checking for module 'gtkglext-1.0'
    gnome-config: not found
    --   package 'gtkglext-1.0' not found
    -- checking for module 'gtkmm-2.4'
    gnome-config: not found
    --   package 'gtkmm-2.4' not found
    -- checking for module 'gtksourceview-2.0'
    gnome-config: not found
    --   package 'gtksourceview-2.0' not found
    -- checking for module 'gts'
    gnome-config: not found
    --   package 'gts' not found
    -- checking for module 'ImageMagick++'
    gnome-config: not found
    --   package 'ImageMagick++' not found
    -- checking for module 'OpenEXR'
    --   found OpenEXR, version 1.6.1
    -- checking for module 'libpng12'
    --   found libpng12, version 1.2.40
    -- checking for module 'sigc++-2.0'
    gnome-config: not found
    --   package 'sigc++-2.0' not found
    CMake Error at cmake/modules/K3DDependencies.cmake:18 (MESSAGE):
      Couldn't find glibmm, which is required to build K-3D.  You can obtain
      glibmm from http://gtkmm.org.
    Call Stack (most recent call first):
      CMakeLists.txt:248 (K3D_CHECK_REQUIRED_DEPENDENCY)
    
    
    CMake Error at cmake/modules/K3DDependencies.cmake:18 (MESSAGE):
      Couldn't find libsigc++, which is required to build K-3D.  You can obtain
      libsigc++ from http://libsigc.sourceforge.net.
    Call Stack (most recent call first):
      CMakeLists.txt:251 (K3D_CHECK_REQUIRED_DEPENDENCY)
    
    
    -- checking for module 'uuid'
    gnome-config: not found
    --   package 'uuid' not found
    CMake Error at cmake/modules/K3DDependencies.cmake:18 (MESSAGE):
      Couldn't find uuid, which is required to build K-3D.  You can obtain uuid
      from http://www.ossp.org/pkg/lib/uuid.
    Call Stack (most recent call first):
      CMakeLists.txt:257 (K3D_CHECK_REQUIRED_DEPENDENCY)
    
    
    CMake Error at cmake/modules/K3DDependencies.cmake:28 (MESSAGE):
      Couldn't find the gtkglext library, which is required by
      K3D_BUILD_NGUI_MODULE.
    Call Stack (most recent call first):
      CMakeLists.txt:272 (K3D_CHECK_OPTIONAL_DEPENDENCY)
    
    
    CMake Error at cmake/modules/K3DDependencies.cmake:28 (MESSAGE):
      Couldn't find the gtkmm library, which is required by
      K3D_BUILD_NGUI_MODULE.
    Call Stack (most recent call first):
      CMakeLists.txt:273 (K3D_CHECK_OPTIONAL_DEPENDENCY)
    
    
    CMake Error at cmake/modules/K3DDependencies.cmake:28 (MESSAGE):
      Couldn't find the cairomm library, which is required by
      K3D_BUILD_NGUI_PIPELINE_PANEL_MODULE.
    Call Stack (most recent call first):
      CMakeLists.txt:274 (K3D_CHECK_OPTIONAL_DEPENDENCY)
    
    
    -- checking for module 'gthread-2.0'
    --   found gthread-2.0, version 2.20.5
    -- generating i18n catalog
    --   done
    -- Could NOT find Doxygen  (missing:  DOXYGEN_EXECUTABLE)
    -- Configuring incomplete, errors occurred!
    $
    

    Hopefully you installed the dependencies and didn’t see any of the above errors.

Step 4 – Test Running the application
We can test running this from the build directory before installing, so lets do that.

  1. From the k3d-build directory, type make run:

    $ make run

  2. Ok, so now that it is compiling it is failing to run…hopefully we can get that fixed. Stay tuned.

UPDATE: 2/2/2010

Ok, so I am back. Here is the what I have done.

Step 5 – Fixing run errors

  1. Compiled with debugging. I ran ccmake ~/k3d again and this time I set the CMAKE_BUILD_TYPE to Debug before choosing to configure. Once configure was done, I ran make again.
  2. Grepped for the error in the code. Specifically, this term:

    $ grep -Rn k3d::iuser_interface ~/k3d/*

    I found the problem code was in this file and line number:
    File: /home/jared/k3d/application/k3d_main.cpp
    line: 460

  3. Went to the problematic code and investigated it. It seems to be a simple check, so I commented that block of code out so it would continue:
    //      if(!dynamic_cast<k3d::iuser_interface*>(g_user_interface))
    //     {
    //              delete g_user_interface;
    //              g_user_interface = 0;
    //              handle_error("UI plugin module [" + module_name + "] does not impleme
    //              return;
    //      }
    
  4. I recompiled (everything remained compiled except the one part with the file I changed so compiling was quick).
  5. I launched make run again:

    # make run

    This time, as I had hoped, it loaded the application completely.

    However, I noticed some errors.

    The first two error lines occurred early in the load process. I am not sure but they seem to be unrelated:

    INFO: Gtk: Failed to load module “atk-bridge”: Shared object “libatk-bridge.so” not found, required by “k3d”
    :1: error: unexpected character `\241′, expected keyword – e.g. `style’

    ERROR: /home/jared/k3d/modules/virtual_opengl_painters/sds_point_painter.cpp line 73: assertion `delegate’ failed
    ERROR: Error creating document plugin: VirtualOpenGLSDSPointPainter
    ERROR: /home/jared/k3d/modules/virtual_opengl_painters/sds_edge_painter.cpp line 73: assertion `delegate’ failed
    ERROR: Error creating document plugin: VirtualOpenGLSDSEdgePainter
    ERROR: /home/jared/k3d/modules/virtual_opengl_painters/sds_face_painter.cpp line 73: assertion `delegate’ failed
    ERROR: Error creating document plugin: VirtualOpenGLSDSFacePainter

  6. I searched the ports tree for the libatk-bridge.so file.

    # /usr/ports
    # grep -R libatk-bridge *

    It looks like there is a at-spi package that provides this library.

  7. Install the at-spi package

    # cd /usr/ports/accessibility/at-spi
    # make install

  8. Tried to make run again.

    # exit
    $ cd ~/k3d-build
    $ make run

    The application loaded and the libatk-bridge error was gone but it was replaced with a warning:

    (k3d:55092): atk-bridge-WARNING **: AT_SPI_REGISTRY was not started at session startup.

    (k3d:55092): atk-bridge-WARNING **: IOR not set.

    (k3d:55092): atk-bridge-WARNING **: Could not locate registry

  9. Ok, so now that it is running, I think it is time to submit bugs to K-3d for the remaining errors.

As of right now, I don’t think it is worth the effort to create a port of version 7.11 as it has bugs for FreeBSD. I feel comfortable that when the next revision of K-3D comes out, version 8.x, the code will work well and we will create a port for it.

UPDATE: February 8, 2010

The main developer has made some changes so that K-3D launches now. The error that prevent the launch is gone (the others that seem somewhat benign are still occurring).

There is now a problem with K-3D on FreeBSD in that the faces cannot be properly selected, so the user-interface is not working perfectly.

Again, I will work on this problem and update this post.

Update: The problem is now resolved. There are couple lingering issues that you can read about at the K-3D forums.
http://www.k-3d.org/forums/topic/updated-port-for-freebsd-8

Hopefully all will be resolved when version 8 releases and we can make a new port.

Update: March 31, 2010

Ok, it looks like we need to move to Mesa 7.6.1 to get the latest versions of K-3D to work. Mesa 7.6.1 is available on FreeBSD.

You just have do make WITHOUT_NOUVEAU in order for the new version to be pulled. Here is what I did.

portsnap fetch update

cd /usr/ports/graphics/libGL/
make deinstall
make WITHOUT_NOUVEAU=yes install

cd /usr/ports/graphics/libGLU/
make deinstall
make WITHOUT_NOUVEAU=yes install

cd /usr/ports/graphics/libGLw/
make deinstall
make WITHOUT_NOUVEAU=yes install

cd /usr/ports/graphics/libglut/
make deinstall
make WITHOUT_NOUVEAU=yes install

cd /usr/ports/graphics/libdrm/
make deinstall
make WITHOUT_NOUVEAU=yes install

cd /usr/ports/graphics/dri/
make deinstall
make WITHOUT_NOUVEAU=yes install

Now things are working rather well, though the rendering with Aqsis is just giving me a black box. Hopefully I will fix that.

I fixed the black box just be restarting K-3D (I had installed Aqsis while K-3D was running).

However, now I am seeing a problem with Rendering the mug example. The handle does not appear to be rendered correctly.

It should look like this:

However, on FreeBSD it looks like this:

16 Comments

  1. How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … | Just linux! says:

    [...] View original post here: How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … [...]

  2. How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … | Just linux! says:

    [...] View original post here: How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … [...]

  3. How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … | Just linux! says:

    [...] View original post here: How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … [...]

  4. How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … | Just linux! says:

    [...] View original post here: How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … [...]

  5. How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … | Just linux! says:

    [...] View original post here: How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … [...]

  6. How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … | Just linux! says:

    [...] View original post here: How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … [...]

  7. How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … | Just linux! says:

    [...] View original post here: How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … [...]

  8. How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … | Just linux! says:

    [...] View original post here: How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … [...]

  9. How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … | Just linux! says:

    [...] View original post here: How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … [...]

  10. How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … | Just linux! says:

    [...] View original post here: How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … [...]

  11. How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … | Just linux! says:

    [...] View original post here: How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … [...]

  12. How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … | Just linux! says:

    [...] View original post here: How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … [...]

  13. How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … | Just linux! says:

    [...] View original post here: How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … [...]

  14. How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … | Just linux! says:

    [...] View original post here: How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … [...]

  15. How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … | Just linux! says:

    [...] View original post here: How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … [...]

  16. How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … | Just linux! says:

    [...] View original post here: How to compile and install K-3D 0.7.12 on FreeBSD 8? « Rhyous's … [...]

Leave a Reply

How to post code in comments?