Re: bug in ghci module loading post 9.12.4?

George Colpitts <[email protected]> Tue, 30 Jun 2026 15:08:12 -0300
Newsgroups gmane.comp.lang.haskell.cafe
Message-ID <CAB-d4A7VfkOh3a7_g01AzaCNQsh7iC5X7Dw5pRtR6dZD0W-b6w@mail.gmail.com>
--===============8576650099049335740==
Content-Type: multipart/alternative; boundary="00000000000094019e06557c7725"

--00000000000094019e06557c7725
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Interesting. On ghc 9.12.5 rc2 in the second ghci session I get the
following error

=CE=BB> :load BugC
[1 of 3] Compiling BugA             ( BugA.hs, interpreted ) [Source file
changed]
Ok, three modules loaded.
(0.01 secs,)
=CE=BB> bug
ld: warning: duplicate -rpath
'/opt/homebrew/Cellar/gcc/15.2.0_1/lib/gcc/current/gcc/aarch64-apple-darwin=
25/15'
ignored
ld: warning: -U option is redundant when using -undefined dynamic_lookup

GHC.Linker.Loader.dynLoadObjs: Loading temp shared object failed
During interactive linking, GHCi couldn't find the following symbol:

dlopen(/var/folders/n0/sz8qwjxd1rv1_0h1r16xr2_c0000gp/T/ghc9044_tmp_0_0/lib=
ghc_tmp_3.dylib,
0x0005): symbol not found in flat namespace '_BugA_x_closure'
This may be due to you not asking GHCi to load extra object files,
archives or DLLs needed by your current session.  Restart GHCi, specifying
the missing library using the -L/path/to/object/dir and -lmissinglibname
flags, or simply by naming the relevant files on the GHCi command line.
Alternatively, this link failure might indicate a bug in GHCi.
If you suspect the latter, please report this as a GHC bug:
  https://www.haskell.org/ghc/reportabug


On Tue, Jun 30, 2026 at 12:27=E2=80=AFPM Tom Smeding <[email protected]> wro=
te:

