Problem 1302

Summary: Linking problem during build stage "ld: framework not found QtGui"
Product: Geant4 Reporter: Liam Gaffney <lg>
Component: cmakeAssignee: Ben Morgan <Ben.Morgan>
Status: CLOSED FIXED    
Severity: normal    
Priority: P5    
Version: 9.5   
Hardware: Apple   
OS: Mac OS X   
Attachments: output of "cmake -DCMAKE_INSTALL_PREFIX=/usr/apps/geant -DGEANT4_USE_QT=ON -DEXPAT_LIBRARY=/opt/local/lib/libexpat.dylib ../geant4.9.5.p01"
UPDATED, clean: output of "make -j2 VERBOSE=1"
output of "cmake -DCMAKE_INSTALL_PREFIX=/usr/apps/geant -DGEANT4_USE_QT=ON -DEXPAT_LIBRARY=/opt/local/lib/libexpat.dylib -DGEANT4_INSTALL_DATA=ON ../geant4.9.5.p01"

Description Liam Gaffney 2012-04-10 16:43:32 CEST
Created attachment 156 [details]
output of "cmake -DCMAKE_INSTALL_PREFIX=/usr/apps/geant -DGEANT4_USE_QT=ON -DEXPAT_LIBRARY=/opt/local/lib/libexpat.dylib ../geant4.9.5.p01"

Hi all,

I'm trying to build geant4.9.5.p01 on Mac OS 10.5.8 and I am having a problem with  linking to Qt libraries. I installed Qt4.8.0 via macports and the non-standard installation directory is found ok by cmake (output attached). However, during the "make -j2" phase an error is reported as below:


$ make -j2
[  0%] Built target G4zlib
[  0%] Built target G4gl2ps
[  3%] Built target G4clhep
[  4%] Built target G4global
[  4%] Built target G4analysis
[  5%] Built target G4intercoms
[  6%] [  6%] Built target G4graphics_reps
Built target G4materials
Linking CXX shared library ../../outputs/library/Darwin-g++/libG4interfaces.dylib
ld: framework not found QtGui
collect2: ld returned 1 exit status
make[2]: *** [outputs/library/Darwin-g++/libG4interfaces.dylib] Error 1
make[1]: *** [source/interfaces/CMakeFiles/G4interfaces.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 16%] Built target G4geometry
make: *** [all] Error 2


I've done much googling and fiddling but with no success... Any help would be appreciated.
Cheers,
Liam
Comment 1 Ben Morgan 2012-04-19 20:44:08 CEST
Just to note that we don't support Mac Leopard - however, it is useful to get feedback on MacPorts.

What is the output (i.e. the link command) if you run with

make VERBOSE=1

? Have you also tried installing the Nokia supplied dmg for Qt 4.8.0?

Cheers,

Ben.
Comment 2 Liam Gaffney 2012-04-24 18:06:22 CEST
Created attachment 160 [details]
UPDATED, clean: output of "make -j2 VERBOSE=1"
Comment 3 Liam Gaffney 2012-04-24 18:09:00 CEST
Hi, 

After running with make rather than make -j2, it seemed not to complain...? I don't know what happened.

Attached is the output of make VERBOSE=1


The only problem I now have is the Qt includes are not correctly defined:
/opt/local/lib/QtCore.framework/Headers/qobject.h:47:32: fatal error: QtCore/qobjectdefs.h: No such file or directory
i.e. the lines like '#include "QtCore/qobjectdefs.h"' in qobject.h should probably not have the leading directory QtCore/. But this is definitely a macports issue unless the include path can be adjusted to correct for this, but I can't see a way.

Sorry for the lack of information...
Liam
Comment 4 Ben Morgan 2012-04-24 19:29:21 CEST
I realize this will be annoying, but could you do a completely clean build:

1) Unpack the Geant4 tar.gz again in a new location.
2) Create a new build directory.
3) Run CMake, and post here the terminal output AND the CMakeCache.txt file
4) Run make -j2 VERBOSE=1 and post the output here.

It's just that I want to see the complete sequence of configuration and build.
There's nothing obviously wrong with the output you posted, but I'd like to see a from scratch run.

If you still see errors, run make clean, and then make again (without j2) and post the output here.
Comment 5 Liam Gaffney 2012-04-25 00:20:19 CEST
Created attachment 161 [details]
output of "cmake -DCMAKE_INSTALL_PREFIX=/usr/apps/geant -DGEANT4_USE_QT=ON -DEXPAT_LIBRARY=/opt/local/lib/libexpat.dylib -DGEANT4_INSTALL_DATA=ON ../geant4.9.5.p01"
Comment 6 Liam Gaffney 2012-04-25 00:46:00 CEST
So it worked... I know what the change I made was. I re-installed qt4 from macports *without* building frameworks. To be clear, the first error came when qt4 was built with QtCore.framework etc...

One thing though, I get this error when building anything that includes architecture.gmk

g++: error: unrecognized option '-arch_multiple'

which I fixed by removing the '-arch_multiple' from LDFLAGS in sys/Darwin-g++.gmk. You may already be aware of this though? I think it comes from using the non-Apple gcc46.
Comment 7 Ben Morgan 2012-04-27 18:24:23 CEST
I'm a bit surprised at Qt Frameworks not working on MacPorts, but then again it hasn't been tested before.

The g++ error is, I believe, due to non-Apple gcc not supporting universal binaries. Your patch should work provided you build everything using MacPorts tools.

I'm marking this RESOLVED FIXED.