Code Monkey home page Code Monkey logo

ez-conf-lib's Introduction

ez-conf-lib

This repository hosts a simple generator of conf-<pkg>.config files for opam.

The ez-conf-lib script is not meant to be used directly. Rather, its purpose is to be called from the build section of opam package specifications for virtual packages that check the presence of system libraries:

For instance, the conf-gmp package calls it as follows:

build: [
  [ "sh" ez-conf-lib:exe "gmp" "gmp.h" "gmptest.c" "--"
    "/usr/local" {os != "macos" & os != "win32"}
    "/opt/homebrew" {os = "macos"}
    "/opt/local" {os = "macos"} ]
]

where gmptest.c is a C file used to test inclusion and linking against the gmplib.

ez-conf-lib's People

Contributors

nberth avatar

Watchers

 avatar  avatar

ez-conf-lib's Issues

ERROR while compiling conf-gmp-paths.1

While trying to build dependencies of apron using opam, ez-conf-lib reports to have found gmp library in an empty path and ends with an error:

# checking compilation with gcc: working
# looking for gmp without prefix
# include gmp.h: found in /nix/store/1fszsmhmlhbi4yzl2wgi08cfw0dng7pq-gmp-with-cxx-6.3.0-dev/include
# library gmp: found in 
# error: unable to locate gmp library

Full log: https://gitlab.com/jasmin-lang/jasmin/-/jobs/6143092137

Script does not work for non-English locales

The sed commands in lookup_lib assume that the output of the compiler are in English. The script fails for other locales as it cannot extract the library path.

For instance, in a FR locale, gcc -print-search-dirs will give:

installés: /usr/lib/gcc/x86_64-pc-linux-gnu/13/
programmes: =/usr/libexec/gcc/x86_64-pc-linux-gnu/13/:/usr/libexec/gcc/x86_64-pc-linux-gnu/13/:/usr/libexec/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/13/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu/13/:/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/
bibliothèques: =/usr/lib/gcc/x86_64-pc-linux-gnu/13/:/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/lib/x86_64-pc-linux-gnu/13/:/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/lib/../lib64/:/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../x86_64-pc-linux-gnu/13/:/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../lib64/:/lib/x86_64-pc-linux-gnu/13/:/lib/../lib64/:/usr/lib/x86_64-pc-linux-gnu/13/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../:/lib/:/usr/lib/

This may be related to #1 as the visible result is the same: include file found but library file not found.

Temporary work-around is LANG=C opam install mlgmpidl.

How to pass a custom lib directory so that it's recognized by `conf-gmp-paths`?

Hello @nberth, first of all thanks for your work on those config scripts to smoothen out the dependency search for GMP when there's an opam package relying on it :)

It turns out that your work is very important since it happens to power, through the mlgmpidl package, the generation of static binaries for the Mlang compiler (https://github.com/MLanguage/mlang/blob/master/mlang.opam#L27) used to produce the C code that levies the French income tax. Indeed, we want a compiler binary that runs free of any dynamic library dependency to be used in exotic mainframe environments, which is why we build GMP and MPFR ourselves with musl-gcc : https://github.com/MLanguage/mlang/blob/724393abfa5854c96be9acd82c938c1565edb5c2/.github/workflows/binary-releases.yml#L104-L107.

As of recent changes in the dependencies of mlgmpidl (related to #1 I think), this custom build of GMP used by mlgmpidl is not recognized any more by the conf-gmp-paths opam package and our pipeline fails : https://github.com/MLanguage/mlang/actions/runs/8203899486/job/22443015122#step:5:4685. We used to pass MPFR_PREFIX=/tmp/gmp-prefix GMP_PREFIX=/tmp/gmp-prefix to our opam install . --deps-only command but it looks like this way of communicating the custom lib directory of GMP and MPFR is not the way to do anymore.

Do you happen to know the way to communicate to conf-gmp-paths, in a Linux environment, a custom lib directory for GMP and/or MPFR ?

Thank you very much for your help !

Compilation fails due to unknown `sed` option

All Apron-dependent GitHub Actions jobs for Goblint fail during the build of this package with:

#=== ERROR while compiling ez-conf-lib.1 ======================================#
# context     2.1.5 | linux/x86_64 | ocaml-base-compiler.5.0.0 | git+https://github.com/ocaml/opam-repository.git
# path        ~/work/analyzer/analyzer/_opam/.opam-switch/build/ez-conf-lib.1
# command     ~/.opam/opam-init/hooks/sandbox.sh build sh -ecx sed -e 's_@@ez-conf-lib:lib@@_/home/runner/work/analyzer/analyzer/_opam/lib/ez-conf-lib_g' ez-conf-lib.config.in > ez-conf-lib.config
# exit-code   1
# env-file    ~/.opam/log/ez-conf-lib-16891-b0399b.env
# output-file ~/.opam/log/ez-conf-lib-16891-b0399b.out
### output ###
# + sed -e s_@@ez-conf-lib:lib@@_/home/runner/work/analyzer/analyzer/_opam/lib/ez-conf-lib_g ez-conf-lib.config.in
# sed: -e expression #1, char 60: unknown option to `s'

(https://github.com/goblint/analyzer/actions/runs/7866405426/job/21460633443).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.