Library not found for -l:/Users/... While file exists! (OSX)

Dear rooters,

I hope this is the right forum to ask for. Please apologies if not and redirect me if possible.

I am working on sevaral machines, some are scientific linux, others are MAC. I get some code (using root) through github and this code works very well on scientific linux but I don’t succeed to compile it on MAC. It seems to be a linking problem. Down here, I will join all the information about the problem I face. I would be very happy if someone coudl find a hint for a solution.

The information:

  1. The output with the error when i try to compile with make:

g++ -std=c++0x -O -Wall -fPIC -Wno-unused-result -Wshadow -pthread -stdlib=libc++ -m64 -I/Users/vanhove/root/root/include -I./ -I…/…/sonicScrewdriver/ -g -v -O -Wall -fPIC -Wl,-undefined,error -L/Users/vanhove/root/root/lib -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lpthread -Wl,-rpath,/Users/vanhove/root/root/lib -stdlib=libc++ -lm -ldl -lEG -lTMVA -l:pwd/…/…/sonicScrewdriver/libSonicScrewdriver.so -l:pwd/…/…/.vectorDictionnary_C.so -o test.run test.C
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
“/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang” -cc1 -triple x86_64-apple-macosx10.9.0 -emit-obj -disable-free -disable-llvm-verifier -main-file-name test.C -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 236.3 -v -gdwarf-2 -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/…/lib/clang/5.1 -I /Users/vanhove/root/root/include -I ./ -I …/…/sonicScrewdriver/ -stdlib=libc++ -stdlib=libc++ -O2 -Wall -Wno-unused-result -Wshadow -Wall -std=c++0x -fdeprecated-macro -fdebug-compilation-dir /Users/vanhove/0_Analyses/stopPair/combinedOneLeptonStopAnalysis/wTagging/miscTests -ferror-limit 19 -fmessage-length 177 -pthread -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.9.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o /var/folders/_g/x2qbwgc55n1grz79ld0ylpq00000gp/T/test-824aa2.o -x c++ test.C
clang -cc1 version 5.1 based upon LLVM 3.4svn default target x86_64-apple-darwin13.4.0
ignoring nonexistent directory “/usr/include/c++/v1”
#include “…” search starts here:
#include <…> search starts here:
/Users/vanhove/root/root/include
.
…/…/sonicScrewdriver
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/…/lib/c++/v1
/usr/local/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/…/lib/clang/5.1/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
In file included from test.C:1:
In file included from ./…/common.h:13:
In file included from …/…/sonicScrewdriver/interface/SonicScrewdriver.h:8:
In file included from …/…/sonicScrewdriver/interface/PlotScrewdriver.h:27:
…/…/sonicScrewdriver/interface/plots/Plot1DDataMCComparison.h:385:42: warning: implicit conversion from ‘double’ to ‘Width_t’ (aka ‘short’) changes value from 0.8 to 0
[-Wliteral-conversion]
newDashline_p->SetLineWidth(0.8);
~~~~~~~~~~~~~ ^~~
…/…/sonicScrewdriver/interface/plots/Plot1DDataMCComparison.h:388:42: warning: implicit conversion from ‘double’ to ‘Width_t’ (aka ‘short’) changes value from 0.8 to 0
[-Wliteral-conversion]
newDashline_m->SetLineWidth(0.8);
~~~~~~~~~~~~~ ^~~
2 warnings generated.
“/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld” -demangle -dynamic -arch x86_64 -macosx_version_min 10.9.0 -o test.run -L/Users/vanhove/root/root/lib -undefined error -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lpthread -rpath /Users/vanhove/root/root/lib -lm -ldl -lEG -lTMVA -l:/Users/vanhove/0_Analyses/stopPair/combinedOneLeptonStopAnalysis/wTagging/miscTests/…/…/sonicScrewdriver/libSonicScrewdriver.so -l:/Users/vanhove/0_Analyses/stopPair/combinedOneLeptonStopAnalysis/wTagging/miscTests/…/…/.vectorDictionnary_C.so /var/folders/_g/x2qbwgc55n1grz79ld0ylpq00000gp/T/test-824aa2.o -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/…/lib/clang/5.1/lib/darwin/libclang_rt.osx.a
ld: library not found for -l:/Users/vanhove/0_Analyses/stopPair/combinedOneLeptonStopAnalysis/wTagging/miscTests/…/…/sonicScrewdriver/libSonicScrewdriver.so
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [test.run] Error 1

  1. The file /Users/vanhove/0_Analyses/stopPair/combinedOneLeptonStopAnalysis/wTagging/miscTests/…/…/sonicScrewdriver/libSonicScrewdriver.so does exist !

  2. MAC version: OSX 10.9.5

  3. Root version is “-Root Version 5.34/23 7 November 2014”

  4. typing g++ -v, I get:
    Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
    Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
    Target: x86_64-apple-darwin13.4.0
    Thread model: posix

  5. The Makefile I use:
    ObjSuf = o
    SrcSuf = C
    ExeSuf = run
    LogSuf = log

