-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow passing custom library prefix #2
Comments
The latter problem should be because it is creating dummies and configuration files, and you do not appear to have permission to edit files there. The former should be expected (I believe). It is my understanding that even standard libraries such as GMP and MPFR cannot find things there unless some of your environment variables to point there. |
So now the version of the library use |
It still fails to me, but now it is because the ocaml code is not using pkg-config:
I would suggest to do that via dune-configurator, akin to what I did here: thvnx/mlmpfr#27 (you just need a small modification of that code, I can send a PR next week if you want) |
My bad, I pushed the tag |
There is only one error left now:
I think the flags need to be added also to Line 6 in 4c3e97c
I tried diff --git a/flint/dune b/flint/dune
index 06a7e04..969ca24 100644
--- a/flint/dune
+++ b/flint/dune
@@ -6,6 +6,9 @@
(foreign_stubs
(language c)
(names ocaml_flint_utils)
+ (flags
+ (:include ../configure/c_flags.sexp)
+ :standard)
(include_dirs
flint
(lib zarith))) on the fly but it then fails at the final linking stage
|
@bobot I think I figured it out. diff --git a/arb/dune b/arb/dune
index 68925d4..ba0769d 100644
--- a/arb/dune
+++ b/arb/dune
@@ -5,7 +5,10 @@
(foreign_archives arb)
(foreign_stubs
(language c)
- (names ocaml_acb_utils))
+ (names ocaml_acb_utils)
+ (flags
+ (:include ../configure/c_flags.sexp)
+ :standard))
(libraries zarith flint threads)
(flags -w -9-27)
(ctypes
@@ -18,7 +21,9 @@
"-Werror=implicit-function-declaration"
(:include ../configure/c_flags.sexp)
:standard)
- (c_library_flags "-lgmp -lmpfr")))
+ (c_library_flags
+ (:include ../configure/libs.sexp)
+ "-lgmp -lmpfr")))
(deps arb.h acb.h)
(headers
(include "acb.h" "string.h"))
diff --git a/calcium/dune b/calcium/dune
index cc84cbb..a2942e9 100644
--- a/calcium/dune
+++ b/calcium/dune
@@ -6,6 +6,9 @@
(foreign_stubs
(language c)
(names ocaml_calcium_utils)
+ (flags
+ (:include ../configure/c_flags.sexp)
+ :standard)
(include_dirs
lib
(lib flint)
@@ -25,7 +28,9 @@
"-Werror=implicit-function-declaration"
(:include ../configure/c_flags.sexp)
:standard)
- (c_library_flags "-lgmp -lmpfr")))
+ (c_library_flags
+ (:include ../configure/libs.sexp)
+ "-lgmp -lmpfr")))
(deps lib/ca.h)
(headers
(include "lib/ca.h" "string.h"))
diff --git a/configure/discover.ml b/configure/discover.ml
index ef7b777..4ca46c2 100644
--- a/configure/discover.ml
+++ b/configure/discover.ml
@@ -2,19 +2,21 @@ module C = Configurator.V1
let () =
C.main ~name:"discover" (fun c ->
- let conf =
+ let cflags, libs =
match C.Pkg_config.get c with
- | None -> []
+ | None -> [], []
| Some pc ->
- let cflags ~package =
+ let flags ~package =
match C.Pkg_config.query pc ~package with
- | None -> []
- | Some info -> info.cflags
+ | None -> [], []
+ | Some info -> info.cflags, info.libs
in
- let gmp = cflags ~package:"gmp" in
- let mpfr = cflags ~package:"mpfr" in
+ let gmp = flags ~package:"gmp" in
+ let mpfr = flags ~package:"mpfr" in
- gmp @ mpfr
+ (fst gmp) @ (fst mpfr),
+ (snd gmp) @ (snd mpfr)
in
- C.Flags.write_sexp "c_flags.sexp" conf)
+ C.Flags.write_sexp "c_flags.sexp" cflags;
+ C.Flags.write_sexp "libs.sexp" libs)
diff --git a/configure/dune b/configure/dune
index 617bc69..5bbdeb2 100644
--- a/configure/dune
+++ b/configure/dune
@@ -3,5 +3,5 @@
(libraries dune-configurator))
(rule
- (targets c_flags.sexp)
+ (targets c_flags.sexp libs.sexp)
(action (run ./discover.exe)))
diff --git a/flint/dune b/flint/dune
index 06a7e04..7f83395 100644
--- a/flint/dune
+++ b/flint/dune
@@ -6,6 +6,9 @@
(foreign_stubs
(language c)
(names ocaml_flint_utils)
+ (flags
+ (:include ../configure/c_flags.sexp)
+ :standard)
(include_dirs
flint
(lib zarith)))
@@ -21,7 +24,9 @@
"-Werror=implicit-function-declaration"
(:include ../configure/c_flags.sexp)
:standard)
- (c_library_flags "-lgmp -lmpfr")))
+ (c_library_flags
+ (:include ../configure/libs.sexp)
+ "-lgmp -lmpfr")))
(deps flint/flint.h flint/fmpz.h)
(headers
(include "flint/fmpz.h" "flint/fmpq.h" "string.h")) |
Flint fails to compile for me with
This is because flint looks by default into
/usr/local
. On my system (macos M1 and x86_64 with macports) I need to call configure as./configure --with-gmp=/opt/local --with-mpfr=/opt/local --with-blas=/opt/local/include/lapack
to make flint configure.I still get some weird failures on ARM after that change:
Do you by chance know why these happen? If I enter the flint2 folder and configure and compile by hand it works fine.
The text was updated successfully, but these errors were encountered: