Undefined symbols for architecture x86_64

Dear experts,

I am running ROOT 6.17/01 on MacOS Sierra v10.12.6. I am attempting to compile a .cpp file (attached) which encodes a custom fit-shape. But ROOT throws the following error:

Undefined symbols for architecture x86_64:
“ROOT::Math::cyl_bessel_k(double, double)”, referenced from:
BK2(double, double) in RooHypatia2_cpp_ACLiC_dict.o
LnBK2(double, double) in RooHypatia2_cpp_ACLiC_dict.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error in : Compilation failed!

On browsing through previous similar posts in the ROOT forum, I feel like it might be related to the MathMore library, but am unable to diagnose beyond that. I can libMathMore in my ROOT lib folder.

In case it is useful, my ROOT build command was the following:
cmake -Dall=ON -Dimt=ON -DPYTHON_EXECUTABLE=/Users/Arvind/anaconda2/bin/python -DPYTHON_INCLUDE_DIR=/Users/Arvind/anaconda2/include/python2.7 -DPYTHON_LIBRARY=/Users/Arvind/anaconda2/lib/libpython2.7.dylib …/root

Does anyone have any idea on how to fix this? I would appreciate any advice.

Thanks,
Arvind.

RooHypatia2.cpp (6.0 KB)
RooHypatia2.h (1.9 KB)

Try:

root [0] .L RooHypatia2.cpp++

Note: if you build a shared library or a standalone application, you will need to add “-lMathMore” to your linking command line.

Thanks for replying.

.L RooHypatia2.cpp++ is how I was compiling the file initially.

Can you please tell me how to add -lMathMore to my linking command line?

Thanks,
Arvind.

You should have NO errors from doing: .L RooHypatia2.cpp++
Try with an additional step:

root [0] gSystem->Load("libMathMore")
root [1] .L RooHypatia2.cpp++
1 Like

Unfortunately, I do.

Undefined symbols for architecture x86_64:
“ROOT::Math::cyl_bessel_k(double, double)”, referenced from:
BK2(double, double) in RooHypatia2_cpp_ACLiC_dict.o
LnBK2(double, double) in RooHypatia2_cpp_ACLiC_dict.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error in : Compilation failed!

I see this error when I compile it on my laptop. But when I try to compile it on my research groups cluster, then I see no error. This tells me it might be an environment issue of some sort…

YES! That worked. When I explicitly load libMathMore using gSystem, then there are no complaints.

Thank you so much!!

And yes, root-config --has-mathmore returns yes.

Thanks a ton Wile E.!

@axel It seems that Linux automatically loads libMathMore while MacOS does not.

ROOT cannot autoload based on functions (fixed for ROOT’s modules build!). For Linux, some side-effect triggers the loading on time.

I recommend putting R__LOAD_LIBRARY(libMathMore) into RooHypatia2.cpp, below the #includes - that should do!

@axel Have you fixed it yet?

1 Like

Dammit - did I fall into the same trap again? :frowning:

That’s now https://sft.its.cern.ch/jira/browse/ROOT-10104

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.