Message: Help linking shared library to Geant4 executable with makefile Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Help linking shared library to Geant4 executable with makefile 

Forum: Installation and Configuration
Date: 02 Mar, 2012
From: Johnathan Sparger <Johnathan Sparger>

Hi, (sorry if I double post, but it looks like the last email
contained some html tags)

I am trying to link a shared library which contains my dictionaries
for ROOT. This library is called RootDictionaryLib.so. I have modified
my makefile to include these lines:


PPFLAGS += -I/Users/jsparger/spring2012/nbd/nbd/branches/doi/root_dict
EXTRALIBS += /Users/jsparger/spring2012/nbd/nbd/branches/doi/root_dict/RootDictionaryLib.so
EXTRA_LINK_DEPENDENCIES :=
/Users/jsparger/spring2012/nbd/nbd/branches/doi/root_dict/RootDictionaryLib.so


when I type make, everything compiles fine. However, when I try to run
the program, I get this error:

dyld: Library not loaded: RootDictionaryLib.so
  Referenced from:
/Users/jsparger/spring2012/nbd/nbd/branches/doi/./bin/Darwin-g++/neutronBlockDetector
  Reason: image not found
Trace/BPT trap


I have tried running the executable in a script with LD_LIBRARY_PATH
set to /Users/jsparger/spring2012/nbd/nbd/branches/doi/root_dict/, but
it doesn't seem to help at all.

Could someone explain how I can link this ROOT library? I noticed the
examples here:

http://geant4.web.cern.ch/geant4/G4UsersDocuments/UsersGuides/ForApplicationDeveloper/html/Appendix/makeFile.html

only used static libraries. Is there a different process for a shared
library? I'll copy my makefile below.

Thank you
--John





My makefile:
#######################################################

name := neutronBlockDetector
G4TARGET := $(name)
G4EXLIB := true
G4WORKDIR := ./

# to add an external library (root dictionary library)
CPPFLAGS += -I/Users/jsparger/spring2012/nbd/nbd/branches/doi/root_dict
EXTRALIBS += /Users/jsparger/spring2012/nbd/nbd/branches/doi/root_dict/RootDictionaryLib.dylib
EXTRA_LINK_DEPENDENCIES :=
/Users/jsparger/spring2012/nbd/nbd/branches/doi/root_dict/RootDictionaryLib.dylib


ifndef G4INSTALL
  G4INSTALL = ../../..
endif

.PHONY: all
all: lib bin

include $(G4INSTALL)/config/binmake.gmk


ifndef G4UI_USE_ROOT
    ROOTCPPFLAGS   = $(shell root-config --cflags)
    CPPFLAGS      += -DG4ANALYSIS_USE_ROOT $(ROOTCPPFLAGS)
    CPPFLAGS      +=-Wno-deprecated
    ROOTLIBS       = $(shell root-config --nonew --glibs)
    ROOTLIBS      := $(filter-out -lNew,$(ROOTLIBS))
    ROOTLIBS      += -lMinuit -lHtml
    LDLIBS        += $(ROOTLIBS)
  endif

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

1 News: Re: Help linking shared library to Geant4 executable with makefile   (Ben Morgan - 02 Mar, 2012)
 Add Message Add Message
to: "Help linking shared library to Geant4 executable with makefile"

 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 ]