This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-11
Channels
- # announcements (6)
- # architecture (14)
- # babashka (26)
- # beginners (22)
- # calva (11)
- # clj-kondo (2)
- # clj-on-windows (1)
- # cljsrn (10)
- # clojure (116)
- # clojure-europe (5)
- # clojure-uk (1)
- # clojurescript (5)
- # cursive (9)
- # datomic (21)
- # depstar (1)
- # events (1)
- # fulcro (2)
- # graalvm (17)
- # graalvm-mobile (28)
- # helix (3)
- # introduce-yourself (2)
- # jobs (2)
- # lsp (4)
- # meander (1)
- # off-topic (4)
- # pathom (5)
- # polylith (6)
- # practicalli (5)
- # reagent (67)
- # reitit (1)
- # releases (2)
- # shadow-cljs (24)
- # tools-deps (23)
Hi! I’m trying to build a command-line tool for non clojure using colleagues (or not yet 🙂 ). We need to run on linux (centos and ubuntu). I’ve used this docker image to create the native image.
# Dockerfile
FROM
WORKDIR /opt/graalvm
RUN gu install native-image
ENTRYPOINT ["native-image"] # // building the image
# docker build -t graalvm-native-image .
and using Babashka to run this task.
native-image-linux {:depends [uberjar]
:task (do
(def native-image-cmd
(str/join " "
["docker" "run" "--rm"
"-v"
(str (cd) "/:/opt/cp")
"-v"
(str (cd) "/:/opt/graalvm")
"graalvm-native-image"
;; "-J-Xmx3g"
;; "-R:MaxHeapSize=3.5g"
"-H:Name=dataloader"
"-H:+ReportExceptionStackTraces"
"-jar" "dataloader.jar"
"pdrdataloader-linux"
"--initialize-at-build-time"
"--no-fallback"
"--no-server"]))
(println "running: " native-image-cmd)
(shell native-image-cmd))}
Reaching out for help, because when I run the image on graalvm-ce docker image above, I get “missing file” errror.
bash-5.1# ldd /opt/cp/pdrdataloader-linux
/lib64/ld-linux-x86-64.so.2 (0x7f3c92756000)
libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f3c92756000)
libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7f3c92756000)
libz.so.1 => /lib/libz.so.1 (0x7f3c9273c000)
librt.so.1 => /lib64/ld-linux-x86-64.so.2 (0x7f3c92756000)
libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f3c92756000)
Error relocating /opt/cp/pdrdataloader-linux: __strdup: symbol not found
I usually see such a message when I build a dynamic image and run it on a system that doesn't have glibc
so you could either try a static (muslc) based build or try running the image in ubuntu (or centos)
Update: I built on Ubuntu 20.10 and run great. When I run on “oracle linux” (compatible with centos), I get a nice error “/lib64/libc.so.6: version `GLIBC_2.32' not found (required by /opt/cp/pdrdataloader-linux~ubuntu)”