> An essential component of the reproducer is that you close ghci after the
> first :load (which serves only to generate the .o files) and reopen it
> without -fobject-code, so that the reload of BugA turns it into an
> interpreted module.
>
> On 30/06/2026 13:53, George Colpitts wrote:
>
> fwiw I can't duplicate on MacOS 26.5.2 and ghc 9.12.5 rc2:
>
>  ghci -fobject-code
> Loaded package environment from
> /Users/gcolpitts/.ghc/aarch64-darwin-9.12.4.20260614/environments/default
> GHCi, version 9.12.4.20260614: https://www.haskell.org/ghc/  :? for help
> Loaded GHCi configuration from /Users/gcolpitts/.ghci
> =CE=BB> :load BugC
> [1 of 3] Compiling BugA             ( BugA.hs, BugA.o )
> [2 of 3] Compiling BugB             ( BugB.hs, BugB.o )
> [3 of 3] Compiling BugC             ( BugC.hs, BugC.o )
> Ok, three modules loaded.
> (0.41 secs,)
> =CE=BB> bug
> ld: warning: duplicate -rpath
> '/opt/homebrew/Cellar/gcc/15.2.0_1/lib/gcc/current/gcc/aarch64-apple-darw=
in25/15'
> ignored
> ld: warning: -U option is redundant when using -undefined dynamic_lookup
> 13
> it :: ()
> (3.58 secs, 70,664 bytes)
> =CE=BB> :r
> [1 of 3] Compiling BugA             ( BugA.hs, BugA.o ) [Source file
> changed]
> Ok, three modules reloaded.
> =CE=BB> bug
> ld: warning: duplicate -rpath
> '/opt/homebrew/Cellar/gcc/15.2.0_1/lib/gcc/current/gcc/aarch64-apple-darw=
in25/15'
> ignored
> ld: warning: -U option is redundant when using -undefined dynamic_lookup
> 14
> it :: ()
> (0.34 secs, 67,952 bytes)
>
> On Tue, Jun 30, 2026 at 4:31=E2=80=AFAM Evan Laforge <[email protected]> =
wrote:
>
>> On Tue, Jun 23, 2026 at 10:48=E2=80=AFAM Evan Laforge <[email protected]=
> wrote:
>> >
>> > On Tue, Jun 23, 2026 at 6:44=E2=80=AFAM Zubin Duggal <zubin@well-typed=
.com>
>> wrote:
>> > > Which platform/OS are you building on and how did you obtain
>> > > GHC?
>> >
>> > Oh I should have mentioned, it's OSX, 26.5.1.  Obtained via ghcup, and
>> > using the "ghcup" channel rather than vanilla.
>> >
>> > However, I just tested this with linux on a GCP VM and ghc 9.10.3 and
>> > I still see the issue.  One thing, I see in your non-reproduction that
>> > it says "[1 of 3] Compiling BugA             ( BugA.hs, BugA.o )",
>> > which implies -fobject-code is still on.  The bug only seems to happen
>> > when you are in bytecode mode, but there are .o files available to
>> > load, so you'd have to restart ghci without -fobject-code.
>>
>> Hate to nag but... has anyone managed to reproduce it?  I can make it
>> happen on linux and OSX, and I can verify that it doesn't happen in
>> 9.2.8, and that it starts happening at 9.4.  I believe this is when
>> ghc got a new recompilation avoidance mechanism that was supposed to
>> use hashes instead of mtimes, so that's my guess about what introduced
>> it.
>>
>> I guess I can go ahead and file a bug on gitlab now.  I'm pretty sure
>> now it's a bug so I guess I don't need to wait for someone else to
>> repro but it would be nice to verify...
>>
>> Since permanently leaving on -fobject-code seems to be a workaround
>> and processors are so fast now, I may just leave that flag on now.
>> I'm surprised more people haven't run into this problem in the years
>> since 9.4.
>> _______________________________________________
>> Haskell-Cafe mailing list -- [email protected]
>> To (un)subscribe, modify options or view archives go to:
>> Only members subscribed via the mailman list are allowed to post.
>
>
> _______________________________________________
> Haskell-Cafe mailing list -- [email protected]
> To (un)subscribe, modify options or view archives go to:
> Only members subscribed via the mailman list are allowed to post.
>
>
> _______________________________________________
> Haskell-Cafe mailing list -- [email protected]
> To (un)subscribe, modify options or view archives go to:
> Only members subscribed via the mailman list are allowed to post.

--00000000000094019e06557c7725
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:times ne=
w roman,serif;font-size:large">Interesting. On ghc 9.12.5 rc2 in the second=
 ghci session I get the following error</div><div class=3D"gmail_default" s=
tyle=3D"font-family:times new roman,serif;font-size:large"><br></div><div c=
lass=3D"gmail_default" style=3D"font-family:times new roman,serif;font-size=
:large"><blockquote style=3D"margin:0 0 0 40px;border:none;padding:0px"><di=
v class=3D"gmail_default" style=3D"font-family:times new roman,serif;font-s=
ize:large">=CE=BB&gt; :load BugC<br>[1 of 3] Compiling BugA =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ( BugA.hs, interpreted ) [Source file changed]<=
br>Ok, three modules loaded.<br>(0.01 secs,)<br>=CE=BB&gt; bug<br>ld: warni=
ng: duplicate -rpath &#39;/opt/homebrew/Cellar/gcc/15.2.0_1/lib/gcc/current=
/gcc/aarch64-apple-darwin25/15&#39; ignored<br>ld: warning: -U option is re=
dundant when using -undefined dynamic_lookup<br><br>GHC.Linker.Loader.dynLo=
adObjs: Loading temp shared object failed<br>During interactive linking, GH=
Ci couldn&#39;t find the following symbol:<br>=C2=A0 dlopen(/var/folders/n0=
/sz8qwjxd1rv1_0h1r16xr2_c0000gp/T/ghc9044_tmp_0_0/libghc_tmp_3.dylib, 0x000=
5): symbol not found in flat namespace &#39;_BugA_x_closure&#39;<br>This ma=
y be due to you not asking GHCi to load extra object files,<br>archives or =
DLLs needed by your current session.=C2=A0 Restart GHCi, specifying<br>the =
missing library using the -L/path/to/object/dir and -lmissinglibname<br>fla=
gs, or simply by naming the relevant files on the GHCi command line.<br>Alt=
ernatively, this link failure might indicate a bug in GHCi.<br>If you suspe=
ct the latter, please report this as a GHC bug:<br>=C2=A0 <a href=3D"https:=
//www.haskell.org/ghc/reportabug">https://www.haskell.org/ghc/reportabug</a=
><br></div></blockquote></div></div><br><div class=3D"gmail_quote gmail_quo=
te_container"><div dir=3D"ltr" class=3D"gmail_attr">On Tue, Jun 30, 2026 at=
 12:27=E2=80=AFPM Tom Smeding &lt;<a href=3D"mailto:[email protected]">x@tom=
