compiling Proto 7 on Mac OS X 10.9.4

When I tried to compile proto 7 on Mac OsX 10.9.4 and I bumped into several problems,
so after succeeding in building it I decided to write this short post,
hoping that it will be useful to others users.

Problems:

  1. autogen.sh may get libtool name wrong.
  2. The standard compiler and linker shipped with Command Line Tools in Xcode (5.1.1) seem to have problems in compiling proto source code and interpreting the -rdynamic flag to export all symbols.

Solution:

1) I suggest the following patch to solve the first problem concerning autogen.sh


--- autogen.sh 2010-01-05 15:22:41.000000000 +0100
+++ autogenNew.sh 2014-09-12 18:19:57.000000000 +0200
@@ -6,7 +6,7 @@
rm -f configure

# select right libtoolize name:
-if [ `uname -s` = Darwin ]
+if hash glibtoolize 2> /dev/null
then
LIBTOOLIZE=glibtoolize
else

For those ones who do not know how to manage it,
copy and paste the plain code into a X.patch file and type:

patch < X.patch

2) Instead of trying to understand why clang gets stuck on compilation errors, I directly switched to gcc. I suggest having a user-compiled version of the GNU compiler, it turns to be useful in situations like this one.
Notice that in Command Line Tools ld '-rdynamic' as option for exporting all symbols is not recognized, so let's convert it in '-export-dynamic':

find . -type f -name "configure" | xargs sed -i '' 's/export_dynamic_flag_spec=-rdynamic/export_dynamic_flag_spec=-export-dynamic/g'

Summarizing:

  1. Apply autogen.sh patch
  2. Convert '-rdynamic' flag into '-export-dynamic'
  3. Run configure (with parameters)
  4. Build (make) with gcc
Groups: