You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Text-2.0 causes non-portable binaries by default on windows #487
It uses simdutf by default. That causes GHC to link against its internal libstdc++ on windows, which may not be installed at all or exposed as lib search path.
Yes, this is indeed a hazard of enabling simdutf by default and was one of my concerns about enabling it in the GHC distribution. The thought was that users wanting to redistribute executables would do one of the following:
include libstdc++ in their distribution if they depend upon text
statically link against the C++ standard library; sadly, this is surprisingly tricky to arrange in a platform agnostic manner
ensure they they explicitly disable the simdutf flag in their install plan
For the record, we have in fact disabled simdutf in all of the GHC distributions shipping with text-2 thusfar. In light of issues like this, it is hard for me to imagine being able to change that.
The one possible strategy I can think of would be to link text statically against the C++ standard library. However, as noted above, this is quite nontrivial as it is quite platform-dependent. IIRC Apple platforms don't even provide a static object to link against. Moreover, even on Linux it can be risky since exception handling often relies on dladdr. However, this may not matter in the case of a library like simdutf which is (AFAICT) entirely noexcept.
If that's the case then why ghcup build was affected?
Presumably because the constraints of @hasufell's project precluded use of his compiler's (GHC 8.10.7) pre-existing text and text.cabal enables the simdutf flag by default. He told me via IRC that for the moment he has explicitly disabled the simdutf flag in his project.
Sigh, that's all pretty disappointing. I was under illusion that build-depends: system-cxx-std-lib is all a package needs to declare for GHC to take care of the rest.
Probably we have to disable simdutf by default on Windows. A CI job, running in an empty environment, similar to haskell/bytestring#500, would be helpful to reproduce the issue.
What would happen if you try GHC 9.4 and text +simdutf? Does the problem persist?
I think nothing. That's a limitation of cabal-install and ghc-pkg package databases: The latter doesn't record flags, and cabal-install doesn't really have a way to force recompilation of exactly the same version as in global package db (if you want to change flags).
E.g.
aeson% cabal build -w ghc-9.4.3 --constraint='text +simdutf' --dry
...
Build profile: -w ghc-9.4.3 -O1
In order, the following would be built (use -v for more details):
...
I think nothing. That's a limitation of cabal-install and ghc-pkg package databases:
That is an interesting point; this is something that we should probably try to address. Encoding flag settings in the package database wouldn't be hard although it's not entirely clear to me whether they belong there. They aren't defined in the CABAL specification but given that they are now enshrined in the package description format, I suppose it would be sensible to include them in the package registration format as well. We should open a haskell/cabal ticket about this.
Activity
tfausak commentedon Jan 13, 2023
I'm not certain, but this sounds related to #461.
bgamari commentedon Jan 13, 2023
Yes, this is indeed a hazard of enabling
simdutfby default and was one of my concerns about enabling it in the GHC distribution. The thought was that users wanting to redistribute executables would do one of the following:libstdc++in their distribution if they depend upontextsimdutfflag in their install planhasufell commentedon Jan 13, 2023
https://gitlab.haskell.org/ghc/ghc/-/issues/20724
bgamari commentedon Jan 13, 2023
For the record, we have in fact disabled
simdutfin all of the GHC distributions shipping withtext-2thusfar. In light of issues like this, it is hard for me to imagine being able to change that.The one possible strategy I can think of would be to link
textstatically against the C++ standard library. However, as noted above, this is quite nontrivial as it is quite platform-dependent. IIRC Apple platforms don't even provide a static object to link against. Moreover, even on Linux it can be risky since exception handling often relies ondladdr. However, this may not matter in the case of a library likesimdutfwhich is (AFAICT) entirelynoexcept.Bodigrim commentedon Jan 13, 2023
If that's the case then why
ghcupbuild was affected?bgamari commentedon Jan 13, 2023
Presumably because the constraints of @hasufell's project precluded use of his compiler's (GHC 8.10.7) pre-existing
textandtext.cabalenables thesimdutfflag by default. He told me via IRC that for the moment he has explicitly disabled thesimdutfflag in his project.hasufell commentedon Jan 14, 2023
haskell/ghcup-hs@e00899d
Correct. I reinstall the text boot library. This isn't very uncommon.
Bodigrim commentedon Jan 14, 2023
Sigh, that's all pretty disappointing. I was under illusion that
build-depends: system-cxx-std-libis all a package needs to declare for GHC to take care of the rest.Probably we have to disable
simdutfby default on Windows. A CI job, running in an empty environment, similar to haskell/bytestring#500, would be helpful to reproduce the issue.Bodigrim commentedon Jan 14, 2023
Right, with GHC 8.10 we do not pass
build-depends: system-cxx-std-lib, but ratherextra-libraries: stdc++, which is problematic.@hasufell What would happen if you try GHC 9.4 and
text +simdutf? Does the problem persist?phadej commentedon Jan 15, 2023
I think nothing. That's a limitation of
cabal-installandghc-pkgpackage databases: The latter doesn't record flags, andcabal-installdoesn't really have a way to force recompilation of exactly the same version as in global package db (if you want to change flags).E.g.
and then
cabal-plan toposhowstextin bluemeaning it is coming from global db.
bgamari commentedon Jan 17, 2023
That is an interesting point; this is something that we should probably try to address. Encoding flag settings in the package database wouldn't be hard although it's not entirely clear to me whether they belong there. They aren't defined in the CABAL specification but given that they are now enshrined in the package description format, I suppose it would be sensible to include them in the package registration format as well. We should open a haskell/cabal ticket about this.
bgamari commentedon Jan 26, 2023
I have opened haskell/cabal#8702 to track this.
Bodigrim commentedon Feb 21, 2024
I don't think there is anything here we can fix on
textside, so I suggest to close.hasufell commentedon Feb 21, 2024
Correct.