smeding.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding=
-left:1ex"><u></u>

 =20
   =20
 =20
  <div>
    An essential component of the reproducer is that you close ghci
    after the first :load (which serves only to generate the .o files)
    and reopen it without -fobject-code, so that the reload of BugA
    turns it into an interpreted module.<br>
    <br>
    <div>On 30/06/2026 13:53, George Colpitts
      wrote:<br>
    </div>
    <blockquote type=3D"cite">
     =20
      <div dir=3D"ltr">
        <div class=3D"gmail_default" style=3D"font-family:&quot;times new r=
oman&quot;,serif;font-size:large">fwiw
          I can&#39;t duplicate on MacOS 26.5.2 and ghc 9.12.5 rc2:<br>
          <br>
          =C2=A0ghci -fobject-code <br>
          Loaded package environment from
/Users/gcolpitts/.ghc/aarch64-darwin-9.12.4.20260614/environments/default<b=
r>
          GHCi, version 9.12.4.20260614: <a href=3D"https://www.haskell.org=
/ghc/" target=3D"_blank">https://www.haskell.org/ghc/</a>
          =C2=A0:? for help<br>
          Loaded GHCi configuration from /Users/gcolpitts/.ghci<br>
          =CE=BB&gt; :load BugC<br>
          [1 of 3] Compiling BugA =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 ( BugA.hs, BugA.o )<br>
          [2 of 3] Compiling BugB =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 ( BugB.hs, BugB.o )<br>
          [3 of 3] Compiling BugC =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 ( BugC.hs, BugC.o )<br>
          Ok, three modules loaded.<br>
          (0.41 secs,)<br>
          =CE=BB&gt; bug<br>
          ld: warning: duplicate -rpath
&#39;/opt/homebrew/Cellar/gcc/15.2.0_1/lib/gcc/current/gcc/aarch64-apple-da=
rwin25/15&#39;
          ignored<br>
          ld: warning: -U option is redundant when using -undefined
          dynamic_lookup<br>
          13<br>
          it :: ()<br>
          (3.58 secs, 70,664 bytes)<br>
          =CE=BB&gt; :r<br>
          [1 of 3] Compiling BugA =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 ( BugA.hs, BugA.o )
          [Source file changed]<br>
          Ok, three modules reloaded.<br>
          =CE=BB&gt; bug<br>
          ld: warning: duplicate -rpath
&#39;/opt/homebrew/Cellar/gcc/15.2.0_1/lib/gcc/current/gcc/aarch64-apple-da=
rwin25/15&#39;
          ignored<br>
          ld: warning: -U option is redundant when using -undefined
          dynamic_lookup<br>
          14<br>
          it :: ()<br>
          (0.34 secs, 67,952 bytes)</div>
      </div>
      <br>
      <div class=3D"gmail_quote">
        <div dir=3D"ltr" class=3D"gmail_attr">On Tue, Jun 30, 2026 at
          4:31=E2=80=AFAM Evan Laforge &lt;<a href=3D"mailto:qdunkan@gmail.=
