# Symbol lookup error with non-standard location

**URL:** <https://discourse.julialang.org/t/symbol-lookup-error-with-non-standard-location/1633>\
**Category:** General Usage\
**Tags:** package, cxx\
**Created:** [January 22, 2017, 3:06am UTC](https://discourse.julialang.org/t/symbol-lookup-error-with-non-standard-location/1633 "2017-01-22T03:06:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jstrube](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jstrube/32/525_2.png) [@jstrube](https://discourse.julialang.org/u/jstrube)\
**Post date:** [January 22, 2017, 3:06am UTC](https://discourse.julialang.org/t/symbol-lookup-error-with-non-standard-location/1633/1 "2017-01-22T03:06:01Z")

</div>

I’m running into a problem using an extension module.  
I’ve installed julia using spack, which results in not using ~/.julia for packages (not sure if that’s relevant).  
In a travis build (and other, more standard installs) everything is fine, but with this spack installation I’m getting:

```julia
/srv/scratch/software/spack/opt/spack/linux-rhel7-x86_64/gcc-6.2.0/julia-0.5.0-azkq3fsbejqpwydyyrzha32ecglzwo3g/bin/julia: symbol lookup error: /srv/scratch/software/spack/opt/spack/linux-rhel7-x86_64/gcc-6.2.0/julia-0.5.0-azkq3fsbejqpwydyyrzha32ecglzwo3g/var/julia/pkg/v0.5/LCIO/deps/usr/lib/liblciowrap.so: undefined symbol: _ZN8cxx_wrap14ModuleRegistry13create_moduleERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE

```

The package was built using CxxWrap, but somehow it looks like julia expects a symbol in my package that should be in the CxxWrap library. `ldd` on `liblciowrap.so` does not show any missing libs.  
I suspect this is a path problem somehow, but I don’t know how to debug this further. Any hints are appreciated.

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ihnorton/32/26_2.png) [@ihnorton](https://discourse.julialang.org/u/ihnorton)\
**Post date:** [January 22, 2017, 5:04pm UTC](https://discourse.julialang.org/t/symbol-lookup-error-with-non-standard-location/1633/2 "2017-01-22T17:04:20Z")

</div>

Are you using a different compiler, compiler version, or C++ standard library with spack? This kind of error often indicates either incompatible C++ stdlib (e.g. libc++ vs libstdc++) or reliance on hidden symbols in other shared libraries (see the `-fvisibility` compiler option; symbols could be hidden due to implicit instantiation, for example).

[nm](https://sourceware.org/binutils/docs/binutils/nm.html) can be helpful to debug these issues. In the spack and non-spack builds, compare the visibility and source annotations (for example U means “undefined”, so must be locatable at runtime in a dynamically-linked library). Then look at the same symbol visibility in the dependent libraries listed by ldd (or `otool` on Mac) that should be able to provide it. Also check, and possibly temporarily change to diagnose, any `RTLD_{GLOBAL,LOCAL,...}` options for `Libdl.dlopen` (or `dlopen` in your C++ code).

[LD\_DEBUG](http://www.bnikolic.co.uk/blog/linux-ld-debug.html) may be useful to trace lookup issues.

---

<div class="post-metadata">

**Author:** ![jstrube](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jstrube/32/525_2.png) [@jstrube](https://discourse.julialang.org/u/jstrube)\
**Post date:** [January 23, 2017, 4:18am UTC](https://discourse.julialang.org/t/symbol-lookup-error-with-non-standard-location/1633/3 "2017-01-23T04:18:51Z")

</div>

Thanks. Those are good tips. I ended up nukeing the package dir and just rebuilding with a consistent compiler setup. This fixed the problem.
