-
Notifications
You must be signed in to change notification settings - Fork 81
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
haskell_cabal_library, cabalopts and --extra-{include,lib}-dirs #1500
Comments
If possible, it's often easier to define such a target right inside Side note,
In |
That worked like a charm, thanks for your quick reply! |
@aherrmann While this works for me on linux, it doesn't seem to work on macos:
Tried a bunch of variations, including closely following the zlib example you linked to, but no luck. Are there any special macos gotchas to keep in mind? (One thing I noticed that seems a bit odd is that the documentation for |
Indeed, that looks like a missing dynamic library file. Can you share how E.g. with a
A potential gotcha is that when Bazel builds a Side note, Cabal and GHC generally expect |
Here's a fresh repo, created using your On Linux this build and runs fine using Here's some $ bazel query @zlib.dev//:zlib --output build
# /private/var/tmp/_bazel_u/27f48b7878424df51f952eb5fecdee64/external/zlib.dev/BUILD:8:11
cc_library(
name = "zlib",
visibility = ["//visibility:public"],
tags = ["__CC_RULES_MIGRATION_DO_NOT_USE_WILL_BREAK__"],
generator_name = "zlib",
generator_function = "cc_library",
generator_location = "/private/var/tmp/_bazel_u/27f48b7878424df51f952eb5fecdee64/external/zlib.dev/BUILD:8:11",
srcs = ["@nixpkgs_zlib//:lib"],
linkstatic = True,
hdrs = ["@zlib.dev//:include"],
strip_include_prefix = "include",
)
# Rule zlib instantiated at (most recent call last):
# /private/var/tmp/_bazel_u/27f48b7878424df51f952eb5fecdee64/external/zlib.dev/BUILD:8:11 in <toplevel>
# /private/var/tmp/_bazel_u/27f48b7878424df51f952eb5fecdee64/external/rules_cc/cc/defs.bzl:63:22 in cc_library
Loading: 0 packages loaded $ bazel query --output build @nixpkgs_zlib//:lib
# /private/var/tmp/_bazel_u/27f48b7878424df51f952eb5fecdee64/external/nixpkgs_zlib/BUILD:8:10
filegroup(
name = "lib",
srcs = ["@nixpkgs_zlib//:lib/libz.1.2.11.dylib",
"@nixpkgs_zlib//:lib/libz.1.dylib", "@nixpkgs_zlib//:lib/libz.dylib"],
)
# Rule lib instantiated at (most recent call last):
# /private/var/tmp/_bazel_u/27f48b7878424df51f952eb5fecdee64/external/nixpkgs_zlib/BUILD:8:10 in <toplevel> |
@stevana Thank you for sharing the details. I tried to reproduce the issue locally. I don't have a Big Sur machine available right now, I tested this on Mojave instead. In that case I was having issues with GHC 8.10.3 not finding I ran the build in a pure Nix shell on latest I noticed that the
|
Pushed two more commits: one that adds
|
Another data point: works on Big Sur 11.1 for another colleague (after downgrading ghc to 8.8.3) |
@stevana Thank you for the updates.
Does it work on MacOS 11.2.2 Big Sur with GHC 8.8.3? I'm wondering whether this is related to the GHC version, or to the OS version. The start script is also working on our MacOS CI with the fixes that you mentioned, see #1509. The CI nodes are using Catalina, Mac OS X 10.15.7 19H512. |
Unfortunately not.
I'm confused, I thought since this is from within a |
There are some components that are imported from the OS on MacOS even inside Nix. E.g. certain system libraries. To my knowledge this is enforced on MacOS and Nix cannot provide these itself in a fully hermetic way. rules_haskell itself also directly uses some of the OS's tools, e.g. |
Interesting, would it make sense to try to make rules_haskell use Is there anything else we can try/do at the moment? Or should I just reopen the issue, wait to see if anyone else runs into the same problem, and retry later with a more recent version of nixpkgs and macos to see if perhaps the problem has gone away? |
Rerunning |
@stevana That's great news! I'm glad the issue is fixed. Thanks for keeping us up to date on this issue! |
I'm trying to build a cabal library that depends on some C headers and shared objects. I managed to get it building with the following rules in my build file:
But I cannot figure out how to get rid of the
/home/u/src/p/bazel-p/
part (which is specific to my machine) though. I've tried"--extra-include-dirs=$(location :z3.h)
,$(location @z3.dev//:include)
(after adding it to deps) and many variants without any success (bazel complains it cannot find thez3.h
file). I've also tried to make the path relative, e.g.../../external/z3.dev/include
, but that makes cabal unhappy as it seems to expect absolute paths.All examples I've found in your repo seem to depend on
.h
files that are part of the repo itself, e.g. https://github.com/tweag/rules_haskell/tree/master/examples/vector/include . Is this necessary or is it possible to fix what I've started?The text was updated successfully, but these errors were encountered: