Re: Issue building with ghc-9.8.2 and packages unix, directory, filepath and os-string

Tom Smeding <[email protected]>
Newsgroups gmane.comp.lang.haskell.cafe
Message-ID <[email protected]>
`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 <[email protected]> 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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.