RUG/Pennsylvania/State College/RepSnapper

From RepRap
Revision as of 16:01, 4 November 2011 by Joshj (talk | contribs)
Jump to: navigation, search

Notes

Compiling on Ubuntu Linux

One of our machines runs Ubuntu linux 10.10. Here is how we installed repsnapper 1.1.x:

Note: The machine is not connected to the internet, so packages are transferred using Synaptic's "Generate Download Script" option on a separate computer.

The following packages were required, as listed by the readme:

build-essential fluid libgtk2.0-dev libfltk1.1 libfltk1.1-dev libglut3 libglut3-dev libboost-thread-dev libboost-system-dev libconfig++8-dev libconfig8-dev

Note: Initially I neglected to install libgtk2.0-dev, which caused confusing build errors that the packages "gtk+-2.0" and "gthread-2.0" could not be found. Installing libgtk2.0-dev fixed the problem (gtk+-2.0 is satisfied by libgtk2.0-dev, and gthread-2.0 is satisfied by libglib2.0-dev, which is a dependency).

The codebase was downloaded using Git on a windows pc:

git clone git://github.com/timschmidt/repsnapper.git -b repsnapper-1.1.x

The code was compiled:

cd repsnapper/src

make

The resulting executable "repsnapper" was then moved to ~/toolchain, and a desktop shortcut created.


Compiling on Windows MinGW

