MakeFile

Hi,
I am trying to work with make files and it works fine, in the sense that it “makes” fine and doesnt complain
but when I run it I get the following error

Load Error: Failed to load Dynamic link library /afs/cern.ch/user/f/fsoomro/RichMDM/27may/./lib/libwhatever.sl
(int)(-1)

I have got one file in my src directory and one in the include directory.
Can anyone tell me what mistake am I making?

Regards
Fatima Soomro

Hi,

I cannot tell. You’ll have to at least provide us with the Makefile you’re using. Alternatively you could just do “.L myfile.cxx+” within ROOT, that way you don’t need to write or maintain any Makefile and the result is the same.

Cheers, Axel.

Ok, so the following is my Make File

#-----------------------------------------------------------------------
CXX = g++
CXXFLAGS = -fPIC -Wall
LD = g++
SOFLAGS = -shared

ROOTCFLAGS := $(shell ${ROOTSYS}/bin/root-config --cflags)
ROOTLIBS := $(shell ${ROOTSYS}/bin/root-config --libs)

LIBS += $(ROOTLIBS) -lMinuit
CXXFLAGS += $(ROOTCFLAGS) -Iinclude

#-----------------------------------------------------------------------

files to compile

HDRS = whatever.h

SRCS = whatever.cpp

LIB = lib/libwhatever.sl

vpath %.h ${PWD}/include
vpath %.cpp ${PWD}/src

#-----------------------------------------------------------------------

generate root dictionary, compile and link togther into shared library

all : $(LIB)

$(LIB) : $(SRCS) lib/whateverdict.cpp
@echo “Linking: $(LIB)”
@/bin/rm -f $(LIB)
@echo “Source files:” $^
@$(LD) $(SOFLAGS) $(CXXFLAGS) $(LIBS) -o $@ $^
@echo “Done!”

clean:
@rm -f $(LIB) lib/whateverdict.* core

lib/whateverdict.cpp: $(HDRS)
@rm -f $@
@echo "Generating dictionary: " $@
@echo " from: " $^
${ROOTSYS}/bin/rootcint $@ -c $^
#----------------------------------------------------------------------

I do work with the .L filename ++ but I wanted to move to make file since it becomes increasingly difficult when the number of files increases.
So I was just trying out using only one file at the moment…

Regards
Fatima Soomro

Hi,

I don’t see anything wrong with your Makefile. Is there no other message but “Load Error: Failed to load Dynamic link library /afs/cern.ch/user/f/fsoomro/RichMDM/27may/./lib/libwhatever.sl
(int)(-1)”? Usually it should also state why it failed - missing symbol or whatever. Is there any library other than the libCore and libCint that libwhatever depends on? You’ll have to load them into ROOT before loading libwhatever. I cannot access the library; otherwise I could have checked what it depends on.

On the “.L whatever.C+”: you can #include several sources in one source, and then just load that one source into ROOT. Or you can write a driver script that calls gROOT->ProcessLine(".L file1.C+") for all the files that you need to load. That way you stay platform independent; converting your Makefile into something that works e.g. on a Mac or on Windows is much, much more work.

Cheers, Axel.