Thanks for everybody's help, I have closed the issue. Sorry for bothering everyone. As I wrote in the bug:@adamse, @mpickering. You are right, there is something wrong about my environment file default. When I remove it I can compile with
ghc -static -prof -fprof-auto hello.hs
The need for -static is not documented as far as I know so I will file a doc bug. My apologies for not debugging this earlier. I will keep an eye out to see when an environment file gets created. Thanks again !
On Mon, May 15, 2023 at 9:11 AM George Colpitts <george.colpitts@gmail.com> wrote:Forgot to add that my current workaround is to compile with "-static -package-env=-" i.e.ghc -static -package-env=- -prof -fprof-auto hello.hsAdding just -package-env=- i.e. gives me the same error as compiling without it.ghc -package-env=- -prof -fprof-auto hello.hs
[1 of 2] Compiling Main ( hello.hs, hello.o )
hello.hs:1:1: error:
Could not find module ‘Prelude’
Perhaps you haven't installed the "p_dyn" libraries for package ‘base-4.18.0.0’?
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
1 |
| ^Adding just -static givesghc -static -prof -fprof-auto hello.hs
Loaded package environment from /Users/gcolpitts/.ghc/x86_64-darwin-9.6.1/environments/default
[1 of 2] Compiling Main ( hello.hs, hello.o ) [Missing object file]
[2 of 2] Linking hello
ld: warning: directory not found for option '-L/opt/local/lib/'
ld: library not found for -lHStxmth-0.12.7.1-f954854b_p
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ghc-9.6.1: `gcc' failed in phase `Linker'. (Exit code: 1)I can't find any doc saying that -static is required for profiling on the Mac but perhaps that is the case?On Sun, May 14, 2023 at 3:43 PM George Colpitts <george.colpitts@gmail.com> wrote:Is anybody on 9.6.1 having problems profiling on a Mac? As I reported in https://gitlab.haskell.org/ghc/ghc/-/issues/23211where the file hello.hs consists of the line:
ghc -prof -fprof-auto hello.hs
main = print "hello"gets the error:Could not find module ‘Prelude’Perhaps you haven't installed the "p_dyn" libraries for package ‘base-4.18.0.0’?It seems to me like a regression of the closed bug https://gitlab.haskell.org/ghc/ghc/-/issues/20707.ThanksGeorge