{"action":"created","issue":{"url":"https://api.github.com/repos/ocaml/opam-repository/issues/7330","repository_url":"https://api.github.com/repos/ocaml/opam-repository","labels_url":"https://api.github.com/repos/ocaml/opam-repository/issues/7330/labels{/name}","comments_url":"https://api.github.com/repos/ocaml/opam-repository/issues/7330/comments","events_url":"https://api.github.com/repos/ocaml/opam-repository/issues/7330/events","html_url":"https://github.com/ocaml/opam-repository/issues/7330","id":174271817,"number":7330,"title":"conf-blas & conf-lapack fail to install under FreeBSD","user":{"login":"magv","id":1360822,"avatar_url":"https://avatars.githubusercontent.com/u/1360822?v=3","gravatar_id":"","url":"https://api.github.com/users/magv","html_url":"https://github.com/magv","followers_url":"https://api.github.com/users/magv/followers","following_url":"https://api.github.com/users/magv/following{/other_user}","gists_url":"https://api.github.com/users/magv/gists{/gist_id}","starred_url":"https://api.github.com/users/magv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magv/subscriptions","organizations_url":"https://api.github.com/users/magv/orgs","repos_url":"https://api.github.com/users/magv/repos","events_url":"https://api.github.com/users/magv/events{/privacy}","received_events_url":"https://api.github.com/users/magv/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ocaml/opam-repository/labels/conf","name":"conf","color":"b60205"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-31T13:22:59Z","updated_at":"2016-09-27T19:06:42Z","closed_at":null,"body":"When installing `conf-blas` under FreeBSD 10 amd64 I get this error:\r\n```\r\n$ opam install conf-blas                                                                                            \r\nThe following actions will be performed:\r\n  ∗  install conf-blas 1\r\n\r\n=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r\n\r\n=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r\n[ERROR] The compilation of conf-blas failed at \"sh -exc cc $CFLAGS test.c -lblas\".\r\n\r\n#=== ERROR while installing conf-blas.1 =======================================#\r\n# opam-version 1.2.2\r\n# os           freebsd\r\n# command      sh -exc cc $CFLAGS test.c -lblas\r\n# path         ~/.opam/4.03.0+flambda/build/conf-blas.1\r\n# compiler     4.03.0+flambda\r\n# exit-code    1\r\n# env-file     ~/.opam/4.03.0+flambda/build/conf-blas.1/conf-blas-32329-ccabea.env\r\n# stdout-file  ~/.opam/4.03.0+flambda/build/conf-blas.1/conf-blas-32329-ccabea.out\r\n# stderr-file  ~/.opam/4.03.0+flambda/build/conf-blas.1/conf-blas-32329-ccabea.err\r\n### stderr ###\r\n# + cc test.c -lblas\r\n# /usr/bin/ld: cannot find -lblas\r\n# cc: error: linker command failed with exit code 1 (use -v to see invocation)\r\n\r\n\r\n\r\n=-=- Error report -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r\nThe following actions failed\r\n  ∗  install conf-blas 1\r\nNo changes have been performed\r\n\r\n=-=- conf-blas.1 troobleshooting =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r\n=> This package relies on external (system) dependencies that may be missing. `opam depext conf-blas.1' may help you find the correct\r\n   installation for your system.\r\n```\r\n\r\nAdding `-L/usr/local/lib` to `CFLAGS`, so the build script would find `libblas.so`, results in a new set of errors:\r\n```\r\n#=== ERROR while installing conf-blas.1 =======================================#\r\n# opam-version 1.2.2\r\n# os           freebsd\r\n# command      sh -exc cc $CFLAGS test.c -lblas\r\n# path         /home/magv/.opam/4.03.0+flambda/build/conf-blas.1\r\n# compiler     4.03.0+flambda\r\n# exit-code    1\r\n# env-file     ~/.opam/4.03.0+flambda/build/conf-blas.1/conf-blas-32343-ccabea.env\r\n# stdout-file  ~/.opam/4.03.0+flambda/build/conf-blas.1/conf-blas-32343-ccabea.out\r\n# stderr-file  ~/.opam/4.03.0+flambda/build/conf-blas.1/conf-blas-32343-ccabea.err\r\n### stderr ###\r\n# [...]\r\n# //usr/local/lib/gcc48/libgfortran.so.3: undefined reference to `__addtf3@GCC_4.6.0'\r\n# //usr/local/lib/gcc48/libgfortran.so.3: undefined reference to `__gttf2@GCC_4.6.0'\r\n# //usr/local/lib/gcc48/libgfortran.so.3: undefined reference to `__divtf3@GCC_4.6.0'\r\n# //usr/local/lib/gcc48/libgfortran.so.3: undefined reference to `__letf2@GCC_4.6.0'\r\n# //usr/local/lib/gcc48/libgfortran.so.3: undefined reference to `__netf2@GCC_4.6.0'\r\n# //usr/local/lib/gcc48/libgfortran.so.3: undefined reference to `__floatditf@GCC_4.6.0'\r\n# //usr/local/lib/gcc48/libgfortran.so.3: undefined reference to `__trunctfdf2@GCC_4.6.0'\r\n# //usr/local/lib/gcc48/libgfortran.so.3: undefined reference to `__eqtf2@GCC_4.6.0'\r\n# //usr/local/lib/gcc48/libgfortran.so.3: undefined reference to `__floatsitf@GCC_4.6.0'\r\n# cc: error: linker command failed with exit code 1 (use -v to see invocation)\r\n```\r\n\r\nThis is probably because BLAS under FreeBSD is build with GCC, while the default `cc` is CLANG, and there seem to be incompatibilities between them. Whatever the case, here's a change to `conf-blas` that seems to make it work for me:\r\n```diff\r\n--- ~/.opam/repo/default/packages/conf-blas/conf-blas.1/opam.orig      2016-08-31 15:26:25.000000000 +0300\r\n+++ ~/.opam/repo/default/packages/conf-blas/conf-blas.1/opam   2016-08-31 15:42:09.000000000 +0300\r\n@@ -6,7 +6,8 @@\r\n dev-repo: \"https://github.com/ocaml/opam-repository.git\"\r\n license: \"GPL-2.0\"\r\n build: [\r\n-  [\"sh\" \"-exc\" \"cc $CFLAGS test.c -lblas\"] {os != \"darwin\" & os != \"win32\"}\r\n+  [\"sh\" \"-exc\" \"cc $CFLAGS test.c -lblas\"] {os != \"darwin\" & os != \"freebsd\" & os != \"win32\"}\r\n+  [\"sh\" \"-exc\" \"${CC:-gcc} $CFLAGS test.c -lblas $LDFLAGS\"] {os = \"freebsd\"}\r\n   [\"sh\" \"-exc\" \"cc -framework Accelerate $CFLAGS test.c -lblas\"] {os = \"darwin\"}\r\n   [\"%{build}%/test-win.sh\"] {os = \"win32\"}\r\n ]\r\n@@ -15,4 +16,5 @@\r\n   [[\"ubuntu\"] [\"libblas-dev\"]]\r\n   [[\"centos\"] [\"blas-devel\"]]\r\n   [[\"fedora\"] [\"blas-devel\"]]\r\n+  [[\"freebsd\"] [\"blas\" \"gcc\"]]\r\n ]\r\n```\r\n\r\n(I made it possible to override the compiler with `CC` variable to make it easier to debug the thing if something will break in the future).\r\n\r\nHere's a similar change for `conf-lapack`, which has the same set of problems:\r\n```diff\r\n--- ~/.opam/repo/default/packages/conf-lapack/conf-lapack.1/opam.orig  2016-08-31 16:13:36.000000000 +0300\r\n+++ ~/.opam/repo/default/packages/conf-lapack/conf-lapack.1/opam       2016-08-31 16:13:40.000000000 +0300\r\n@@ -6,7 +6,8 @@\r\n dev-repo: \"https://github.com/ocaml/opam-repository.git\"\r\n license: \"GPL-2.0\"\r\n build: [\r\n-  [\"sh\" \"-exc\" \"cc $CFLAGS test.c -llapack\"] {os != \"darwin\" & os != \"win32\"}\r\n+  [\"sh\" \"-exc\" \"cc $CFLAGS test.c -llapack\"] {os != \"darwin\" & os != \"freebsd\" & os != \"win32\"}\r\n+  [\"sh\" \"-exc\" \"${CC:-gcc} $CFLAGS test.c -llapack $LDFLAGS\"] {os = \"freebsd\"}\r\n   [\"sh\" \"-exc\" \"cc -framework Accelerate $CFLAGS test.c -llapack\"] {os = \"darwin\"}\r\n   [\"%{build}%/test-win.sh\"] {os = \"win32\"}\r\n ]\r\n@@ -15,4 +16,5 @@\r\n   [[\"ubuntu\"] [\"liblapack-dev\"]]\r\n   [[\"centos\"] [\"lapack-devel\"]]\r\n   [[\"fedora\"] [\"lapack-devel\"]]\r\n+  [[\"freebsd\"] [\"lapack\" \"gcc\"]]\r\n ]\r\n```\r\n\r\nWith both of these changes I'm able to install `lacaml`, and it seems to work too.\r\n\r\n(Sorry for providing patches inline without a pull request, but that is such a hassle)."},"comment":{"url":"https://api.github.com/repos/ocaml/opam-repository/issues/comments/249965873","html_url":"https://github.com/ocaml/opam-repository/issues/7330#issuecomment-249965873","issue_url":"https://api.github.com/repos/ocaml/opam-repository/issues/7330","id":249965873,"user":{"login":"mmottl","id":1189131,"avatar_url":"https://avatars.githubusercontent.com/u/1189131?v=3","gravatar_id":"","url":"https://api.github.com/users/mmottl","html_url":"https://github.com/mmottl","followers_url":"https://api.github.com/users/mmottl/followers","following_url":"https://api.github.com/users/mmottl/following{/other_user}","gists_url":"https://api.github.com/users/mmottl/gists{/gist_id}","starred_url":"https://api.github.com/users/mmottl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmottl/subscriptions","organizations_url":"https://api.github.com/users/mmottl/orgs","repos_url":"https://api.github.com/users/mmottl/repos","events_url":"https://api.github.com/users/mmottl/events{/privacy}","received_events_url":"https://api.github.com/users/mmottl/received_events","type":"User","site_admin":false},"created_at":"2016-09-27T19:06:42Z","updated_at":"2016-09-27T19:06:42Z","body":"@magv Thanks for the patch, I have submitted a pull request addressing this issue."}}
{"actor":{"display_login":"mmottl"}}