Repository navigation
docs: standalone foreign libs are not Windows-only - #9320
andreabedini wants to merge 2 commits into
Conversation
| lib-version-info: 6:3:2 | ||
|
|
||
| if os(Windows) | ||
| -- standalone *must* be used on Windows. |
There was a problem hiding this comment.
What happens otherwise?
| (``libHSbase``), etc. Currently, ``standalone`` *must* be used on Windows | ||
| and *must not* be used on any other platform. | ||
| (``libHSbase``), etc. | ||
| The ``standalone`` option *must* be used on Windows (FIXME: why? is so why is this not automatic?). |
There was a problem hiding this comment.
On Linux, ghc boot packages need to have been compiled with -fPIC otherwise they won't be able to be statically linked in.
|
Ah, the good old |
5375e31 to
568a42b
Compare
|
@BinderDavid @malteneus Would you mind looking at this from a documentation point-of-view? |
|
These are some notes from the investigation I did some months ago |
|
We should probably note that This does highlight an issue I experienced with linking static windows libraries when going from 8.10 to 9.6 (and thus also newer cabal) I think. |
|
@andreabedini do you see a path forward here? @angerman were all of your comments addressed? |
I have not a slightest idea about foreign libs, I'm sorry to say! |
|
I found this GHC ticket which seems relevant. |
568a42b to
d2cb800
Compare
There was a problem hiding this comment.
Pull request overview
Updates the Cabal user guide’s description of the foreign-library options: field to remove the claim that standalone is forbidden on non-Windows platforms, and to better frame the Windows-specific requirements.
Changes:
- Adjusted the narrative text for
options: standaloneto drop “must not be used on any other platform”. - Added an inline comment in the example
if os(Windows)stanza to call out the Windows requirement.
Comments suppressed due to low confidence (1)
doc/cabal-package-description-file.rst:2231
- This paragraph still doesn’t clearly communicate that the restriction is specifically that non-standalone foreign libraries are rejected on Windows by Cabal (see Configure.hs:3135–3141). Consider wording it as a Cabal limitation and explicitly noting that the option is otherwise optional, which aligns with the current implementation (no non-Windows prohibition).
the ``standalone`` option the generated library would have dependencies
on the Haskell runtime library (``libHSrts``), the base library
(``libHSbase``), etc. The ``standalone`` option *must* be used on Windows.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d2cb800 to
a5c50bd
Compare
|
@andreabedini: the UI says "All comments must be resolved." |
Correct the foreign-library documentation: the standalone option is required on Windows but is permitted (and meaningful) on other platforms too, so drop the inaccurate "must not be used on any other platform" claim.
…tion Match the wording of the configure-time error in Distribution.Simple.Configure rather than implying an inherent Windows requirement.
00cda47 to
7638c5b
Compare
When describing the
options:field for foreign libraries, the user guide currenlty says:The phrase "standalone must be used on Windows and must not be used on any other platform" lacks enough details to let the user (or FWIW future contributors :P) understand what the issue is and what happens otherwise.
E.g.
When I tried to produce a standalone library on linux, the only issue I ran into was the old RPATH hack we have since removed (in Remove RPATH workaround #9164). If boot packages are built with
-fPIC, producing a standalone foreign library seems to work without issues.I do not have any knowledge of what can happen not using standalone on Windows (there's even a runtime assertion so one cannot check without modifying cabal). If it is something intrinsic to linking on window, I am wondering: would it make sense to make this automatic? is it worth having the user explictly write
options: standalone?The origin of the phrase seems to be Edsko's commit introducing foreign-libraries: 382143a. The commit message does not provide any further explanation other than "it is not supported":
EDIT: what about macOS? We cannot just ignore it.
EDIT 2: AFAIU this just relies on passing the right flags to GHC, so it's GHC doing the linking. In that case, whether it is supported or not is GHC responsibility more than cabal's.