Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 344119 - sci-physics/geant-4.9.3_p02: fails with --as-needed
Summary: sci-physics/geant-4.9.3_p02: fails with --as-needed
Status: VERIFIED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Science Physics related packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: as-needed
  Show dependency tree
 
Reported: 2010-11-04 14:41 UTC by Rafal Lalik
Modified: 2010-11-08 20:17 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rafal Lalik 2010-11-04 14:41:05 UTC
Firstly,

when Geant4 is compiled with Qt4 support, then /usr/lib/geant4/libG4UI* libraries are also compiled against Qt. Problem appears when you try to compile some program (like Geant4 examples). Then linker cannot find references (a few lines from log below:
/usr/lib64/geant4/libG4UIbasic.so: undefined reference to `QSignalMapper::QSignalMapper(QObject*)'
/usr/lib64/geant4/libG4UIbasic.so: undefined reference to `QListWidget::currentRow() const'
/usr/lib64/geant4/libG4UIcommon.so: undefined reference to `QCoreApplication::self'
/usr/lib64/geant4/libG4UIbasic.so: undefined reference to `QTreeView::resizeColumnToContents(int)'
). This is because makefile scripts for Geant4 are looking for env variable called G4UI_USE_QT=1 which by default is not set. I recommend to put this variable also to env script always when qt4 use flag is set for geant otherwise user has to do it by himself.

This variable is set in $G4INSTALL/scripts/env.sh.SH script which prepares whole environment for Geant.


