Hi,
a friend and I just spend a collective 2 weeks trying to figure out why a project we tried to compile succeeded with the official GHC optained from ghcup and failed with the nixos provided GHC builds.
We finally figured out that the official GHC builds seem to be built without linux specific libc features, in particular the official GHC build seems to not use the RTLD_DEFAULT handle for dlsym
The necessary distinction in the code happens here.
In the codebase in question, there were ffi imports for c functions that were missing on the c side. Since the imported haskell functions were never used, they built with the official GHC without problems since it is using RTLD_LAZY and only starts symbol lookups when they are used.
However on nixos, using RTLD_DEFAULT, they caused the build to fail because it tried to resolve the symbols immediately and failed.
It would be helpful to know what the build environment for the official GHC builds looks like. Specifically the linux distibution, compiler versions, compiler flags, libc version etc.
That way we can replicate the same environment during the GHC builds for nixos to stop it from diverging from the official builds.