Skip to content

attempting to build the new 2.x branch on OSX - some notes... #38

Open
davidbuzz opened this Issue Aug 21, 2011 · 14 comments

3 participants

@davidbuzz
Collaborator

get a few dependancies first:

brew install gtkmm gtk+ gtkglext cmake glib glade

you'll also need to manually download , compile and install the latest versions of libtool, autoconf and make:

wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.68.tar.gz
wget http://ftp.gnu.org/gnu/libtool/libtool-2.4.tar.gz
wget http://ftp.gnu.org/gnu/make/make-3.82.tar.gz
( extract each of these to a folder, cd to it, type: ./configure ; make ; sudo make install )

these above tools are ( by default) installed into /usr/local, so you need to have /usr/local/bin in your PATH variable, before /usr/bin etc:

set PATH=/usr/local/bin:$PATH

#you'll also need to tweak the code so it doesn't refer to GL/gl.h or GL/glu.h
edit this file:

vi src/stdafx.h
and change the two GL related #includes near the top to:
#include
#include

then type :
aclocal
automake
sh autogen.sh

I'm not sure what else is needed, as I kinda hacked around a bit. Eg: I installed freeglut, but I don't thnk it's needed. Anyway, I downloaded it from here: http://aarnet.dl.sourceforge.net/project/freeglut/freeglut/freeglut-2.6.0.tar.gz and I found that this configure line works for it: ./configure --x-includes=/usr/X11/include --x-libraries=/usr/X11/lib

still working on it, so I'll add comments to this ticket if /when it all comes together. :-)

@davidbuzz
Collaborator

the correct #includes on OSX are OpenGL/gl.h and OpenGL/glu.h , just a clarification on the above issue.

@davidbuzz
Collaborator

a few further notes:
once I got the autogen.sh running to a point where it created a ./configure script ( and then ran it, and it barfed), I manually edited the ./configure script and removed the offending lines:
#IT_PROG_INTLTOOL(0.26)
and
#PKG_PROG_PKG_CONFIG(0.22)
#PKG_CHECK_MODULES(GTKMM, gobject-2.0 glib-2.0 gtkmm-2.4 gtkglext-1.0 gtk+-2.0)

and this meant I was able to get the configure script to run to completion, creating me some Makefile/s ( which were a bit broken ).

I found that the Makefile/s ( in root, an in ./src folder ) were unable to complete because they couldn't find gtkmm and gtkglext-1.0 , so I manually edited these files and took the output from "pkg-config --cflags gtkmm-2.4" and "pkg-config --cflags gtkglext-1.0" and added the output to the CFLAGS = xxx lines of hte makefile. I also aded the output of "pkg-config --libs gtkmm-2.4" and "pkg-config --libs gtkglext-1.0" to the LIBS = xxx lines of hte makefiles too.

