pcp
[Top] [All Lists]

Build question (OSX related perhaps)

To: pcp@xxxxxxxxxxx
Subject: Build question (OSX related perhaps)
From: Paul Smith <psmith@xxxxxxxxxx>
Date: Fri, 11 Dec 2015 09:38:15 +1100
Delivered-to: pcp@xxxxxxxxxxx
I'm narrowing in on getting PCP to build on OSX for me, including the 
pmchart+QT stuff.

At the moment it looks like the Build system is coupled to QT being installed 
from the main distribution which is totally rationale I think.  However I'm 
trying to see what changes would be necessary to get PCP to build when Qt has 
been installed via Homebrew, which I think is an easier step for people in the 
OSX community, and as it stands, from what Nathan has said the main Qt 4 
library when downloaded from their distribution, doesn't work on El Capitan.  
However Homebrew does have qt4 and it compiles it from source.

At the moment the pmchart app is being built, but it will not launch, because 
the referenced Frameworks (shared OSX libraries like Qt) are not quite in the 
location it thinks, and in one case it thinks they're in a location that is not 
possible..

My first question relates to how pmchart gets built, I'm going to guess it's 
the src/pmchart/GNUmakefile.  This seems to do some stuff for OSX around 
building the OSX Application bundle.

My first confusion is that it appears superficially to be trying to build in 
/Applications/pmchart.app.  When my failure occurs, there's a basic shell of 
the OSX bundle in this location, but not much else.

I do see another OSX bundle here:

./pcp-3.10.9/src/pmchart/build/release/pmchart.app

More confusion, I see these in the logs:

./../install-sh -o root -g wheel -m 644 
build/release/pmchart.app/Contents/PkgInfo 
/Applications/pmchart.app/Contents/PkgInfo
../../install-sh -o root -g wheel -m 644 pmchart.info 
/Applications/pmchart.app/Contents/Info.plist
../../install-sh -o root -g wheel -m 755 -d 
/Applications/pmchart.app/Contents/MacOS

**QUESTION**: So, is the /Applications/pmchart.app the real final destination 
binary?  Or is it the ./pcp-3.10.9/src/pmchart/build/release/pmchart.app one? 

The reason I get confused is that later in the build cycle, I believe as part 
of builddefs.in, where it uses the Xcode `otool` to list dependent frameworks, 
it ends up executing:

[ pmchart ](master)$ otool -L build/release/pmchart.app/Contents/MacOS/pmchart
build/release/pmchart.app/Contents/MacOS/pmchart:
        libpcp.3.dylib (compatibility version 0.0.0, current version 0.0.0)
        
/Library/PCP/Frameworks//usr/local/opt/qt/lib/QtSvg.framework/Versions/4/QtSvg 
(compatibility version 4.8.0, current version 4.8.7)
        /usr/local/opt/qt/lib/QtGui.framework/Versions/4/QtGui (compatibility 
version 4.8.0, current version 4.8.7)
        /usr/local/opt/qt/lib/QtCore.framework/Versions/4/QtCore (compatibility 
version 4.8.0, current version 4.8.7)
        /usr/local/opt/qt/lib/QtNetwork.framework/Versions/4/QtNetwork 
(compatibility version 4.8.0, current version 4.8.7)
        /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current 
version 104.1.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current 
version 1226.10.1)
        /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 
913.0.0)


See builddefs.in line 760-ish

so we seem to have 2 copies of pmchart.app going on at the same time, what each 
is used for is unclear to me.

Anyway, next problem I face is that you can see in the above listing of otool 
that the QtSvg library it thinks it's linked against is in a weird location.

        
/Library/PCP/Frameworks//usr/local/opt/qt/lib/QtSvg.framework/Versions/4/QtSvg 
(compatibility version 4.8.0, current version 4.8.7)


This path does not exist, and seems to be a a function of an attempt to copy 
the QtSvg Framework.  I had manually hacked this file to copy the right 
location by doing this:

diff --git a/src/include/builddefs.in b/src/include/builddefs.in
index fa83900..15b1acc 100644
--- a/src/include/builddefs.in
+++ b/src/include/builddefs.in
@@ -756,7 +756,7 @@ INSTALL_QT_FRAMEWORKS=\
        $(call 
INSTALL_DIRECTORY_HIERARCHY,$(MAC_FRAMEWORKS_DIR)/$$tdir,/Library/PCP); \
        mkdir -p frameworks/$$tdir || exit 1; \
        fwqt="frameworks/$$qt"; \
-       cp /Library/Frameworks/$$qt frameworks/$$qt || exit 1; \
+       cp /usr/local/Cellar/qt/4.8.7_1/lib/QtSvg.framework/Versions/4/$$qt 
frameworks/$$qt || exit 1; \
        otool -L $$fwqt | awk '{if (NR != 1) {print $$1}}' |\
        egrep 'Qt.*\.framework' | while read dep; do \
            install_name_tool -change $$dep $(MAC_FRAMEWORKS_DIR)/$$dep $$fwqt;\



Somehow the fully qualified path to the QtSvg framework is being found, and 
then copied into here:

pcp-3.10.9/src/pmchart/frameworks/usr/local/opt/qt/lib/QtSvg.framework

I can't quite work out where that is doing this deep directory tree copy rather 
than just taking that root 'QtSvg.framework' directory and putting tin the root 
of 'framework's ?

This is the bit I can't find, where does it do that directory copy ? By the 
looks of it the `$qt` variable is coming from:

    otool -L $(1) | awk '{if (NR != 1) {print $$1}}' |\
    egrep 'Qt.*\.framework' | while read qt; do \

but then I saw this:

$(call INSTALL_DIRECTORY_HIERARCHY,$(MAC_FRAMEWORKS_DIR)/$$tdir,/Library/PCP); \

Which looks to be trying to do something in /Library/PCP which contains the 
QtSvg in this root:

[ Frameworks ]$ ll /Library/PCP/Frameworks/
total 0
drwxr-xr-x  6 root  wheel   204B 30 Oct 14:30 .
drwxr-xr-x  5 root  wheel   170B 30 Oct 14:30 ..
drwxr-xr-x  3 root  wheel   102B 30 Oct 14:30 QtCore.framework
drwxr-xr-x  3 root  wheel   102B 30 Oct 14:30 QtGui.framework
drwxr-xr-x  3 root  wheel   102B 30 Oct 14:30 QtNetwork.framework
drwxr-xr-x  3 root  wheel   102B 30 Oct 14:30 QtSvg.framework

Given the timestamps, this copy of QtSvg might be from a previous install of Qt 
(not homebrew).

So I guess I'm a bit stuck trying to work out where the directory reference of 
'/usr/local/.....' is being appended into one of the copies..?

If this doesn't sound clear, that's probably because it isn't.  I'm now lost in 
a bit of a forest of a build system new to me.

any pointers would be appreciated!

cheers,

Paul
<Prev in Thread] Current Thread [Next in Thread>