On Wed, Dec 9, 2015 at 12:27 PM, Dirk Hohndel <[email protected]> wrote:
> On Wed, Dec 09, 2015 at 12:16:58PM +0100, Robert Helling wrote:
>> Hi,
>>
>> I wanted to report my experiences trying to build subsurface (-mobile) on my 
>> new Mac. Yesterday, I got this new Macbook Pro fresh from Apple and I had 
>> hoped that not carrying around old versions of stuff, I might be able to 
>> finally build the mobile version (as Dirk does without problems). Spoiler 
>> alert: I did not.
>>
>> So, before installing anything else, I got Xcode, cloned latest master, 
>> installed home-brew as in the INSTALL instructions, downloaded the latest Qt 
>> (takes forever). And then ran the build.sh script. I ran into the following 
>> problems:
>>
>> 1) It complained that it couldn’t find libssh2 (so I installed it from 
>> home-brew, maybe that should be listed in the install instructions as well).
>>
>> 2) When building marble, it complained about not being able to find some Qt 
>> components. So I had to set some path variables to 
>> ~/Qt/5.5/clang_64/lib/cmake/XXX (XXX being various stuff, too bad I closed 
>> that shell so cannot see the details anymore) But then it built.
>>
>> 3) The resulting binary complains
>>
>> dhcp-10-181-1-30:build Helling$ Subsurface.app/Contents/MacOS/Subsurface
>> dyld: Library not loaded: @executable_path/lib/libssrfmarblewidget.21.dylib
>>   Referenced from: 
>> /Users/Helling/src/subsurface/build/Subsurface.app/Contents/MacOS/Subsurface
>>   Reason: image not found
>> Trace/BPT trap: 5
>>
>> I have no idea what to do about this. But when I disable marble using 
>> ccmake, I get a binary that works (but of course does not show a map).
>

I have been curious to attempt a mac subsurface build for a while, and
Robert's report somehow inspired me.

Success! Tonight both Subsurface-mobile.app and Subsurface.app are
built and launchable on my Mac El Capitan computer.

For reasons i cannot explain, i did *not* need to invoke homebrew to
fix any libssh2 issues. (but this seems strange, i would have expected
to need to do that.)

I did need these additional homebrew items:
    brew install hidapi
    brew install  automake autoconf libtool


"not loaded: @executable_path/lib/libssrfmarblewidget.21.dylib"
    ... also did *not* happen to me.

However, in regards to the marble dylib, I can confirm the following:
    there is a point in subsurface/master/scripts/build.sh where the
following is scripted:

#in order for macdeployqt to do its job correctly, we need the full
path in the dylib ID
cd $INSTALL_ROOT/lib
NAME=$(otool -L libssrfmarblewidget.dylib | grep -v : | head -1 | cut
-f1 -d\  | tr -d '\t' | cut -f3 -d/ )

echo $NAME | grep / > /dev/null 2>&1
if [ $? -eq 1 ] ; then
install_name_tool -id "$INSTALL_ROOT/lib/$NAME" "$INSTALL_ROOT/lib/$NAME"
fi

-----

... if for any reason that "install_name_tool -id" command does not
execute, then the dylib id will be:

@executable_path/lib/libssrfmarblewidget.21.dylib

and if the subsurface app executable is linked to that dylib (when its
"id" is still like that), then that would reproduce the error reported
by Robert.

So, i think there is merit in Sebastian's hypothesis that building
non-mobile, then mobile, then non-mobile somehow resulted in the good
fortune of that install_name_tool trick actually doing its work
finally.

Two other strange things that I had to do for my build to succeed:

1. for the mobile app, i had to manually run
macdeployqt Subsurface-mobile.app
-qmldir=Subsurface-mobile.app/Contents/Frameworks/qml
-executable=Subsurface-mobile.app/Contents/MacOS/Subsurface-mobile
-always-overwrite

otherwise the mobile app fails to launch, complaining about:
qrc:/qml/main.qml:1 module "QtQuick" is not installed
qrc:/qml/main.qml:2 module "QtQuick.Controls" is not installed
qrc:/qml/main.qml:3 module "QtQuick.Window" is not installed
qrc:/qml/main.qml:4 module "QtQuick.Dialogs" is not installed
...

2. i had to edit "subsurface/CMakeLists.txt" to make sure this would
be in the linker:

-framework CoreFoundation

As I said, my build steps were all done on El Capitan (os x 10.11).
However, if i am the only El Cap user who needs to add the
CoreFoundation business, then that might be due to something bad in my
xcode/clang toolchain.  I am using Xcode 6.2 left over from when this
computer was running 10.9.

------------------------------------

EPILOGUE

Oh guess what!  One of my problems mysteriously disappeared, too!

I just did "rm -rf" on my Subsurface-mobile.app, then rebuilt it.  I
wanted to reproduce the problem that forced me to run macdeployqt to
get the QtQuick qml files in the right spots.

After my "rm -rf" and rebuild, Subsurface-mobile.app just launches!
Now it did not require the manual macdeployqt step.
_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to