Trouble with Haskell, devenv.sh and network libs

I am trying to get a simple Haskell project going with devenv.sh, but I am unable to install any package that needs network. Right now, I am running ghc 9.8.2 and adding aeson and http-conduit as deps.

Here is the error:

Building     network-3.2.7.0 (all, legacy fallback: build-type is Configure)

Failed to build network-3.2.7.0.
Build log (
/Users/cyberglot/.cache/cabal/logs/ghc-9.8.2/ntwrk-3.2.7.0-e5b96791.log ):
Configuring network-3.2.7.0...
configure: WARNING: unrecognized options: --with-compiler
checking build system type... x86_64-apple-darwin24.1.0
checking host system type... x86_64-apple-darwin24.1.0
checking for gcc... /nix/store/raqax5qp65an4jcwj1bzd5lq589ywpg0-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/raqax5qp65an4jcwj1bzd5lq589ywpg0-clang-wrapper-16.0.6/bin/cc accepts -g... yes
checking for /nix/store/raqax5qp65an4jcwj1bzd5lq589ywpg0-clang-wrapper-16.0.6/bin/cc option to enable C11 features... none needed
checking for an ANSI C-conforming const... yes
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for limits.h... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for sys/types.h... (cached) yes
checking for fcntl.h... yes
checking for sys/uio.h... yes
checking for sys/socket.h... yes
checking for netinet/in.h... yes
checking for netinet/tcp.h... yes
checking for sys/un.h... yes
checking for arpa/inet.h... yes
checking for netdb.h... yes
checking for net/if.h... yes
checking for netioapi.h... no
checking for struct ucred... no
checking for gai_strerror... yes
checking for gethostent... yes
checking for accept4... no
checking for getpeereid... yes
checking for /nix/store/raqax5qp65an4jcwj1bzd5lq589ywpg0-clang-wrapper-16.0.6/bin/cc options needed to detect all undeclared functions... none needed
checking whether AI_ADDRCONFIG is declared... yes
checking whether AI_ALL is declared... yes
checking whether AI_NUMERICSERV is declared... yes
checking whether AI_V4MAPPED is declared... yes
checking whether IPV6_V6ONLY is declared... yes
checking whether IPPROTO_IP is declared... yes
checking whether IPPROTO_TCP is declared... yes
checking whether IPPROTO_IPV6 is declared... yes
checking whether SO_PEERCRED is declared... no
checking for struct msghdr.msg_control... yes
checking for struct msghdr.msg_accrights... no
checking for struct sockaddr.sa_len... yes
configure: creating ./network.buildinfo
configure: creating ./config.status
config.status: creating include/HsNetworkConfig.h
configure: WARNING: unrecognized options: --with-compiler
Preprocessing library for network-3.2.7.0...
compiling dist/build/Network/Socket/Posix/Cmsg_hsc_make.c failed (exit code 1)
rsp file was: "dist/build/Network/Socket/Posix/hsc2hscall58377-0.rsp"
command was: /nix/store/raqax5qp65an4jcwj1bzd5lq589ywpg0-clang-wrapper-16.0.6/bin/cc -c dist/build/Network/Socket/Posix/Cmsg_hsc_make.c -o dist/build/Network/Socket/Posix/Cmsg_hsc_make.o --target=x86_64-apple-darwin -Qunused-arguments --target=x86_64-apple-darwin -Qunused-arguments --target=x86_64-apple-darwin -Wl,-no_fixup_chains -Wl,-no_warn_duplicate_libraries -D__GLASGOW_HASKELL__=908 -Ddarwin_BUILD_OS=1 -Dx86_64_BUILD_ARCH=1 -Ddarwin_HOST_OS=1 -Dx86_64_HOST_ARCH=1 -Iinclude -Idist/build/include -Idist/build/autogen -Idist/build/global-autogen -include dist/build/autogen/cabal_macros.h -I/Users/cyberglot/.local/state/cabal/store/ghc-9.8.2-inplace/nx-2.8.6.0-318c0b1a/lib//include -I/nix/store/y0x2b4i8phqirkf4i2jk0q5axjm2d8yy-ghc-9.8.2/lib/ghc-9.8.2/lib/../lib/x86_64-osx-ghc-9.8.2/time-1.12.2-inplace/include -I/nix/store/y0x2b4i8phqirkf4i2jk0q5axjm2d8yy-ghc-9.8.2/lib/ghc-9.8.2/lib/../lib/x86_64-osx-ghc-9.8.2/bytestring-0.12.1.0-inplace/include -I/nix/store/v7ldx1ra3wrjaasap8bfradapkqi2w1r-libiconv-107/include -I/nix/store/y0x2b4i8phqirkf4i2jk0q5axjm2d8yy-ghc-9.8.2/lib/ghc-9.8.2/lib/../lib/x86_64-osx-ghc-9.8.2/base-4.19.1.0-inplace/include -I/nix/store/wzvk668wvrfclafvbi5as13a095dww45-gmp-with-cxx-6.3.0-dev/include -I/nix/store/y0x2b4i8phqirkf4i2jk0q5axjm2d8yy-ghc-9.8.2/lib/ghc-9.8.2/lib/../lib/x86_64-osx-ghc-9.8.2/ghc-bignum-1.3-inplace/include -I/nix/store/744q5znp00wfwfwjb2gyhlpxyfzsng9f-libffi-3.4.6-dev/include -I/nix/store/y0x2b4i8phqirkf4i2jk0q5axjm2d8yy-ghc-9.8.2/lib/ghc-9.8.2/lib/../lib/x86_64-osx-ghc-9.8.2/rts-1.0.2/include -I/nix/store/y0x2b4i8phqirkf4i2jk0q5axjm2d8yy-ghc-9.8.2/include/include/
error: Cmsg.hsc:62:16: error: use of undeclared identifier 'IP_RECVTOS'
    hsc_const (IP_RECVTOS);
               ^
Cmsg.hsc:62:16: error: use of undeclared identifier 'IP_RECVTOS'
Cmsg.hsc:62:16: error: use of undeclared identifier 'IP_RECVTOS'
3 errors generated.

I couldn’t find anything on the internet about this. Any pointers?

Which version of devenv.sh are you using ?
Are you using flakes ?

I was on devenv 1.2.0 when I wrote this. But I have updated it to 1.3.1, but the problem persists.
And yes, I’m using flakes.

Hello there! I’m experiencing the same issue in this personal project. I’m using devenv not flake. Did you find a solution to this problem?

I guess this may be related to the issue: Everything I try that requires the network package fails · Issue #593 · haskell/network · GitHub