for me, the resulting CFLAGS line was:
CFLAGS = -g -O2 -D_REENTRANT -I/opt/homebrew/Cellar/gtkmm/2.18.2/include/gtkmm-2.4 -I/opt/homebrew/Cellar/gtkmm/2.18.2/lib/gtkmm-2.4/include -I/opt/homebrew/Cellar/glibmm/2.22.2/include/giomm-2.4 -I/opt/homebrew/Cellar/glibmm/2.22.2/lib/giomm-2.4/include -I/opt/homebrew/Cellar/pangomm/2.26.2/include/pangomm-1.4 -I/opt/homebrew/Cellar/pangomm/2.26.2/lib/pangomm-1.4/include -I/opt/homebrew/Cellar/gtk+/2.24.4/include/gtk-2.0 -I/opt/homebrew/Cellar/gtk+/2.24.4/include/gtk-unix-print-2.0 -I/opt/homebrew/Cellar/gtkmm/2.18.2/include/atkmm-1.6 -I/opt/homebrew/Cellar/gtkmm/2.18.2/include/gdkmm-2.4 -I/opt/homebrew/Cellar/gtkmm/2.18.2/lib/gdkmm-2.4/include -I/opt/homebrew/Cellar/glibmm/2.22.2/include/glibmm-2.4 -I/opt/homebrew/Cellar/glibmm/2.22.2/lib/glibmm-2.4/include -I/opt/homebrew/Cellar/glib/2.28.8/include/glib-2.0 -I/opt/homebrew/Cellar/glib/2.28.8/lib/glib-2.0/include -I/opt/homebrew/Cellar/gettext/0.18.1.1/include -I/opt/homebrew/Cellar/glib/2.28.8/include -I/opt/homebrew/Cellar/libsigc++/2.2.9/include/sigc++-2.0 -I/opt/homebrew/Cellar/libsigc++/2.2.9/lib/sigc++-2.0/include -I/opt/homebrew/Cellar/cairomm/1.8.4/include/cairomm-1.0 -I/opt/homebrew/Cellar/cairomm/1.8.4/lib/cairomm-1.0/include -I/opt/homebrew/Cellar/pango/1.28.4/include/pango-1.0 -I/opt/homebrew/Cellar/libpng/1.2.44/include/libpng12 -I/opt/homebrew/Cellar/gtk+/2.24.4/lib/gtk-2.0/include -I/opt/homebrew/Cellar/atk/2.0.1/include/atk-1.0 -I/opt/homebrew/Cellar/gdk-pixbuf/2.22.1/include/gdk-pixbuf-2.0 -I/usr/X11/include/cairo -I/usr/X11/include/pixman-1 -I/usr/X11/include/freetype2 -I/usr/X11/include

and the resulting LIBS line was:
LIBS = -L/opt/homebrew/Cellar/gtkmm/2.18.2/lib -L/opt/homebrew/Cellar/glibmm/2.22.2/lib -L/opt/homebrew/Cellar/pangomm/2.26.2/lib -L/opt/homebrew/Cellar/gtk+/2.24.4/lib -L/opt/homebrew/Cellar/glib/2.28.8/lib -L/opt/homebrew/Cellar/gettext/0.18.1.1/lib -L/opt/homebrew/Cellar/libsigc++/2.2.9/lib -L/opt/homebrew/Cellar/cairomm/1.8.4/lib -L/opt/homebrew/Cellar/pango/1.28.4/lib -L/opt/homebrew/Cellar/atk/2.0.1/lib -L/opt/homebrew/Cellar/gdk-pixbuf/2.22.1/lib -L/opt/homebrew/Cellar/libpng/1.2.44/lib -L/usr/X11/lib -lgtkmm-2.4 -latkmm-1.6 -lgdkmm-2.4 -lgiomm-2.4 -lpangomm-1.4 -lgtk-x11-2.0 -lglibmm-2.4 -lcairomm-1.0 -lsigc-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lm -lcairo -lpng12 -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl

after that, it compiled and ran!

@mmeeks
Collaborator
mmeeks commented Aug 22, 2011

Wow ! :-) way cool ... so - this is really important work; thanks for it !
Are there any patches you could make to autogen.sh / or configure.in to improve the configure process on Mac ? or a patch to a README to help people get it building ?
Finally the 'libreprap' stuff (sadly) threw out a lot of cross-platform goodness, so I wonder if we manage to detect & use OS/X com-ports properly these days ... either way, fixes are very much welcome.

I guess you need pkg-config installed, and then you should get your link line to work nicely. I guess I should update autogen.sh to be the latest perl-script from libreoffice to do this piece that checks for pkg-config explicitly.

@davidbuzz
Collaborator

