Skip to content
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

hsc2hs doesn't use defines from its cc_library dependencies #108

Closed
iphydf opened this issue Jan 29, 2018 · 4 comments
Closed

hsc2hs doesn't use defines from its cc_library dependencies #108

iphydf opened this issue Jan 29, 2018 · 4 comments
Labels
P3 minor: not priorized type: bug

Comments

@iphydf
Copy link

iphydf commented Jan 29, 2018

cc_library(
    name = "cbits",
    # XXX: Can't do this yet, because I don't know how to make HsFFI.h visible
    # to this library (needs some dep from ghc).
    #srcs = glob(["cbits/*.c"]),
    hdrs = [
        "include/HsNet.h",
        "include/HsNetworkConfig.h",
    ],
    includes = ["include"],
    defines = ["_GNU_SOURCE"],  # <--- **HERE**
)

haskell_library(
    name = "network",
    srcs = [
        "Network.hs",
        "Network/BSD.hsc",
        "Network/Socket.hsc",
        "Network/Socket/ByteString.hsc",
        "Network/Socket/ByteString/IOVec.hsc",
        "Network/Socket/ByteString/Internal.hs",
        "Network/Socket/ByteString/Lazy.hs",
        "Network/Socket/ByteString/Lazy/Posix.hs",
        "Network/Socket/ByteString/MsgHdr.hsc",
        "Network/Socket/Internal.hsc",
        "Network/Socket/Types.hsc",
    ],
    compiler_flags = [
        "-XCPP",
        # XXX: Hack because for some reason it doesn't end up being defined.
        "-DCALLCONV=ccall",
    ],
    prebuilt_dependencies = [
        "base",
        "bytestring",
    ],
    visibility = ["//visibility:public"],
    deps = [":cbits"],  # <--- **USED HERE**
)
@mrkkrp
Copy link
Member

mrkkrp commented Feb 12, 2018

I tried to make it work but it looks like it's blocked on bazelbuild/bazel#4370.

@iphydf
Copy link
Author

iphydf commented Feb 14, 2018

This isn't blocking me, so I'm happy for this to be P3 (or whatever is the lowest).

@mboes mboes added P3 minor: not priorized type: bug labels Feb 18, 2018
@ruuda
Copy link

ruuda commented Jun 1, 2018

This now works fine for me with rules_haskell a7ed281. It did not work with v0.5.

@mboes
Copy link
Member

mboes commented Jul 20, 2018

Confirmed that the above BUILD file now works.

@mboes mboes closed this as completed Jul 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 minor: not priorized type: bug
Projects
None yet
Development

No branches or pull requests

4 participants