-
Notifications
You must be signed in to change notification settings - Fork 6.7k
[clojure-package] On modern Ubuntu, scala package cannot be loaded without legacy libcurl #12822
Description
Description
The Scala package as pulled in by the Clojure package has a dependency on legacy libcurl (on Ubuntu: libcurl3) and doesn't work with the current version (on Ubuntu: libcurl4).
Environment info (Required)
Only relevant part:
----------System Info----------
Platform : Linux-4.15.0-36-generic-x86_64-with-Ubuntu-18.04-bionic
system : Linux
node : pop-os
release : 4.15.0-36-generic
version : #39-Ubuntu SMP Mon Sep 24 16:19:09 UTC 2018
Package used (Python/R/Scala/Julia): Clojure
For Scala user, please provide: (Okay, just in case)
-
Java version:
openjdk version "10.0.2" 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.2)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.2, mixed mode) -
Maven version: nil
-
Scala runtime if applicable: nil
Error Message:
INFO MXNetJVM: Try loading mxnet-scala from native path.
INFO MXNetJVM: Try loading mxnet-scala-linux-x86_64-gpu from native path.
INFO MXNetJVM: Try loading mxnet-scala-linux-x86_64-cpu from native path.
WARN MXNetJVM: MXNet Scala native library not found in path. Copying native library from the archive. Consider installing the library somewhere in the path (for Windows: PATH, for Linux: LD_LIBRARY_PATH), or specifying by Java cmd option -Djava.library.path=[lib path].
INFO org.apache.mxnet.util.NativeLibraryLoader: Loading libmxnet-scala.so from /lib/native/ copying to mxnet-scala
ERROR org.apache.mxnet.util.NativeLibraryLoader: Couldn't load copied link file: java.lang.UnsatisfiedLinkError: /tmp/mxnet3266536299040978061/mxnet-scala: /usr/lib/x86_64-linux-gnu/libcurl.so.4: version `CURL_OPENSSL_3' not found (required by /tmp/mxnet3266536299040978061/mxnet-scala)
ERROR MXNetJVM: Couldn't find native library mxnet-scala
Steps to reproduce
Follow the installation instructions in the clojure package README.
What have you tried to solve it?
For projects that use Leiningen, there's a workaround that nicely integrates with the CIDER REPL in Emacs:
- Make a Leiningen project with
clojure-mxnetdependency. - In the top-level project directory, download the legacy
libcurl3package:wget http://archive.ubuntu.com/ubuntu/pool/universe/c/curl3/libcurl3_7.58.0-2ubuntu2_amd64.deb
- Extract into a temporary directory:
mkdir -p tmp && dpkg-deb -R libcurl3_7.58.0-2ubuntu2_amd64.deb tmp/ - Copy the shared library to a directory of your choice, here
resources, and remove the temporary directory:cp tmp/usr/lib/x86_64-linux-gnu/libcurl.so.4 resources && rm tmp -r - In the
project.cljfile, add the following::plugins [[lein-with-env-vars "0.2.0"]] :env-vars {:LD_LIBRARY_PATH "./resources"} :hooks [leiningen.with-env-vars/auto-inject]
This works better than
- installing
libcurl3system-wide because it blockslibcurl4, which is a dependency of thecurlpackage - globally setting
LD_LIBRARY_PATHsince it might break other packages that now find the wrong shared library - manually setting the environment variable because then, only stuff run from that console session will work correctly (including emacs).
However, it would be much better if this problem didn't exist in the first place. What would it take to use libcurl4 instead? Maybe the Scala package Dockerfile needs an update?