I'm far from being the correct person to recommend changes to autogen.sh and/or configure.in. I honestly don't even know what these files do ( apart from somehow ending up making the configure script automagically for me). i'm happy to be a test bunny though ( davidbuzz AT gmail.com). My further experiments with the compiled app find that it has a lot of dynamic lib dependancies ( mostly on my libraries from homebrew) , and so it's currently non-portable to other mac's without an installer of some sort to copy the libraries too. I've tried bundling the needed .dylib files into a "repsnapper.app" bundle ( it's just a directory really), but unless or until I'm able to compile them all with "@executable_path" in them ( see http://qin.laya.com/tech_coding_help/dylib_linking.html ), then it's all very much a lost cause at this time. the other option is to static link all the libraries, which is also a lot of extra work. :-)

Buzz.

@thaytan
Collaborator
thaytan commented Nov 30, 2011

One of us needs to get access to a mac or frankmac for a day or two to test out this build script and integrate it, I guess.

Also, see Issue #25 #25

@davidbuzz
Collaborator

thaytan:
I have ongoing access to a number of macs, and as I've said above, I'm happy to perform testing etc, and try to figure out why certain things don't work.... but I know less than nothing about autoconf and libtool, so anything further I do here ( beyond what I've already done above) will need more hand-holding, and someone to suggest some next move/s. Pls get in contact with me, eg: davidbuzz at gmail dot com, and I can probably arrange to get on IRC for a few hours at a mutually convenient time, and work through this with you or someone else.... ? Buzz.

@thaytan
Collaborator
thaytan commented Nov 30, 2011

OK, I'll try and meet up with you sometime. We're in the same timezone give or take daylight savings, so it shouldn't be too hard to find a good time.

@mmeeks
Collaborator
mmeeks commented Nov 30, 2011

If you head to irc.freenode.net and the #repsnapper channel - there is usually someone available there if you make some noise, much of the day: :-)

@davidbuzz
Collaborator

this diff appears to fix the IT_PROG_INTLTOOL error:
diff --git a/Makefile.am b/Makefile.am
index abba67e..f6c5cac 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,7 @@
AUTOMAKE_OPTIONS = foreign subdir-objects

+ACLOCAL_AMFLAGS = -I m4
+
CLEANFILES = repsnapper.desktop

DISTCHECK_CONFIGURE_FLAGS = @DISTCHECK_LIBREPRAP_FLAGS@
diff --git a/configure.ac b/configure.ac
index e8f0a12..fb2c28b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,8 +22,7 @@ LT_INIT([disable-static])

GETTEXT_PACKAGE=repsnapper
AC_SUBST(GETTEXT_PACKAGE)
-AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",

  • [The prefix for our gettext translation domains.]) +AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [The prefix for our gettext translation domains.]) IT_PROG_INTLTOOL(0.26) AM_GLIB_GNU_GETTEXT
@davidbuzz
Collaborator

also, there are known issues with the OSX included libiconv , and the recommended practice is to build a more standard one at a different location, and then be sure to link agains the correct one - I'm not sure if this is totally essentialy for repsnapper though, might be able to get away without it:

As a result I installed libiconv from sources:
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar -zxvpg libiconv-1.14.tar.gz
cd libiconv-1.14
( this builds both 32 and 64 bit archithecture )
MACOSX_DEPLOYMENT_TARGET=10.6 \
CFLAGS='-O3 -fno-common -arch i386 -arch x86_64' \
LDFLAGS='-O3 -arch i386 -arch x86_64' \
CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64' \
./configure --prefix=/usr/local
make
sudo make install

@mmeeks
Collaborator
mmeeks commented Dec 7, 2011

pushed the couple of changes above to master - it'd be great to document your OS/X building experience so others could follow that; if you could mail me a text file and/or patch to mmeeks@suse.com that'd be wonderful :-)

Thanks.

@davidbuzz
Collaborator

to mmeeks, I thought that's what I was doing here.....? as for text file/patches, I'm not sure I have anything more to add at this point than what I've put here. For the short-term, I'll keep updating this ticket if I come across anything new. :-)

@davidbuzz
Collaborator

these made my OSX buid finally work..... but have a high possibility of borking other platforms, please check for me.
#59

@thaytan
Collaborator
thaytan commented Dec 8, 2011

All working for me. Probably we can close this. Also, if you have any comments on issue 42, feel free.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.