composewell / streamly

High performance, concurrent functional programming abstractions
https://streamly.composewell.com
Other
849 stars 63 forks source link

streamly 0.10.1 does not build on MacOS #2746

Open semanticphilosopher opened 1 month ago

semanticphilosopher commented 1 month ago

Building from hackage with ghc 9.6.4 results in:

[65 of 72] Compiling Streamly.Internal.FileSystem.Event ( src/Streamly/Internal/FileSystem/Event.hs, dist/build/Streamly/Internal/FileSystem/Event.o, dist/build/Streamly/Internal/FileSystem/Event.dyn_o )

src/Streamly/Internal/FileSystem/Event.hs:54:51: error:
    Module
    ‘Streamly.Internal.FileSystem.Event.Darwin’
    does not export
    ‘Event’
   |
54 | import Streamly.Internal.FileSystem.Event.Darwin (Event)
   |                                                   ^^^^^
harendra-kumar commented 1 month ago

Which version of macOS is it? Are there any other warnings or errors seen before this error? We have CI's on macOS which pass before we release.

semanticphilosopher commented 1 month ago

It is MacOS Sonoma 14.5; Looking back (sorry I should have scrolled back) There was an autoconf failure which as deemed ignorable - namely:

Configuring streamly-0.10.1...
checking for gcc... /nix/store/s7lwib0lr80bqq0k43vd1ihr63yc6yql-clang-wrapper-16.0.6/bin/cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether /nix/store/s7lwib0lr80bqq0k43vd1ihr63yc6yql-clang-wrapper-16.0.6/bin/cc accepts -g... yes
checking for /nix/store/s7lwib0lr80bqq0k43vd1ihr63yc6yql-clang-wrapper-16.0.6/bin/cc option to enable C11 features... none needed
checking for /nix/store/s7lwib0lr80bqq0k43vd1ihr63yc6yql-clang-wrapper-16.0.6/bin/cc options needed to detect all undeclared functions... none needed
checking whether IN_MASK_CREATE is declared... no
checking whether IN_EXCL_UNLINK is declared... no
checking whether kFSEventStreamCreateFlagFileEvents is declared... no
checking whether kFSEventStreamCreateFlagFullHistory is declared... no
checking whether kFSEventStreamEventFlagItemCloned is declared... no
checking whether kFSEventStreamEventFlagItemIsHardlink is declared... no
configure: creating ./config.status
config.status: creating src/config.h
Preprocessing library for streamly-0.10.1..
Building library for streamly-0.10.1..

src/Streamly/Internal/FileSystem/Event/Darwin.hs:1079:2: error:
     warning: "Autoconf did not find the definition kFSEventStreamCreateFlagFileEvents in Darwin header files.Do you have Cocoa framework header files installed?Not compiling the Streamly.Internal.FileSystem.Event.Darwin module. Programs depending on this module may not compile. Check if HAVE_DECL_KFSEVENTSTREAMCREATEFLAGFILEEVENTS is defined in config.h generated from src/config.h.in" [-W#warnings]
     |
1079 | #warning "Autoconf did not find the definition \
     |  ^
#warning "Autoconf did not find the definition \
 ^
1 warning generated.

<no location info>: warning: [GHC-42258] [-Wunused-packages]
    The following packages were specified via -package or -package-id flags,
    but were not needed for compilation:
      - directory-1.3.8.1 (exposed by flag -package-id directory-1.3.8.1)
harendra-kumar commented 1 month ago

Just now, built streamly-0.10.1 successfully on macOS sonoma 14.3.1:

Configuring streamly-0.10.1...
checking for gcc... /usr/bin/gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether /usr/bin/gcc accepts -g... yes
checking for /usr/bin/gcc option to enable C11 features... none needed
checking for /usr/bin/gcc options needed to detect all undeclared functions... none needed
checking whether IN_MASK_CREATE is declared... no
checking whether IN_EXCL_UNLINK is declared... no
checking whether kFSEventStreamCreateFlagFileEvents is declared... yes
checking whether kFSEventStreamCreateFlagFullHistory is declared... yes
checking whether kFSEventStreamEventFlagItemCloned is declared... yes
checking whether kFSEventStreamEventFlagItemIsHardlink is declared... yes
configure: creating ./config.status

Maybe some issue with your xcode cli tools or xcode configuration. So it is not able to find the header files.

semanticphilosopher commented 1 month ago

I checked, and force updated, xcode - still the same issue - looking like something related to 14.5

harendra-kumar commented 1 month ago

Completed the build successfully on 14.5. Here are the versions of the relevant tools in my config:

cutlass:~/streamly-0.10.1$ sw_vers -productVersion
14.5
cutlass:~/streamly-0.10.1$ cabal --version
cabal-install version 3.10.3.0
compiled using version 3.10.3.0 of the Cabal library 
cutlass:~/streamly-0.10.1$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.6.5
cutlass:~/streamly-0.10.1$ xcode-select --version
xcode-select version 2408.
cutlass:~/streamly-0.10.1$ xcode-select -p       
/Applications/Xcode.app/Contents/Developer
harendra-kumar commented 1 month ago

I have tested it on intel silicon. Are you building on apple silicon? Not sure if that makes a difference.

semanticphilosopher commented 1 month ago

Hi, thanks for your focus.

My versions are:

neil@fuji> sw_vers -productVersion ~ 14.5 neil@fuji> cabal --version ~ cabal-install version 3.10.2.1 compiled using version 3.10.1.0 of the Cabal library neil@fuji> ghc --version ~ The Glorious Glasgow Haskell Compilation System, version 9.6.4 neil@fuji> xcode-select --version ~ xcode-select version 2408. neil@fuji> xcode-select -p ~ /Applications/Xcode.app/Contents/Developer

I am on apple silicon

harendra-kumar commented 1 month ago

Built successfully on macOS 14.5 using Apple M1 Pro hardware as well. Are you using nix to build it?

semanticphilosopher commented 1 month ago

The mac has nix on it - but I was using cabal directly. The tools are the ones installed by nix

harendra-kumar commented 1 month ago

Remove nix tools from your PATH environment variable, and try building it with ghcup installed ghc.

locallycompact commented 5 days ago

What is the cause of the failure on nix? Also experiencing missing Event symbol.

harendra-kumar commented 5 days ago

If you are using some tools/libraries from nix and some from native OS then you may face some unpredictable issues. I suggested to remove nix tools from the PATH above to try and build it using native OS tools only to identify if there is such an issue. Otherwise, we always build using nix and it works fine.

locallycompact commented 5 days ago

Oh, no. This is a nix derivation. Generated with cabal2nix and using the latest version of nixpkgs/haskell-updates.

https://gitlab.horizon-haskell.net/package-sets/horizon-platform/-/jobs/1463303

harendra-kumar commented 3 days ago

Are you able to build https://hackage.haskell.org/package/hfsevents in the same environment?