ROOTCFLAGS = (shell root-config --cflags) ROOTLIBS = (shell root-config --libs)

CXX = g++
#CXXFLAGS = -stdlib=libstdc++
#CXXFLAGS = -std=c++11
CXXFLAGS = -std=c++0x
CXXFLAGS += -O -Wall -fPIC (DEFINES) -Wno-unused-result -Wshadow CXXFLAGS += (ROOTCFLAGS) -I./
CXXFLAGS += -I…/…/sonicScrewdriver/

LD = g++
LDFLAGS = -g -v -O -Wall -fPIC -Wl,-undefined,error
#LDFLAGS = -g -v -O -Wall -fPIC -Wl,–no-undefined
LDFLAGS += $(ROOTLIBS) -lEG -lTMVA
LDFLAGS += -l:pwd/…/…/sonicScrewdriver/libSonicScrewdriver.so
LDFLAGS += -l:pwd/…/…/.vectorDictionnary_C.so

SOFLAGS = -dynamic

Uncomment this line if you want to use a script to parse & colorize gcc output

(You can also export this variable from your bashrc)

#GCCPARSER = 2>&1 | python ~/littleScripts/colorGcc.py

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

CnC_T2tt = cutAndCount_T2tt_offShellLoose cutAndCount_T2tt_offShellTight cutAndCount_T2tt_lowDeltaM cutAndCount_T2tt_mediumDeltaM cutAndCount_T2tt_highDeltaM
CnC_T2bw025 = cutAndCount_T2bw025_offShell cutAndCount_T2bw025_lowMasses cutAndCount_T2bw025_highMasses
CnC_T2bw050 = cutAndCount_T2bw050_offShell cutAndCount_T2bw050_lowMasses cutAndCount_T2bw050_mediumDeltaM cutAndCount_T2bw050_highDeltaM
CnC_T2bw075 = cutAndCount_T2bw075_lowDeltaM cutAndCount_T2bw075_mediumDeltaM cutAndCount_T2bw075_highDeltaM

BDT_T2tt = BDT_T2tt_1_lowLSP BDT_T2tt_1_mediumLSP BDT_T2tt_1_highLSP BDT_T2tt_2 BDT_T2tt_5_lowDM BDT_T2tt_5_highDM
BDT_T2bw075 = BDT_T2bw075_1 BDT_T2bw075_2 BDT_T2bw075_3 BDT_T2bw075_5_lowDM BDT_T2bw075_5_highDM
BDT_T2bw050 = BDT_T2bw050_1_lowDM_lowLSP BDT_T2bw050_1_lowDM_highLSP BDT_T2bw050_1_highDM BDT_T2bw050_3 BDT_T2bw050_4 BDT_T2bw050_5 BDT_T2bw050_6
BDT_T2bw025 = BDT_T2bw025_1 BDT_T2bw025_3 BDT_T2bw025_4_lowLSP BDT_T2bw025_4_highLSP BDT_T2bw025_6

CnC_REGIONS = preselection
CnC_REGIONS += (CnC_T2tt) (CnC_T2bw025) (CnC_T2bw050) (CnC_T2bw075)
BDT_REGIONS = (BDT_T2tt) (BDT_T2bw025) (BDT_T2bw050) (BDT_T2bw075)
SIGNAL_REGIONS = (CnC_REGIONS) (BDT_REGIONS)

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

SOURCES = (wildcard *.(SrcSuf))
OBJECTS = (SOURCES:.(SrcSuf)=.(ObjSuf)) EXECUTABLES = (SOURCES:.(SrcSuf)=.(ExeSuf))
LOGS = (SOURCES:.(SrcSuf)=.$(LogSuf))

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

TARGET = test

compile: …/…/.vectorDictionnary_C.so (TARGET).(ExeSuf)

run:
./(TARGET).(ExeSuf) | tee (TARGET).(LogSuf)

browse:
export PLOTS_TO_BROWSE=ls plots/*.root; root -l .browse

clean:
@echo “Cleaning…”
@rm -f *.(ObjSuf) *.(ExeSuf) *.$(LogSuf)

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

…/…/.vectorDictionnary_C.so: …/…/.vectorDictionnary.C
cd …/…/; root -q -l -L .vectorDictionnary.C+

%.(ExeSuf): %.(SrcSuf) …/…/.vectorDictionnary_C.so
(CXX) (CXXFLAGS) (LDFLAGS) -o @ < (LIBS) $(GCCPARSER)

  1. Additional info about the makefile

When going from linux to MAC, I had to replace:
LDFLAGS = -g -v -O -Wall -fPIC -Wl,–no-undefined
by
LDFLAGS = -g -v -O -Wall -fPIC -Wl,-undefined,error

In your Makefile, try to change:
-l:pwd/…
into:
-lpwd/…

Thanks for the hint “Wile E. Coyote”. Unfortunately, the error is still exactly the same…

[quote=“Wile E. Coyote”]In your Makefile, try to change:
-l:pwd/…
into:
-lpwd/…[/quote]

Hi,

The error cannot be exactly the same :slight_smile: Or you didn’t manage to change what Wile suggested.

Axel.