Secondly,
G4WORKDIR is profile related (becasue it points to ${HOME} thus it cannot be set in /etc/env.d/ conf because it points to root-user home directory. Definition of this should be moved to /etc/profile.d/ where it can be set for each user independently.


Greetings,
Rafal
Comment 1 Kacper Kowalik (Xarthisius) (RETIRED) gentoo-dev 2010-11-07 19:52:17 UTC
(In reply to comment #0)

> This is because makefile scripts for Geant4 are looking for env variable
called G4UI_USE_QT=1 
<snip> 

nah, that's due to wrong linking order:
$(CXX) -Wl,--hash-style=gnu,-O1 -Wl,--as-needed -Wl,-soname,$(@F) -shared -o $$libdir/$(@F) $(INTYLIBS) *.o



Comment 2 Rafal Lalik 2010-11-07 21:09:43 UTC
It is nothing with linking order, first executed is this code (grep from files in /usr/share/geant4):

G4UI_USE.gmk:62:ifdef G4UI_USE_QT
G4UI_USE.gmk-63-  G4UI_USE  = 1
G4UI_USE.gmk-64-  G4INTY_USE_QT = 1
G4UI_USE.gmk-65-  INC_QT   = 1
G4UI_USE.gmk-66-  LOAD_QT   = 1
G4UI_USE.gmk:67:  CPPFLAGS += -DG4UI_USE_QT
G4UI_USE.gmk-68-endif

next this one:

interactivity.gmk-31-ifdef LOAD_QT
interactivity.gmk:32:  INTYLIBS += $(QTLIBS)
interactivity.gmk-33-endif

and then libraries are linked. Without this Qt is not included in INTYLIBS


What more, some of installation locations and environment variables are wrong also, here is diff of my and original ebuild:

182c178
<       export G4LIB=${GEANT4_LIBDIR}/${G4SYSTEM}
---
>       export G4LIB=${GEANT4_LIBDIR}
221c217
<       insinto ${GEANT4_LIBDIR}/${G4SYSTEM}
---
>       insinto ${GEANT4_LIBDIR}
229c225
<       exeinto ${GEANT4_LIBDIR}/${G4SYSTEM}
---
>       exeinto ${GEANT4_LIBDIR}

This changes are required by Geant as well as 3rd party soft (like ROOT). Geant is looking for libraries in location including G4SYSTEM value, for example (it is only one of a few):

scripts/env.sh.SH:            LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${G4LIB}/${G4SYSTEM}
scripts/env.sh.SH:            LD_LIBRARY_PATH=${G4LIB}/${G4SYSTEM}
scripts/env.sh.SH:            DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:${G4LIB}/${G4SYSTEM}
scripts/env.sh.SH:            DYLD_LIBRARY_PATH=${G4LIB}/${G4SYSTEM}

Also set of Geant's makefiles take into account value of G4SYSTEM so you cannot ignore it. Try to compile examples from Geant is everything working fine with gentoo's way of installing.

Greetings,
Rafal
Comment 3 Kacper Kowalik (Xarthisius) (RETIRED) gentoo-dev 2010-11-07 21:17:13 UTC
+*geant-4.9.3_p02-r1 (07 Nov 2010)
+
+  07 Nov 2010; Kacper Kowalik <xarthisius@gentoo.org>
+  -geant-4.9.3_p01.ebuild, -geant-4.9.3_p02.ebuild,
+  +geant-4.9.3_p02-r1.ebuild, +files/geant-4.9.3-respect_flags.patch:
+  Fix building with --as-needed wrt bug 344119, respect CXX. Drop old.

(In reply to comment #2)
Try geant-4.9.3_p02-r1 and reopen if issue persists.

(In reply to comment #0)
> Secondly,
> G4WORKDIR is profile related (becasue it points to ${HOME} thus it cannot be
> set in /etc/env.d/ conf because it points to root-user home directory.
> Definition of this should be moved to /etc/profile.d/ where it can be set for
> each user independently.
I don't exactly understand the problem here, but you can always override it by
export G4WORKDIR in your bashrc. If that's not enough please open another bug for second issue.
Comment 4 Rafal Lalik 2010-11-07 21:31:02 UTC
(In reply to comment #3)
> I don't exactly understand the problem here, but you can always override it by
> export G4WORKDIR in your bashrc. If that's not enough please open another bug
> for second issue.

Problem is that, in env file (/etc/env.d/99geant) G4WORKDIR is defined as ${HOME}/geant4, that means when env-update is called, ${HOME} is substituted with "/root" and on the end in the system environment this variable is G4WORKDIR=/root/geant
It is obviously wrong, because it is the same for all users and what more, root user should never be used for working with geant (just general safety procedure).
Also explanation, that you can redefine it in your bash profile is wrong, because doing it wrong (in env) and asking to repair in own profile is not good way, right? So I propose to create profile file (in profile.d) with correct declaration of G4WORKDIR variable and remove it from env.d.
Comment 5 Kacper Kowalik (Xarthisius) (RETIRED) gentoo-dev 2010-11-07 21:45:57 UTC
(In reply to comment #4)

> Problem is that, in env file (/etc/env.d/99geant) G4WORKDIR is defined as
> ${HOME}/geant4, that means when env-update is called, ${HOME} is substituted
> with "/root" 
No, it's not substituted. Do a simple check: echo $G4WORKDIR
${HOME}/geant4

Furthermore it works as it should be

xarth@janus02 ~ $ echo $G4WORKDIR
${HOME}/geant4
xarth@janus02 ~ $ pwd && ls -la
/home/xarth
total 16
drwxr-xr-x 2 xarth root  4096 Nov  7 22:43 .
drwxr-xr-x 3 root  root  4096 Feb 10  2010 ..
-rw------- 1 xarth xarth   16 Feb 10  2010 .bash_history
-rw------- 1 xarth xarth  597 Nov  7 22:42 .viminfo
xarth@janus02 ~ $ cp -r /usr/share/doc/geant-4.9.3_p02/examples . && make -j9 -C examples
make: Entering directory `/home/xarth/examples'
Making dependency for file src/ExN01DetectorConstruction.cc ...
Making dependency for file src/ExN01PrimaryGeneratorAction.cc ...
Making dependency for file src/ExN01PhysicsList.cc ...
Making dependency for file exampleN01.cc ...
Compiling ExN01PhysicsList.cc ...
Compiling ExN01PrimaryGeneratorAction.cc ...
Compiling ExN01DetectorConstruction.cc ...
Compiling exampleN01.cc ...
Creating shared library /home/xarth/geant4/tmp/Linux-g++/exampleN01/libexampleN01.so ...
Using granular libraries ...
Linking exampleN01
... Done!
^Cmake[1]: *** [all] Interrupt
make: *** [all] Interrupt

xarth@janus02 ~ $ ls -l  
total 8
drwxr-xr-x 5 xarth xarth 4096 Nov  7 22:44 examples
drwxr-xr-x 4 xarth xarth 4096 Nov  7 22:44 geant4
Comment 6 Rafal Lalik 2010-11-07 23:25:07 UTC
(In reply to comment #5)
> No, it's not substituted. Do a simple check: echo $G4WORKDIR
> ${HOME}/geant4

You are right, now it is fine, maybe I mixed something before, sorry.

> Furthermore it works as it should be
> 
> xarth@janus02 ~ $ echo $G4WORKDIR
> ${HOME}/geant4
> xarth@janus02 ~ $ pwd && ls -la
> /home/xarth
> total 16
> drwxr-xr-x 2 xarth root  4096 Nov  7 22:43 .
> drwxr-xr-x 3 root  root  4096 Feb 10  2010 ..
> -rw------- 1 xarth xarth   16 Feb 10  2010 .bash_history
> -rw------- 1 xarth xarth  597 Nov  7 22:42 .viminfo
> xarth@janus02 ~ $ cp -r /usr/share/doc/geant-4.9.3_p02/examples . && make -j9
> -C examples
> make: Entering directory `/home/xarth/examples'
> Making dependency for file src/ExN01DetectorConstruction.cc ...
> Making dependency for file src/ExN01PrimaryGeneratorAction.cc ...
> Making dependency for file src/ExN01PhysicsList.cc ...
> Making dependency for file exampleN01.cc ...
> Compiling ExN01PhysicsList.cc ...
> Compiling ExN01PrimaryGeneratorAction.cc ...
> Compiling ExN01DetectorConstruction.cc ...
> Compiling exampleN01.cc ...
> Creating shared library
> /home/xarth/geant4/tmp/Linux-g++/exampleN01/libexampleN01.so ...
> Using granular libraries ...
> Linking exampleN01
> ... Done!
> ^Cmake[1]: *** [all] Interrupt
> make: *** [all] Interrupt
> 
> xarth@janus02 ~ $ ls -l  
> total 8
> drwxr-xr-x 5 xarth xarth 4096 Nov  7 22:44 examples
> drwxr-xr-x 4 xarth xarth 4096 Nov  7 22:44 geant4

Is you geant compiled with USE="qt4"? If not then you don't have this problem.

According to my other suggestions, now I see there were some changes in a few last ROOT releases and also you do some fixups in geant files, so my and your installation weren't the same. So my suggestions are invalid, but Qt4 issue is still open.
Comment 7 Kacper Kowalik (Xarthisius) (RETIRED) gentoo-dev 2010-11-08 07:12:34 UTC
(In reply to comment #6)
> Is you geant compiled with USE="qt4"? If not then you don't have this problem.
[ebuild   R   ] sci-physics/geant-4.9.3_p02-r1  USE="data examples motif opengl qt4 raytracerx vrml zlib -athena -dawn -debug -gdml -geant3 -global -minimal -openinventor -static-libs" 0 kB [1]
janus02 Linux-g++ # ldd /usr/lib/geant4/libG4UIcommon.so | grep Qt
	libQtCore.so.4 => /usr/lib/qt4/libQtCore.so.4 (0xf74e0000)
	libQtGui.so.4 => /usr/lib/qt4/libQtGui.so.4 (0xf6aa5000)
janus02 Linux-g++ # ldd exampleN03 | grep Qt
	libQtCore.so.4 => /usr/lib/qt4/libQtCore.so.4 (0xf618e000)
	libQtGui.so.4 => /usr/lib/qt4/libQtGui.so.4 (0xf5752000)

> but Qt4 issue is still open.
Have you installed geant-4.9.3_p02-r1? Does it still fail for you?
Cheers,
Kacper
Comment 8 Rafal Lalik 2010-11-08 20:17:32 UTC
Works fine, thx, however I don't (or maybe is better to say: I'm not convinced yet) like way you do it. Here in Gentoo you have only Geant package, but there is also a set of other applications which integrate with Geant, like VMC or VGM. I must check now whether everything is OK but so far I don't see any problems.

Rafal