[Haskell-cafe] Issue building with ghc-9.8.2 and packages unix, directory, filepath and os-string

Tom Smeding x at tomsmeding.com
Thu May 30 21:07:49 UTC 2024


I'm sorry, I should have looked better at what you were actually doing 
-- I didn't realise you were getting these errors while building `unix` 
itself. Are you sure you have an unmodified copy of the `unix` package? 
In particular, it seems that it's missing a dependency on the `filepath` 
package, that should be declared on unix.cabal line 84 for your older 
version of `filepath`.

Note that filepath 1.4.200.1 is marked deprecated on Hackage (the 
version number is coloured red). If you don't want to upgrade to 
filepath 1.5, you should probably use 1.4.300.2.

- Tom

On 30/05/2024 23:00, Tom Smeding wrote:
> `os-string` has been split from `filepath` in filepath 1.5.0.0. If you 
> search for "flag(os-string)" in unix' cabal file here:
>   https://hackage.haskell.org/package/unix-2.8.5.1/unix.cabal
> you'll see that the package has been set up to use `os-string` if 
> `filepath >= 1.5.0.0`, and to not depend on `os-string` otherwise.
>
> For filepath < 1.5.0.0, the modules in question are in the `filepath` 
> package. You can get them by manually depending on `filepath` too.
>
> If you want the post-`os-string` split `filepath`, simply add a lower 
> bound on the version of `filepath` in your thing.cabal file: `filepath 
> >= 1.5.0.0`. As you can see, the diagnostic you got shows that you 
> were indeed using an older `filepath` version.
>
> - Tom
>
> On 30/05/2024 22:22, Andrew Lelechenko wrote:
>> Normally you do not need to set `constraints: unix +os-string, 
>> directory +os-string`. It’s better to let Cabal figure out a build 
>> plan without forcing its hand.
>>
>> Sharing your project would help, otherwise it’s hard to diagnose.
>>
>> Best regards,
>> Andrew
>>
>>> On 30 May 2024, at 08:54, Daniel Trstenjak 
>>> <daniel.trstenjak at gmail.com> wrote:
>>>
>>> Hi,
>>>
>>> I'm trying to get my program to compile with ghc-9.8.2. Raising the
>>> upper bounds of my dependencies I'm running into a compile error
>>> for the unix-2.8.5.1 package:
>>>
>>> [15 of 53] Compiling System.Posix.Env.PosixString ( 
>>> /home/dan/sources/unix-2.8.5.1/dist-newstyle/build/x86_64-linux/ghc-9.8.2/unix-2.8.5.1/build/System/Posix/Env/PosixString.hs, 
>>> /home/dan/sources/unix-2.8.5.1/dist-newstyle/build/x86_64-linux/ghc-9.8.2/unix-2.8.5.1/build/System/Posix/Env/PosixString.o, 
>>> /home/dan/sources/unix-2.8.5.1/dist-newstyle/build/x86_64-linux/ghc-9.8.2/unix-2.8.5.1/build/System/Posix/Env/PosixString.dyn_o 
>>> )
>>>
>>> System/Posix/Env/PosixString.hsc:45:1: error: [GHC-87110]
>>>     Could not load module ‘System.OsString.Internal.Types’.
>>>     It is a member of the hidden package ‘os-string-2.0.3’.
>>>     Perhaps you need to add ‘os-string’ to the build-depends in your 
>>> .cabal file.
>>>     It is a member of the hidden package ‘filepath-1.4.200.1’.
>>>     Perhaps you need to add ‘filepath’ to the build-depends in your 
>>> .cabal file.
>>>     Use -v to see a list of the files searched for.
>>>    |
>>> 45 | import System.OsString.Internal.Types
>>>    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>
>>> System/Posix/Env/PosixString.hsc:47:1: error: [GHC-61948]
>>>     Could not find module ‘System.OsString.Data.ByteString.Short’.
>>>     Perhaps you meant
>>>       System.OsString.Data.ByteString.Short (needs flag -package-id 
>>> os-string-2.0.3)
>>>       System.OsPath.Data.ByteString.Short (needs flag -package-id 
>>> filepath-1.4.200.1)
>>>       System.OsString.Data.ByteString.Short.Word16 (needs flag 
>>> -package-id os-string-2.0.3)
>>>    |
>>> 47 | import qualified "os-string" 
>>> System.OsString.Data.ByteString.Short as B
>>>    | 
>>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>
>>> System/Posix/PosixPath/FilePath.hsc:50:1: error: [GHC-61948]
>>>     Could not find module ‘System.OsString.Data.ByteString.Short’.
>>>     Perhaps you meant
>>>       System.OsString.Data.ByteString.Short (needs flag -package-id 
>>> os-string-2.0.3)
>>>       System.OsPath.Data.ByteString.Short (needs flag -package-id 
>>> filepath-1.4.200.1)
>>>       System.OsString.Data.ByteString.Short.Word16 (needs flag 
>>> -package-id os-string-2.0.3)
>>>    |
>>> 50 | import "os-string" System.OsString.Data.ByteString.Short as BSS
>>>    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>
>>> System/Posix/PosixPath/FilePath.hsc:55:1: error: [GHC-87110]
>>>     Could not load module ‘System.OsString.Internal.Types’.
>>>     It is a member of the hidden package ‘os-string-2.0.3’.
>>>     Perhaps you need to add ‘os-string’ to the build-depends in your 
>>> .cabal file.
>>>     It is a member of the hidden package ‘filepath-1.4.200.1’.
>>>     Perhaps you need to add ‘filepath’ to the build-depends in your 
>>> .cabal file.
>>>     Use -v to see a list of the files searched for.
>>>    |
>>> 55 | import System.OsString.Internal.Types (PosixString(..), pattern 
>>> PS)
>>>    | 
>>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>
>>> I can get rid of this compile error and a similar one for the directory
>>> package by setting the flag os-string in my cabal.project file:
>>>    constraints: unix +os-string, directory +os-string
>>>
>>> Now I'm wondering what is the right way to handle this case?
>>> Thanks for any hints!
>>>
>>> Greetings,
>>> Daniel
>>> _______________________________________________
>>> Haskell-Cafe mailing list
>>> To (un)subscribe, modify options or view archives go to:
>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>>> Only members subscribed via the mailman list are allowed to post.
>> _______________________________________________
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>> Only members subscribed via the mailman list are allowed to post.
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.



More information about the Haskell-Cafe mailing list