# Version of library in binary builds

**URL:** <https://discourse.julialang.org/t/version-of-library-in-binary-builds/31592>\
**Category:** Tooling\
**Created:** [November 27, 2019, 4:58pm UTC](https://discourse.julialang.org/t/version-of-library-in-binary-builds/31592 "2019-11-27T16:58:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmbates](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dmbates/32/44_2.png) [@dmbates](https://discourse.julialang.org/u/dmbates)\
**Post date:** [November 27, 2019, 4:58pm UTC](https://discourse.julialang.org/t/version-of-library-in-binary-builds/31592/1 "2019-11-27T16:58:54Z")

</div>

When I run the binary build of Julia-1.2.0 or Julia-1.3.0 under a clean install of Ubuntu-19.10 I encounter problems with the version of libstdc++ in the binary build. This comes about when using RCall and loading R packages with binary dependencies built on this computer, say ggplot2. In general this occurs with any R package that depends upon the Rcpp package in R.

The error message is like

```julia
ERROR: REvalError: Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/home/bates/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/libs/Rcpp.so':
  /home/bates/src/julia-1.3.0/bin/../lib/julia/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /home/bates/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/libs/Rcpp.so)

```

This comes about because the installation of the Rcpp package calls the local version of g++ which links against `/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28`. It looks as if the version of `libstdc++.so.6` shipped with the Julia binary builds is an earlier version. It defines GLIBCXX\_3.4.24 but not 25 and 26.

I can probably finesse the issue by, say, a symbolic link to the system `libstdc++.so.6` from the Julia `lib/julia/` directory but I don’t want to mess with the binary builds unless absolutely necessary.

Can anyone suggest an alternative way around this?

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [November 27, 2019, 6:27pm UTC](https://discourse.julialang.org/t/version-of-library-in-binary-builds/31592/2 "2019-11-27T18:27:36Z")

</div>

Try setting

```julia
ENV["LD_LIBRARY_PATH"] = "/usr/lib/x86_64-linux-gnu"

```

Hopefully this should give priority to the libraries in this directory.

If it fails, set also

```julia
ENV["LD_DEBUG"] = "all"

```

to follow which library is being opened first.

---

<div class="post-metadata">

**Author:** ![dmbates](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dmbates/32/44_2.png) [@dmbates](https://discourse.julialang.org/u/dmbates)\
**Post date:** [November 29, 2019, 4:24pm UTC](https://discourse.julialang.org/t/version-of-library-in-binary-builds/31592/3 "2019-11-29T16:24:07Z")

</div>

Setting the environment variable LD\_LIBRARY\_PATH explicitly doesn’t work for me, unfortunately

```julia
   _ _ _(_)_ | Documentation: https://docs.julialang.org
  (_) | (_) (_) |
   _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` | |
  | | |_| | | | (_| | | Version 1.3.0 (2019-11-26)
 _/ |\ __'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |

julia> ENV["LD_LIBRARY_PATH"] = "/usr/lib/x86_64-linux-gnu/"
"/usr/lib/x86_64-linux-gnu/"

julia> using RCall

julia> sleep = rcopy(R"lme4::sleepstudy")
ERROR: REvalError: Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/home/bates/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/libs/Rcpp.so':
  /home/bates/src/julia-1.3.0/bin/../lib/julia/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /home/bates/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/libs/Rcpp.so)

julia> 
bates@douglas-EliteDesk:~$ export LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu/"
bates@douglas-EliteDesk:~$ julia
               _
   _ _ _(_)_ | Documentation: https://docs.julialang.org
  (_) | (_) (_) |
   _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` | |
  | | |_| | | | (_| | | Version 1.3.0 (2019-11-26)
 _/ |\ __'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |

julia> ENV["LD_LIBRARY_PATH"]
"/usr/lib/x86_64-linux-gnu/"

julia> using RCall

julia> sleep = rcopy(R"lme4::sleepstudy")
ERROR: REvalError: Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/home/bates/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/libs/Rcpp.so':
  /home/bates/src/julia-1.3.0/bin/../lib/julia/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /home/bates/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/libs/Rcpp.so)

```

If I set `ENV["LD_DEBUG"] = "all"` I get a lot of information from `using RCall` but most of that is related to `GLIBC`. If I recall correctly the R process itself doesn’t have an C++ code, it is only code in R packages that uses C++. Thus the `libstdc++` search only happens when after the R process has been started.

I also tried to make the Rcpp package access the libstdc++.so file shipped with the Julia package by removing the R packages and re-installing them after setting LD\_LIBRARY\_PATH to put the Julia libs directory first. That also failed.

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [November 29, 2019, 4:32pm UTC](https://discourse.julialang.org/t/version-of-library-in-binary-builds/31592/4 "2019-11-29T16:32:22Z")

</div>

You might get more effect with the `LD_PRELOAD` environment variable.

---

<div class="post-metadata">

**Author:** ![dmbates](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dmbates/32/44_2.png) [@dmbates](https://discourse.julialang.org/u/dmbates)\
**Post date:** [November 29, 2019, 4:38pm UTC](https://discourse.julialang.org/t/version-of-library-in-binary-builds/31592/5 "2019-11-29T16:38:00Z")

</div>

Did you mean this?

```julia
               _
   _ _ _(_)_ | Documentation: https://docs.julialang.org
  (_) | (_) (_) |
   _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` | |
  | | |_| | | | (_| | | Version 1.3.0 (2019-11-26)
 _/ |\ __'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |

julia> ENV["LD_PRELOAD"] = "/usr/lib/x86_64-linux-gnu/libstdc++.so.6"
"/usr/lib/x86_64-linux-gnu/libstdc++.so.6"

julia> using RCall

julia> R"library(Rcpp)"
ERROR: REvalError: Error: package or namespace load failed for ‘Rcpp’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/home/bates/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/libs/Rcpp.so':
  /home/bates/src/julia-1.3.0/bin/../lib/julia/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /home/bates/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/libs/Rcpp.so)

```

---

<div class="post-metadata">

**Author:** ![dmbates](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dmbates/32/44_2.png) [@dmbates](https://discourse.julialang.org/u/dmbates)\
**Post date:** [November 29, 2019, 4:39pm UTC](https://discourse.julialang.org/t/version-of-library-in-binary-builds/31592/6 "2019-11-29T16:39:56Z")

</div>

Thank you. It does work if I do things this way

```nohighlight
bates@douglas-EliteDesk:~$ export LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libstdc++.so.6"
bates@douglas-EliteDesk:~$ julia
               _
   _ _ _(_)_ | Documentation: https://docs.julialang.org
  (_) | (_) (_) |
   _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` | |
  | | |_| | | | (_| | | Version 1.3.0 (2019-11-26)
 _/ |\ __'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |

julia> using RCall

julia> R"library(Rcpp)"
RObject{StrSxp}
[1] "Rcpp" "stats" "graphics" "grDevices" "utils" "datasets" 
[7] "methods" "base"     

```

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [December 2, 2019, 7:42am UTC](https://discourse.julialang.org/t/version-of-library-in-binary-builds/31592/7 "2019-12-02T07:42:23Z")

</div>

Yes, it’s critical that “LD\_PRELOAD” is set before starting Julia so the preloading can be done before Julia gets a chance to load its own version of the library.
