# Undefined symbols for architecture x86\_64

**URL:** <https://root-forum.cern.ch/t/undefined-symbols-for-architecture-x86-64/33922>\
**Category:** Roofit and RooStats\
**Tags:** math\
**Created:** [May 6, 2019, 5:29pm UTC](https://root-forum.cern.ch/t/undefined-symbols-for-architecture-x86-64/33922 "2019-05-06T17:29:06Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![avenkate](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/278dde/32.png) [@avenkate](https://root-forum.cern.ch/u/avenkate)\
**Post date:** [May 6, 2019, 5:29pm UTC](https://root-forum.cern.ch/t/undefined-symbols-for-architecture-x86-64/33922/1 "2019-05-06T17:29:06Z")

</div>

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](https://root-forum.cern.ch/uploads/default/original/3X/8/e/8e1ec199109a56ae445ee8b3b389a610b063c770.cpp) (6.0 KB)  
[RooHypatia2.h](https://root-forum.cern.ch/uploads/default/original/3X/e/8/e8eb2e6e0a9803128fab3b555afdb3aff72948f7.h) (1.9 KB)

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [May 6, 2019, 5:33pm UTC](https://root-forum.cern.ch/t/undefined-symbols-for-architecture-x86-64/33922/2 "2019-05-06T17:33:18Z")

</div>

Try:

```auto
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.

---

<div class="post-metadata">

**Author:** ![avenkate](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/278dde/32.png) [@avenkate](https://root-forum.cern.ch/u/avenkate)\
**Post date:** [May 6, 2019, 5:46pm UTC](https://root-forum.cern.ch/t/undefined-symbols-for-architecture-x86-64/33922/3 "2019-05-06T17:46:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [May 6, 2019, 5:48pm UTC](https://root-forum.cern.ch/t/undefined-symbols-for-architecture-x86-64/33922/4 "2019-05-06T17:48:05Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![avenkate](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/278dde/32.png) [@avenkate](https://root-forum.cern.ch/u/avenkate)\
**Post date:** [May 6, 2019, 5:50pm UTC](https://root-forum.cern.ch/t/undefined-symbols-for-architecture-x86-64/33922/5 "2019-05-06T17:50:02Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![avenkate](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/278dde/32.png) [@avenkate](https://root-forum.cern.ch/u/avenkate)\
**Post date:** [May 6, 2019, 5:51pm UTC](https://root-forum.cern.ch/t/undefined-symbols-for-architecture-x86-64/33922/7 "2019-05-06T17:51:37Z")

</div>

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

Thank you so much!!

---

<div class="post-metadata">

**Author:** ![avenkate](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/278dde/32.png) [@avenkate](https://root-forum.cern.ch/u/avenkate)\
**Post date:** [May 6, 2019, 5:52pm UTC](https://root-forum.cern.ch/t/undefined-symbols-for-architecture-x86-64/33922/8 "2019-05-06T17:52:25Z")

</div>

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

Thanks a ton Wile E.!

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [May 6, 2019, 5:52pm UTC](https://root-forum.cern.ch/t/undefined-symbols-for-architecture-x86-64/33922/9 "2019-05-06T17:52:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Axel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/axel/32/11084_2.png) [@Axel](https://root-forum.cern.ch/u/Axel)\
**Post date:** [May 7, 2019, 9:10am UTC](https://root-forum.cern.ch/t/undefined-symbols-for-architecture-x86-64/33922/10 "2019-05-07T09:10:50Z")

</div>

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 `#include`s - that should do!

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [May 7, 2019, 9:20am UTC](https://root-forum.cern.ch/t/undefined-symbols-for-architecture-x86-64/33922/11 "2019-05-07T09:20:24Z")

</div>

@axel Have you fixed it yet?

> [@gSystem-\>Load() Vs. R\_\_LOAD\_LIBRARY with ACLiC](https://root-forum.cern.ch/t/gsystem-load-vs-r-load-library-with-aclic/29685/8):
>
> Actually, I also expected ACLiC (via “rootcling” / “rootcint”, which are automatically executed) to respect “R\_\_LOAD\_LIBRARY”, “R\_\_ADD\_INCLUDE\_PATH” and “R\_\_ADD\_LIBRARY\_PATH” macros. Apparently, it is not the case in the current ROOT (e.g. 6.14/08 and 6.16/00).

---

<div class="post-metadata">

**Author:** ![Axel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/axel/32/11084_2.png) [@Axel](https://root-forum.cern.ch/u/Axel)\
**Post date:** [May 7, 2019, 9:36am UTC](https://root-forum.cern.ch/t/undefined-symbols-for-architecture-x86-64/33922/12 "2019-05-07T09:36:40Z")

</div>

Dammit - did I fall into the same trap again? ☹

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

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [May 21, 2019, 9:36am UTC](https://root-forum.cern.ch/t/undefined-symbols-for-architecture-x86-64/33922/13 "2019-05-21T09:36:43Z")

</div>

Closed on May 21, 2019, 9:36am UTC

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