I downloaded binary 3.10/01 and my environment is:
gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-113)
After setting up ROOTSYS and LD_LIBRARY_PATH, I set out to compile a set of private C library into a shared object so that I can call the functions in root. Everything went fine until the actual .so creation:
$(testSO): $(OBJS) $(Dict_OBJS)
$(LD) $(SOFLAGS) $(LDFLAGS) $^ $(OutPutOpt) $@
where LD = g++. It somehow doesn’t know how to use root-config as shown below:
Usage: root-config [–prefix[=DIR]] [–exec-prefix[=DIR]] [–version] [–cflags] [–new] [–nonew] [–libs] [–glibs] [–libdir] [–incdir] [–noauxcflags] [–noauxlibs] [–noldflags] [–has-] [–arch] [–help]
g++ -shared -O src1.o src2.o testDict.o -o test.so
Can anyone help? Thanks.
From your mail, it is not clear what is the problem and why you suspect root-config.
To use root-config, you can do, eg:
g++ -c file.cxx
or to compile and link
g++ -o x.exe file.cxx
root-config --cflags --glibs
supposedly you have
and when make tries to “create” LDFLAGS, root-config complains about an invalid argument. So check the invocations of root-config in your Makefile - you’re passing an invalid argument somewhere.
Thank you very much for your prompt reply. I found that the old LDFLAG was not working and updated my Makefile from the new Makefile in the release 3.10.01. Now, after I compilled my private c functions into shared object and load it in root, root complains that it couldn’t resolve the function. I suspect it needs a function declaration, but don’t know where I should put it. Attached is everything I use to do this thing (A very simple test package). Your help in debugging it will be greatly appreciated.
test.tar.gz (2.21 KB)
You declared ran1 as C function
but you compiled it a C++
$(OBJS): %.o: %.c
$(CXX) $(CXXFLAGS) -c $^
You need to have the 2 agree (to either both be C or both be C++).