Notes

 * This process is fairly involved.
 * The resulting executable requires a number of dynamic link libraries.
 * According to the MinGW documentation, it would have been better to install libraries into /mingw instead of /usr/local where possible. (eg. using make --prefix=/mingw)
 * In the MinGW shell, /mingw/* corresponds to C:\Path\to\MinGW\* and /usr/local/* corresponds to C:\Path\to\MinGW\msys\1.0\local\*


Install MinGW

 1. Install MinGW 20110802 (mingw-get-inst-20110802.exe from http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/mingw-get-inst/mingw-get-inst-20110802/mingw-get-inst-20110802.exe/download)
   * I installed to C:\PROGRAMS\MinGW. Path shouldn't matter as long as there are no spaces.
 2. Open a MinGW Shell

Install fltk library

 1. Download and extract fltk-1.1.10 (http://www.fltk.org/software.php?VERSION=1.3.0&FILE=fltk/1.1.10/fltk-1.1.10-source.zip)
 2. $ cd /c/path/to/fltk-1.1.10-source/fltk-1.1.10/
 3. $ ./configure
 4. $ make
 5. $ make install
 6. $ cd FL/
 7. $ make install

Install lua library

 1. Download and extract lua-5.1.4.tar.gz (http://www.lua.org/ftp/lua-5.1.4.tar.gz)
 2. $ cd /c/path/to/lua-5.1.4/
 3. $ make mingw
 4. $ make install

Install boost-build engine

 1. Download and extract boost_1_47_0.zip (http://sourceforge.net/projects/boost/files/boost/1.47.0/boost_1_47_0.zip/download)
 2. $ cd /c/path/to/boost_1_47_0/tools/build/v2/engine
 3. $ ./build.sh mingw
 4. $ cp bin.ntx86/*.exe /usr/local/bin

Install luabind library

 1. Download and extract luabind-0.9.1.zip (http://sourceforge.net/projects/luabind/files/luabind/0.9.1/luabind-0.9.1.zip/download)
 2. $ cd /c/path/to/luabind-0.9.1
 3. $ cp -r luabind /usr/local/include
 4. $ b2 --toolset=gcc link=static variant=release -sBOOST_ROOT=../boost_1_47_0/ -sLUA_PATH=/usr/local
 5. $ cp bin/gcc-mingw-4.5.2/release/link-static/libluabind.a /usr/local/lib

Install boost libraries

 1. $ cd /c/path/to/boost_1_47_0/
 2. $ b2 --toolst=gcc link=static threading=multi variant=release system filesystem
 3. $ b2 --toolset=gcc link=shared theading=muli variant=release thread
 4. $ cp bin.v2/libs/thread/build/gcc-mingw-4.5.2/release/threading-multi/libboost_thread-mgw45-mt-1_47.* /usr/local/lib/
 5. $ cp bin.v2/libs/system/build/gcc-mingw-4.5.2/release/link-static/threading-multi/libboost_system-mgw45-mt-1_47.a /usr/local/lib/
 6. $ cp bin.v2/libs/filesystem/build/gcc-mingw-4.5.2/release/link-static/threading-multi/libboost_filesystem-mgw45-mt-1_47.a /usr/local/lib/
 7. $ cp -r boost/ /usr/local/include

Install GLUT

 1. Download and extract glutdlls37beta.zip (http://www.opengl.org/resources/libraries/glut/glutdlls37beta.zip)
 2. $ cd /c/path/to/glutdlls37beta
 3. $ mkdir /usr/local/include/GL
 4. $ cp *.h /usr/local/include/GL
 5. $ cp *.lib /usr/local/lib
 6. $ cp *.dll /usr/local/bin

Install libconfig

 1. Download and extract libconfig-1.4.8.tar.gz (http://www.hyperrealm.com/libconfig/libconfig-1.4.8.tar.gz)
 2. $ cd /c/path/to/libconfig-1.4.8/
 3. $ ./configure
 4. $ make
 5. $ make install

Install GTK+

 1. Download and extract gtk+-bundle_2.16.6-20100912_win32.zip (http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.16/gtk+-bundle_2.16.6-20100912_win32.zip)
 2. $ cd /c/path/to/gtk+-bundle_*_win32
 3. $ cp -r bin/* /usr/local/bin
 4. $ cp -r lib/* /usr/local/lib
 5. $ cp -r include/* /usr/local/include

Build repsnapper

 1. Obtain the repsnapper source from the repository:
   git clone git://github.com/timschmidt/repsnapper.git -b repsnapper-1.1.x
 2. You'll also need the windows Serial libraries from:
   http://svn.kulitorum.com/RepSnapper/Libraries/Serial/
   Put them in repsnapper_1_1/src/Serial
 3. cd /c/path/to/repsnapper_1_1
 4. Add the following to the Makefile above "# Linux":
 ----------
 # MinGW
 ifeq ($(UNAME),MINGW32_NT-6.1)
   GTK_LIBS=`pkg-config --libs gtk+-2.0 gthread-2.0`
   GTK_CFLAGS=`pkg-config --cflags gtk+-2.0 gthread-2.0` -DHAVE_GTK
   INC=$(GTK_CFLAGS) -I/usr/include -I/mingw/include -I/mingw/include/GL -I$(LIB_DIR) -I$(LIB_DIR)/vmmlib/include -I/usr/include/boost -I/usr/include/lua5.1 -I/usr/local/include
   INC+=-I$(LIB_DIR)/polylib
   LDFLAGS=$(GTK_LIBS) -L/usr/lib -L/usr/local/lib -L/mingw/lib -lfltk -lfltk_gl -lfltk_forms -lglut32 -lopengl32 -lglu32 -lboost_thread-mgw45-mt-1_47.dll -lboost_system-mgw45-mt-1_47 -lboost_filesystem-mgw45-mt-1_47 -lws2_32 -llua -lluabind -lgdi32 -lole32 -luuid -luser32 -lcomctl32 -lkernel32 -lconfig++
   LDFLAGS+=-L$(LIB_DIR)/polylib -lpolylib
   TEST_LDFLAGS=-lboost_unit_test_framework
 endif
 ----------
 5. make

Run Repsnapper

This compiled copy of repsnapper needs the following dynamic link libraries:

 /usr/local/bin:
   glut32.dll
   libconfig++-9.dll
 /usr/local/lib:
   libboost_thread-mgw45-mt-1_47.dll
 /mingw/bin: 
   libgcc_s_dw2-1.dll
   libstdc++-6.dll

As well as the following GTK+ libraries (should be available if you have the GTK+ runtime installed, but can also be found in /usr/local/bin)

 freetype6.dll
 libatk-1.0-0.dll
 libcairo-2.dll
 libexpat-1.dll
 libfontconfig-1.dll
 libgdk-win32-2.0-0.dll
 libgdk_pixbuf-2.0-0.dll
 libgio-2.0-0.dll
 libglib-2.0-0.dll
 libgmodule-2.0-0.dll
 libgobject-2.0-0.dll
 libgthread-2.0-0.dll
 libgtk-win32-2.0-0.dll
 libpango-1.0-0.dll
 libpangocairo-1.0-0.dll
 libpangoft2-1.0-0.dll
 libpangowin32-1.0-0.dll
 libpng14-14.dll
 zlib1.dll

Changes when building Repsnapper 1.0.x

These instructions can be used to build RepSnapper 1.0.x instead of 1.1.x, with the following changes:

  • Don't use a modified 1.1.x Makefile; start with the 1.0.x Makefile and modify it as described above.
  • Change the following line in file.cpp (line 227):
 std::string directory_path = path.branch_path().native_directory_string();

to this:

 std::string directory_path = path.branch_path().string();

TODO

I'd like to get rid of some of the dynamic library requirements.

It should be possibly to statically link libboost_thread with a modification to the Makefile as per https://svn.boost.org/trac/boost/ticket/4878

It should be possible to remove the libgcc and libstdc requirements by using the flags -static-libstdc++ -static-libgcc in the Makefile, but this currently causes problems, likely because some of the other dlls themselves have dynamic links to those libraries.

Statically linking GTK+ would be the most significant, but I'm not sure how hard this would be.

Compiling libconfig does produce libconfig++.a, but this doesn't get linked in statically for some reason; not sure why.

Will need to compile glut instead of using a binary distro to get it to link statically.