123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- ;; https://discuss.ocaml.org/t/dune-how-to-link-statically-on-linux-not-on-others/8537/4?u=mro
- (rule
- (with-stdout-to
- flags.sexp
- (run sh %{dep:gen_flags.sh})))
- (rule
- (with-stdout-to
- version.ml
- ; (run echo "let dune_project_num = \"%{version:seppo}\"")
- (run sh %{dep:gen_version.sh} "%{version:seppo}" # ${build-number}) ; https://github.com/ocaml/dune/issues/255#issuecomment-372077123
- ))
- ; https://stackoverflow.com/a/53325230/349514
- (executable
- (name apchk)
- (public_name apchk)
- (package apchk)
- (libraries
- seppo_lib
- cohttp-lwt
- ezjsonm
- lwt.unix
- mirage-crypto-rng-lwt
- ptime.clock.os
- result
- uri)
- (preprocess
- (pps lwt_ppx))
- ; https://discuss.ocaml.org/t/lwt-ppx-binary-footprint/11818/2
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; Prepare for static linking
- ;
- ; http://rgrinberg.com/posts/static-binaries-tutorial/
- ; https://discuss.ocaml.org/t/statically-link/1464/9
- ; Issue https://discuss.ocaml.org/t/statically-link/1464/13
- ; https://www.systutorials.com/how-to-statically-link-ocaml-programs/
- ;
- ; $ date
- ; Tue Mar 24 11:36:40 CET 2020
- ; $ uname -o -m
- ; x86_64 GNU/Linux
- ; $ cat /etc/issue
- ; Devuan GNU/Linux 1 \n \l
- ;
- ; # on Ubuntu Bionic note
- ; # https://github.com/ocaml/ocaml/issues/9131#issuecomment-599765888
- ; $ sudo add-apt-repository ppa:avsm/musl
- ;
- ; $ sudo apt-get install musl-tools
- ; $ eval (opam env)
- ; $ opam switch create 4.11.2+musl+static+flambda
- ; $ opam switch 4.11.2+musl+static+flambda
- ; $ eval (opam env)
- ; $ cat */deps | xargs opam install --yes
- ; $ make test clean build
- ; $ file _build/default/chkr/*.exe
- ; _build/default/chkr/apchk.exe: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped
- (flags
- (:include flags.sexp)))
|