- I’m using Mac OS 10.12.3 and Root version 6.09.01
I’m trying to use a local copy of a library “TUnfold.” In order to do so, I need to be able to compile the library and obtain either .so library file or .a library file (I think .so file is preferred, but not entirely sure).
Based on the README that comes with the library, running “make lib” on the command line is supposed to create “libunfold.so” file. However, based on the Makefile, it seems like if my OSTYPE is NOT Linux, then running “make lib” would generate “libunfold.a” file instead of “libunfold.so” file, and it indeed does so.
(By the way, running “uname” on my computer to check OSTYPE returns “Darwin”).
The problem is that currently I’m not able to employ the “libunfold.a” file that is generated by running “$ make lib” on the command line. The only way to check if this is working or not for me at this moment is try running
$ gSystem->Load(“libunfold.a”)
in Root interactive mode (installed in my laptop). This is supposed to return 0 if the library is loaded correctly, and -1 in case the library does not exist or has error. I’m getting -1, and have no idea how else to proceed.
To compile and link independently rather than using the makefile that comes with TUnfold, I tried running
$ c++ -isystem /dir/root/include -I/dir/root/htmldoc -I. -O2 -g -Wall -Wshadow -W -Woverloaded-virtual -fPIC -pthread -stdlib=libc++ -std=c++11 -m64 -I/Users/lylekim/Applications/root/include -c TUnfoldV17.cxx -o TUnfoldV17.o
to obtain .o file (the command above is directly taken from the Makefile, and it does generate .o file), and then running
$ g++ -shared -o libtunfold.so TUnfoldV17.o
in the hope of obtaining .so file, but it created a huge error starting with the line “Undefined symbols for architecture x86_64: …”
Interestingly, when I build the Root with its source file, it can somehow correctly compile and link TUnfold library that comes with Root, and generates the correct libunfold.so file. To verify this, I added some print statement to the source file of TUnfold that comes with Root, and re-built the entire Root, and checked that using the library that gets generated by building the entire root does print out the print statement that I included. So it will be great if I can somehow just compile TUnfold instead of building the entire Root.
Thanks for any help in advance.