OSX Build problems

Jeroen Massar jeroen at massar.ch
Tue Mar 15 08:32:37 PDT 2016


On 2016-03-15 15:40, Dirk Hohndel wrote:
> 
>> On Mar 15, 2016, at 3:31 AM, Robert Helling <helling at lmu.de
>> <mailto:helling at lmu.de>> wrote:
>>
>> Hi,
>>
>> I am currently enjoying two build problems when using the build.sh script:
>>
>> There are errors while building libdivecomputer, it tries also to
>> build examples/dctool_parse.c where in calls of the type
>> VENDOR_MODEL_parser_create a fourth parameter “serial” is missing. But
>> I guess since this is an example this is save to ignore.
> 
> It is. But the best is to just remove the useless build of the
> examples... in the build.sh add "--disable-examples" to the configure
> call for libdivecomputer
> 
>> More serious is in subsurface/scripts/build.sh
[..]
>> This does not find ~/Qt/5.5 for me on my Macs.

I've been attempting to build subsurface also for a bit, with little
success. The dctool indeed hit me, but as per IRC, that was easily
circumvented... The QT thing seems to be way more annoying though.

My current list of homebrew build depends is quite a bit more than on
the website:
brew qt5 install automake autoconf libtool libusb libssh2 pkgconfig hidapi

The QT part I fixed in my build with (build.sh):
8<-------------------
        elif [ -d "~/Qt/5.6" ] ; then
                export CMAKE_PREFIX_PATH=~/Qt/5.6/clang_64/lib/cmake
+       elif [ -d /usr/local/opt/qt5/lib ] ; then
+               export CMAKE_PREFIX_PATH=/usr/local/opt/qt5/lib/cmake
        else
                echo "cannot find Qt 5.5 or 5.6 in ~/Qt"
                exit 1
        fi
----------------->8

and then also added:
8<------------------
 cmake -DCMAKE_BUILD_TYPE=Release -DQTONLY=TRUE -DQT5BUILD=ON \
        -DCMAKE_INSTALL_PREFIX=$INSTALL_ROOT \
        -DBUILD_MARBLE_TESTS=NO \
        -DWITH_DESIGNER_PLUGIN=NO \
        -DBUILD_MARBLE_APPS=NO \
+       -DCMAKE_MODULE_PATH=$CMAKE_PREFIX_PATH \
        $SRC/marble-source
....
        cmake -DCMAKE_BUILD_TYPE=Release \
                -DCMAKE_INSTALL_PREFIX=$INSTALL_ROOT \
+               -DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH \
+               -DCMAKE_MODULE_PATH=$CMAKE_PREFIX_PATH \
                -DBUILD__TESTS=NO \
                $SRC/grantlee
....
        mkdir -p $SRC/subsurface/$BUILDDIR
        cd $SRC/subsurface/$BUILDDIR
-       export CMAKE_PREFIX_PATH=$INSTALL_ROOT/lib/cmake
+       export
CMAKE_PREFIX_PATH="$INSTALL_ROOT/lib/cmake;${CMAKE_PREFIX_PATH}"
        cmake -DCMAKE_BUILD_TYPE=Debug .. \
                -DSUBSURFACE_TARGET_EXECUTABLE=$SUBSURFACE_EXECUTABLE \
                -DLIBGIT2_INCLUDE_DIR=$INSTALL_ROOT/include \
@@ -227,6 +233,7 @@ for (( i=0 ; i < ${#BUILDS[@]} ; i++ )) ; do

-DLIBDIVECOMPUTER_LIBRARIES=$INSTALL_ROOT/lib/libdivecomputer.a \
                -DMARBLE_INCLUDE_DIR=$INSTALL_ROOT/include \

-DMARBLE_LIBRARIES=$INSTALL_ROOT/lib/libssrfmarblewidget.$SH_LIB_EXT \
+               -DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH \
                -DNO_PRINTING=OFF
----------------->8
(better patch to follow, when the whole thing finally actually builds,
something with finding time to do so though ;)


that makes Subsurface (and grantlee actually) find QT perfectly fine
when installed from homebrew (brew install qt5; which provides 5.5.1 at
the moment).

The next problem though seems to be with libxml... apparently some
include path is not being passed properly $somewhere... (and I have
never been a fan of either autoconf/automake let alone cmake... but the
fact that build.sh exists and does not catch several dependencies being
missing underscores what I think about those "tools")

8<---------------------
Scanning dependencies of target subsurface_corelib
[ 29%] Building C object
subsurface-core/CMakeFiles/subsurface_corelib.dir/cochran.c.o
In file included from src/subsurface/subsurface-core/cochran.c:12:
src/subsurface/subsurface-core/dive.h:38:10: fatal error:
'libxml/tree.h' file not found
#include <libxml/tree.h>
         ^
1 error generated.
make[2]: ***
[subsurface-core/CMakeFiles/subsurface_corelib.dir/cochran.c.o] Error 1
make[1]: *** [subsurface-core/CMakeFiles/subsurface_corelib.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
--------------------->8

I am trying to add 'debug' output to Cmake to see where the heck this
goes wrong. Of course it also just continues till multiple errors hit
instead of barfing out at the first one, thus the above happens in
multiple places. As noted, libxml2 lives in the Apple OSX SDK, hence the
path is $magic, but it should also be the default include path, which is
what is surprising me here quite a bit. Though it should be
/usr/include/libxml2/<libxml/tree.h> hence, the -I/usr/include/libxml2/
should be passed along. (Real path is of course the magically long
version:
/Application/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libxml2/
)

When stuff gets compiling better I'll make an empty VM and compile it
there to be sure I did not miss any others that I did already have.

Any hints appreciated, will likely hack on this a bit more during the
evening hours, food comes first ;)

>> I really don’t speak shell but it seems in that in the file test ~ is
>> not interpolated properly. If I replace it by $HOME it works. Here is
>> a patch that does this.
> 
> Odd - it worked one of my Macs, but fails on the others. I don't think I
> installed a different shell but it's possible...
> 
> Can you send a second patch to fix the problem above?

Watch out that one is really using "bash" and not any other kind of
shell when executing the build.sh, as that might make a huge difference...

Greets,
 Jeroen



More information about the subsurface mailing list