Git Product home page Git Product logo

Comments (3)

judah avatar judah commented on July 28, 2024

Thanks for the report. Would if work we just changed rules_haskell (in info.bzl:compile_info_output_groups) to remove any C libraries whose path doesn't end in ".so"? Does rules_haskell already make a similar distinction when figuring out the command-line for, say, linking a haskell_binary with linkstatic=False against libz? (I assume in that case it also only needs to only pass -lz.)

from hrepl.

aherrmann avatar aherrmann commented on July 28, 2024

Would if work we just changed rules_haskell (in info.bzl:compile_info_output_groups) to remove any C libraries whose path doesn't end in ".so"?

That wouldn't work on other platforms, e.g. on Darwin, nixpkgs or system provided libraries would end on .dylib. Also, if one wants to use the transitive_cc_libs field to determine the required library files, then one will need all of them. Typically, libz.so.1.2.11 is the actual library file, libz.so is a symlink and is what ld finds when one passes -lz, libz.so.1 is another symlink and matches the SONAME of the library, so artifacts that dynamically link against libz will look for that file.

Does rules_haskell already make a similar distinction when figuring out the command-line [...]?

rules_haskell has logic to determine the library name based on a file name. It strips the lib prefix and the file extension where it considers all of .so.1.2.11 as the extension. We don't currently deduplicate the resulting linker flags, so we'll have -lz -lz -lz. AFAIK ld handles this fine, but if it's an issue one could deduplicate with something like map head . groups (to preserve linking order).

from hrepl.

jamesthompson avatar jamesthompson commented on July 28, 2024

@aherrmann I've just been bitten by this with rules_haskell on macOS trying to link against postgresql-libpq.

There it has a static library libpgcommon.a that it's trying to load and it's giving me the same error.

User-specified static library could not be loaded (external/nixpkgs_postgresql/lib/libpgcommon.a)
Loading static libraries is not supported in this configuration.
Try using a dynamic library instead.

from hrepl.

Related Issues (13)

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.