com" target=3D"_blank">[email protected]</a>&gt;
          wrote:<br>
        </div>
        <blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex=
;border-left:1px solid rgb(204,204,204);padding-left:1ex">On
          Tue, Jun 23, 2026 at 10:48=E2=80=AFAM Evan Laforge &lt;<a href=3D=
"mailto:[email protected]" target=3D"_blank">[email protected]</a>&gt;
          wrote:<br>
          &gt;<br>
          &gt; On Tue, Jun 23, 2026 at 6:44=E2=80=AFAM Zubin Duggal &lt;<a =
href=3D"mailto:[email protected]" target=3D"_blank">[email protected]=
</a>&gt;
          wrote:<br>
          &gt; &gt; Which platform/OS are you building on and how did
          you obtain<br>
          &gt; &gt; GHC?<br>
          &gt;<br>
          &gt; Oh I should have mentioned, it&#39;s OSX, 26.5.1.=C2=A0 Obta=
ined
          via ghcup, and<br>
          &gt; using the &quot;ghcup&quot; channel rather than vanilla.<br>
          &gt;<br>
          &gt; However, I just tested this with linux on a GCP VM and
          ghc 9.10.3 and<br>
          &gt; I still see the issue.=C2=A0 One thing, I see in your
          non-reproduction that<br>
          &gt; it says &quot;[1 of 3] Compiling BugA=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0( BugA.hs,
          BugA.o )&quot;,<br>
          &gt; which implies -fobject-code is still on.=C2=A0 The bug only
          seems to happen<br>
          &gt; when you are in bytecode mode, but there are .o files
          available to<br>
          &gt; load, so you&#39;d have to restart ghci without
          -fobject-code.<br>
          <br>
          Hate to nag but... has anyone managed to reproduce it?=C2=A0 I ca=
n
          make it<br>
          happen on linux and OSX, and I can verify that it doesn&#39;t
          happen in<br>
          9.2.8, and that it starts happening at 9.4.=C2=A0 I believe this =
is
          when<br>
          ghc got a new recompilation avoidance mechanism that was
          supposed to<br>
          use hashes instead of mtimes, so that&#39;s my guess about what
          introduced<br>
          it.<br>
          <br>
          I guess I can go ahead and file a bug on gitlab now.=C2=A0 I&#39;=
m
          pretty sure<br>
          now it&#39;s a bug so I guess I don&#39;t need to wait for someon=
e
          else to<br>
          repro but it would be nice to verify...<br>
          <br>
          Since permanently leaving on -fobject-code seems to be a
          workaround<br>
          and processors are so fast now, I may just leave that flag on
          now.<br>
          I&#39;m surprised more people haven&#39;t run into this problem i=
n the
          years<br>
          since 9.4.<br>
          _______________________________________________<br>
          Haskell-Cafe mailing list -- <a href=3D"mailto:haskell-cafe@haske=
ll.org" target=3D"_blank">[email protected]</a><br>
          To (un)subscribe, modify options or view archives go to:<br>
          Only members subscribed via the mailman list are allowed to
          post.</blockquote>
      </div>
      <br>
      <fieldset></fieldset>
      <pre>_______________________________________________
Haskell-Cafe mailing list -- <a href=3D"mailto:[email protected]" ta=
rget=3D"_blank">[email protected]</a>
To (un)subscribe, modify options or view archives go to:
Only members subscribed via the mailman list are allowed to post.</pre>
    </blockquote>
    <br>
  </div>

_______________________________________________<br>
Haskell-Cafe mailing list -- <a href=3D"mailto:[email protected]" ta=
rget=3D"_blank">[email protected]</a><br>
To (un)subscribe, modify options or view archives go to:<br>
Only members subscribed via the mailman list are allowed to post.</blockquo=
te></div>

--00000000000094019e06557c7725--

--===============8576650099049335740==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Haskell-Cafe mailing list -- [email protected]
To (un)subscribe, modify options or view archives go to:
Only members subscribed via the mailman list are allowed to post.
--===============8576650099049335740==--