Message: Re: OpenGL in 4.9.5 [Continued from Visualization forum] Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

More Re: OpenGL in 4.9.5 [Continued from Visualization forum] 

Forum: Installation and Configuration
Re: None Re: OpenGL in 4.9.5 [Continued from Visualization forum] (Joel Long)
Re: None Re: OpenGL in 4.9.5 [Continued from Visualization forum] (Bethany)
Date: 26 Jul, 2012
From: Joel Long <Joel Long>

Hello Bethany,

It looks to me like you are using external libraries in your code. You have to use cmake to define these library dependencies. I try to avoid this process, but I have a rough idea how it works. I have modified the CMakeLists.txt and reattached to reflect where you need to include information about any external libraries.

The trick is that you need to know:

1. What external libraries you are using.
2. Where those libraries are (if they are on your library path, this won't matter, but if they aren't, you will have to specify the appropriate path for the linker to search). 
3. Whether the the external libraries are statically or dynamically linked (fair odds they're dynamically linked, which makes life much easier for you). If the external libraries are statically linked, you will probably have to either:
       a. Recompile Geant4 statically and tell cmake to use static linking for your application.
       b. Recompile the external library (assuming you have access to the source) dynamically. 

Those things are outside my useful experience, which is to say that I've had to do that (to hack MPI support back into 4.9.5) but I did it via trial and error than actual knowledge or understanding. It may be possible, at least in some contexts, to mix dynamic and static linking, but I haven't ever attempted it (you could google something like "mixed dynamic static linking" for more information).

Anyway, see the attached, and hopefully that will help you.

   Attachment:
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2012/07/26/14.19-40365-CMakeLists.txt

On Thu, 26 Jul 2012 20:38:35 GMT, Bethany wrote:

> Hi Joel, Thanks for your help, that CMakeLists file was very helpful. I
> can now run CMake to build a Makefile for my simulation. The Makefile
> compiles my code, but fails when it tries to link. It gives me an
> abundance of errors like this:
> 
> Linking CXX executable dmicesimm CMakeFiles/dmicesimm.dir/dmicesim.cc.o:
> In function `__static_initialization_and_destruction_0(int, int)':
> dmicesim.cc:(.text+0x84e): undefined reference to
> `TVersionCheck::TVersionCheck(int)'
> CMakeFiles/dmicesimm.dir/src/DMISensitiveDetector.cc.o: In function
> `__static_initialization_and_destruction_0(int, int)':
> DMISensitiveDetector.cc:(.text+0x1c2c): undefined reference to
> `TVersionCheck::TVersionCheck(int)'
> CMakeFiles/dmicesimm.dir/src/DMIEventAction.cc.o: In function
> `__static_initialization_and_destruction_0(int, int)':
> DMIEventAction.cc:(.text+0x1e82): undefined reference to
> `TVersionCheck::TVersionCheck(int)'
> CMakeFiles/dmicesimm.dir/src/DMIAnalysisManager.cc.o: In function
> `DMIAnalysisManager::DMIAnalysisManager(std::basic_string<char,
> std::char_traits<char>, std::allocator<char> >&)':
> DMIAnalysisManager.cc:(.text+0x8b): undefined reference to
> `TString::TString(std::basic_string<char, std::char_traits<char>,
> std::allocator<char> > const&)' DMIAnalysisManager.cc:(.text+0xc5):
> undefined reference to `TFile::TFile(char const*, char const*, char
> const*, int)' DMIAnalysisManager.cc:(.text+0xd5): undefined reference to
> `TObject::operator delete(void*)' DMIAnalysisManager.cc:(.text+0xf4):
> undefined reference to `TString::~TString()'
> DMIAnalysisManager.cc:(.text+0x107): undefined reference to
> `TString::~TString()'
> CMakeFiles/dmicesimm.dir/src/DMIAnalysisManager.cc.o: In function
> `DMIAnalysisManager::SetupSensitiveDetectorTree(std::basic_string<char,
> std::char_traits<char>, std::allocator<char> >&,
> std::map<std::basic_string<char, std::char_traits<char>,
> std::allocator<char> >, double, std::less<std::basic_string<char,
> std::char_traits<char>, std::allocator<char> > >,
> std::allocator<std::pair<std::basic_string<char, std::char_traits<char>,
> std::allocator<char> > const, double> > >&)':
> DMIAnalysisManager.cc:(.text+0x96f): undefined reference to
> `TTree::TTree(char const*, char const*, int)'
> DMIAnalysisManager.cc:(.text+0x97f): undefined reference to
> `TObject::operator delete(void*)'
> CMakeFiles/dmicesimm.dir/src/DMIAnalysisManager.cc.o: In function
> `DMIAnalysisManager::SetupEventTree(std::map<std::basic_string<char,
> std::char_traits<char>, std::allocator<char> >, double,
> std::less<std::basic_string<char, std::char_traits<char>,
> std::allocator<char> > >,
> std::allocator<std::pair<std::basic_string<char, std::char_traits<char>,
> std::allocator<char> > const, double> > >&)':
> DMIAnalysisManager.cc:(.text+0xc68): undefined reference to
> `TTree::TTree(char const*, char const*, int)'
> DMIAnalysisManager.cc:(.text+0xc78): undefined reference to
> `TObject::operator delete(void*)'
> CMakeFiles/dmicesimm.dir/src/DMIAnalysisManager.cc.o: In function
> `__static_initialization_and_destruction_0(int, int)':
> DMIAnalysisManager.cc:(.text+0x12af): undefined reference to
> `TVersionCheck::TVersionCheck(int)'
> CMakeFiles/dmicesimm.dir/src/DMIAnalysisManager.cc.o: In function
> `TObject::operator new(unsigned long)':
> DMIAnalysisManager.cc:(.text._ZN7TObjectnwEm[TObject::operator
> new(unsigned long)]+0x14): undefined reference to
> `TStorage::ObjectAlloc(unsigned long)'
> CMakeFiles/dmicesimm.dir/src/DMISteppingAction.cc.o: In function
> `__static_initialization_and_destruction_0(int, int)':
> DMISteppingAction.cc:(.text+0x6d9b): undefined reference to
> `TVersionCheck::TVersionCheck(int)'
> CMakeFiles/dmicesimm.dir/src/CopperRodParameterisation.cc.o: In function
> `__static_initialization_and_destruction_0(int, int)':
> CopperRodParameterisation.cc:(.text+0x28c): undefined reference to
> `TVersionCheck::TVersionCheck(int)'
> CMakeFiles/dmicesimm.dir/src/DMIPrimaryGeneratorAction.cc.o: In function
> `__static_initialization_and_destruction_0(int, int)':
> DMIPrimaryGeneratorAction.cc:(.text+0x2f4): undefined reference to
> `TVersionCheck::TVersionCheck(int)'
> CMakeFiles/dmicesimm.dir/src/DMIDetectorConstruction.cc.o: In function
> `DMIDetectorConstruction::ConstructDMIce()':
> DMIDetectorConstruction.cc:(.text+0x2e7c): undefined reference to
> `Form(char const*, ...)' DMIDetectorConstruction.cc:(.text+0x300b):
> undefined reference to `Form(char const*, ...)'
> DMIDetectorConstruction.cc:(.text+0x3349): undefined reference to
> `Form(char const*, ...)' DMIDetectorConstruction.cc:(.text+0x367b):
> undefined reference to `Form(char const*, ...)'
> DMIDetectorConstruction.cc:(.text+0x396e): undefined reference to
> `Form(char const*, ...)'
> CMakeFiles/dmicesimm.dir/src/DMIDetectorConstruction.cc.o:DMIDetectorConstruction.cc:(.text+0x3d08):
> more undefined references to `Form(char const*, ...)' follow
> CMakeFiles/dmicesimm.dir/src/DMIDetectorConstruction.cc.o: In function
> `__static_initialization_and_destruction_0(int, int)':
> DMIDetectorConstruction.cc:(.text+0xf552): undefined reference to
> `TVersionCheck::TVersionCheck(int)' collect2: ld returned 1 exit status
> make[2]: *** [dmicesimm] Error 1 make[1]: ***
> [CMakeFiles/dmicesimm.dir/all] Error 2 make: *** [all] Error 2
> 
> I don't understand the linking process at all, and when I try to look at
> the file it seems to reference, it is just gibberish(machine code?). I
> don't have any idea where to even start to try to solve this problem. Do
> you have any suggestions?
> 
> ~Bethany
> 
> On Wed, 25 Jul 2012 20:52:45 GMT, Joel Long wrote:
> 
> > Hey Bethany, You will definitely need to update to the cmake build
> > system properly or your simulation won't run correctly (though, as you
> > have discovered, it might run). First, remove "GNUmakefile" from your
> > build directory if it is there (that is part of the old build system and
> > will only confuse things). Then modify cmakelists.txt (more on that in a
> > moment). Then run cmake as per the instructions you found. That should
> > create a file called Makefile in your build directory. In the terminal,
> > navigate to that directory, then run "make".
> > 
> > I am attaching the text of the basic CMakeLists below. I will put things
> > you will potentially need to change in [[ ]] with some comments to help
> > you.
> > 
> > I am also going to repost this in the Installation and Configuration
> > section, since it turns out that is what your issue is. Please post
> > further replies there.
> > 
> 

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: OpenGL in 4.9.5 [Continued from Visualization forum]   (Bethany - 26 Jul, 2012)
1 More: Re: OpenGL in 4.9.5 [Continued from Visualization forum]   (Joel Long - 26 Jul, 2012)
2 Note: Re: OpenGL in 4.9.5 [Continued from Visualization forum]   (Ben Morgan - 27 Jul, 2012)
 Add Message Add Message
to: "Re: OpenGL in 4.9.5 [Continued from Visualization forum]"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]