Linker error when adding a new source file

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Linker error when adding a new source file

Jan van Brügge
Hi,

in order to clean up my code, I've moved a bunch of stuff to a new
source file, `TcRowTys.hs` that works similar to `TcTypeNats.hs`. But
when trying to compile a clean build of GHC, I get a linker error:

```

| Run Ghc LinkHs Stage0: _build/stage0/ghc/build/c/hschooks.o (and 1
more) => _build/stage0/bin/ghc
_build/stage0/lib/../lib/x86_64-linux-ghc-8.6.5/ghc-8.9.0.20190722/libHSghc-8.9.0.20190722.a(PrelInfo.o)(.text+0x2814):
error: undefined reference to 'ghc_TcRowTys_rowTyCons_closure'
_build/stage0/lib/../lib/x86_64-linux-ghc-8.6.5/ghc-8.9.0.20190722/libHSghc-8.9.0.20190722.a(PrelInfo.o)(.data+0x578):
error: undefined reference to 'ghc_TcRowTys_rowTyCons_closure'
_build/stage0/lib/../lib/x86_64-linux-ghc-8.6.5/ghc-8.9.0.20190722/libHSghc-8.9.0.20190722.a(TcHsType.o)(.data+0xdd8):
error: undefined reference to 'ghc_TcRowTys_rnilTyCon_closure'
collect2: Fehler: ld gab 1 als Ende-Status zurück
`gcc' failed in phase `Linker'. (Exit code: 1)

```

I had a look at the Wiki including the FAQ, but did not fine anything
about that topic. Does someone know what I have to do for this to work?

Cheers,
Jan

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: Linker error when adding a new source file

Sandy Maguire
Sometimes I see this if I forget to add a file to the `exposed-modules` field of the cabal file. You might be running into that?

On Fri, Aug 23, 2019 at 10:03 AM Jan van Brügge <[hidden email]> wrote:
Hi,

in order to clean up my code, I've moved a bunch of stuff to a new
source file, `TcRowTys.hs` that works similar to `TcTypeNats.hs`. But
when trying to compile a clean build of GHC, I get a linker error:

```

| Run Ghc LinkHs Stage0: _build/stage0/ghc/build/c/hschooks.o (and 1
more) => _build/stage0/bin/ghc
_build/stage0/lib/../lib/x86_64-linux-ghc-8.6.5/ghc-8.9.0.20190722/libHSghc-8.9.0.20190722.a(PrelInfo.o)(.text+0x2814):
error: undefined reference to 'ghc_TcRowTys_rowTyCons_closure'
_build/stage0/lib/../lib/x86_64-linux-ghc-8.6.5/ghc-8.9.0.20190722/libHSghc-8.9.0.20190722.a(PrelInfo.o)(.data+0x578):
error: undefined reference to 'ghc_TcRowTys_rowTyCons_closure'
_build/stage0/lib/../lib/x86_64-linux-ghc-8.6.5/ghc-8.9.0.20190722/libHSghc-8.9.0.20190722.a(TcHsType.o)(.data+0xdd8):
error: undefined reference to 'ghc_TcRowTys_rnilTyCon_closure'
collect2: Fehler: ld gab 1 als Ende-Status zurück
`gcc' failed in phase `Linker'. (Exit code: 1)

```

I had a look at the Wiki including the FAQ, but did not fine anything
about that topic. Does someone know what I have to do for this to work?

Cheers,
Jan

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


--
I'm currently traveling the world, sleeping on people's couches and doing full-time collaboration on Haskell projects. If this seems interesting to you, please consider signing up as a host! https://isovector.github.io/erdos/

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: Linker error when adding a new source file

Brandon Allbery
In reply to this post by Jan van Brügge
From the looks of it, you're building with a bootstrap compiler (stage 0). Does the build compiler need to have this in its runtime libraries for the built compiler to work? This will require you to work it in in multiple versions, the first providing it without using it and the next using the provided one.

On Fri, Aug 23, 2019 at 12:03 PM Jan van Brügge <[hidden email]> wrote:
Hi,

in order to clean up my code, I've moved a bunch of stuff to a new
source file, `TcRowTys.hs` that works similar to `TcTypeNats.hs`. But
when trying to compile a clean build of GHC, I get a linker error:

```

| Run Ghc LinkHs Stage0: _build/stage0/ghc/build/c/hschooks.o (and 1
more) => _build/stage0/bin/ghc
_build/stage0/lib/../lib/x86_64-linux-ghc-8.6.5/ghc-8.9.0.20190722/libHSghc-8.9.0.20190722.a(PrelInfo.o)(.text+0x2814):
error: undefined reference to 'ghc_TcRowTys_rowTyCons_closure'
_build/stage0/lib/../lib/x86_64-linux-ghc-8.6.5/ghc-8.9.0.20190722/libHSghc-8.9.0.20190722.a(PrelInfo.o)(.data+0x578):
error: undefined reference to 'ghc_TcRowTys_rowTyCons_closure'
_build/stage0/lib/../lib/x86_64-linux-ghc-8.6.5/ghc-8.9.0.20190722/libHSghc-8.9.0.20190722.a(TcHsType.o)(.data+0xdd8):
error: undefined reference to 'ghc_TcRowTys_rnilTyCon_closure'
collect2: Fehler: ld gab 1 als Ende-Status zurück
`gcc' failed in phase `Linker'. (Exit code: 1)

```

I had a look at the Wiki including the FAQ, but did not fine anything
about that topic. Does someone know what I have to do for this to work?

Cheers,
Jan

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


--
brandon s allbery kf8nh

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: Linker error when adding a new source file

Sebastian Graf
I recently experienced this when rebasing. Have you tried a clean build? `rm -rf _build` was enough for me, IIRC.

Am Fr., 23. Aug. 2019 um 17:08 Uhr schrieb Brandon Allbery <[hidden email]>:
From the looks of it, you're building with a bootstrap compiler (stage 0). Does the build compiler need to have this in its runtime libraries for the built compiler to work? This will require you to work it in in multiple versions, the first providing it without using it and the next using the provided one.

On Fri, Aug 23, 2019 at 12:03 PM Jan van Brügge <[hidden email]> wrote:
Hi,

in order to clean up my code, I've moved a bunch of stuff to a new
source file, `TcRowTys.hs` that works similar to `TcTypeNats.hs`. But
when trying to compile a clean build of GHC, I get a linker error:

```

| Run Ghc LinkHs Stage0: _build/stage0/ghc/build/c/hschooks.o (and 1
more) => _build/stage0/bin/ghc
_build/stage0/lib/../lib/x86_64-linux-ghc-8.6.5/ghc-8.9.0.20190722/libHSghc-8.9.0.20190722.a(PrelInfo.o)(.text+0x2814):
error: undefined reference to 'ghc_TcRowTys_rowTyCons_closure'
_build/stage0/lib/../lib/x86_64-linux-ghc-8.6.5/ghc-8.9.0.20190722/libHSghc-8.9.0.20190722.a(PrelInfo.o)(.data+0x578):
error: undefined reference to 'ghc_TcRowTys_rowTyCons_closure'
_build/stage0/lib/../lib/x86_64-linux-ghc-8.6.5/ghc-8.9.0.20190722/libHSghc-8.9.0.20190722.a(TcHsType.o)(.data+0xdd8):
error: undefined reference to 'ghc_TcRowTys_rnilTyCon_closure'
collect2: Fehler: ld gab 1 als Ende-Status zurück
`gcc' failed in phase `Linker'. (Exit code: 1)

```

I had a look at the Wiki including the FAQ, but did not fine anything
about that topic. Does someone know what I have to do for this to work?

Cheers,
Jan

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


--
brandon s allbery kf8nh
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: Linker error when adding a new source file

Sebastian Graf
Ah, you already tried a clean build. Nevermind...

Am Fr., 23. Aug. 2019 um 17:14 Uhr schrieb Sebastian Graf <[hidden email]>:
I recently experienced this when rebasing. Have you tried a clean build? `rm -rf _build` was enough for me, IIRC.

Am Fr., 23. Aug. 2019 um 17:08 Uhr schrieb Brandon Allbery <[hidden email]>:
From the looks of it, you're building with a bootstrap compiler (stage 0). Does the build compiler need to have this in its runtime libraries for the built compiler to work? This will require you to work it in in multiple versions, the first providing it without using it and the next using the provided one.

On Fri, Aug 23, 2019 at 12:03 PM Jan van Brügge <[hidden email]> wrote:
Hi,

in order to clean up my code, I've moved a bunch of stuff to a new
source file, `TcRowTys.hs` that works similar to `TcTypeNats.hs`. But
when trying to compile a clean build of GHC, I get a linker error:

```

| Run Ghc LinkHs Stage0: _build/stage0/ghc/build/c/hschooks.o (and 1
more) => _build/stage0/bin/ghc
_build/stage0/lib/../lib/x86_64-linux-ghc-8.6.5/ghc-8.9.0.20190722/libHSghc-8.9.0.20190722.a(PrelInfo.o)(.text+0x2814):
error: undefined reference to 'ghc_TcRowTys_rowTyCons_closure'
_build/stage0/lib/../lib/x86_64-linux-ghc-8.6.5/ghc-8.9.0.20190722/libHSghc-8.9.0.20190722.a(PrelInfo.o)(.data+0x578):
error: undefined reference to 'ghc_TcRowTys_rowTyCons_closure'
_build/stage0/lib/../lib/x86_64-linux-ghc-8.6.5/ghc-8.9.0.20190722/libHSghc-8.9.0.20190722.a(TcHsType.o)(.data+0xdd8):
error: undefined reference to 'ghc_TcRowTys_rnilTyCon_closure'
collect2: Fehler: ld gab 1 als Ende-Status zurück
`gcc' failed in phase `Linker'. (Exit code: 1)

```

I had a look at the Wiki including the FAQ, but did not fine anything
about that topic. Does someone know what I have to do for this to work?

Cheers,
Jan

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


--
brandon s allbery kf8nh
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: Linker error when adding a new source file

Jan van Brügge
In reply to this post by Sandy Maguire

Thanks Sandy, it seems like that did the job

Am 23.08.19 um 18:04 schrieb Sandy Maguire:
Sometimes I see this if I forget to add a file to the `exposed-modules` field of the cabal file. You might be running into that?

On Fri, Aug 23, 2019 at 10:03 AM Jan van Brügge <[hidden email]> wrote:
Hi,

in order to clean up my code, I've moved a bunch of stuff to a new
source file, `TcRowTys.hs` that works similar to `TcTypeNats.hs`. But
when trying to compile a clean build of GHC, I get a linker error:

```

| Run Ghc LinkHs Stage0: _build/stage0/ghc/build/c/hschooks.o (and 1
more) => _build/stage0/bin/ghc
_build/stage0/lib/../lib/x86_64-linux-ghc-8.6.5/ghc-8.9.0.20190722/libHSghc-8.9.0.20190722.a(PrelInfo.o)(.text+0x2814):
error: undefined reference to 'ghc_TcRowTys_rowTyCons_closure'
_build/stage0/lib/../lib/x86_64-linux-ghc-8.6.5/ghc-8.9.0.20190722/libHSghc-8.9.0.20190722.a(PrelInfo.o)(.data+0x578):
error: undefined reference to 'ghc_TcRowTys_rowTyCons_closure'
_build/stage0/lib/../lib/x86_64-linux-ghc-8.6.5/ghc-8.9.0.20190722/libHSghc-8.9.0.20190722.a(TcHsType.o)(.data+0xdd8):
error: undefined reference to 'ghc_TcRowTys_rnilTyCon_closure'
collect2: Fehler: ld gab 1 als Ende-Status zurück
`gcc' failed in phase `Linker'. (Exit code: 1)

```

I had a look at the Wiki including the FAQ, but did not fine anything
about that topic. Does someone know what I have to do for this to work?

Cheers,
Jan

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


--
I'm currently traveling the world, sleeping on people's couches and doing full-time collaboration on Haskell projects. If this seems interesting to you, please consider signing up as a host! https://isovector.github.io/erdos/

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: Linker error when adding a new source file

Alp Mestanogullari-2

Right, Hadrian knows which modules to compile and link by looking at the .cabal files -- so when you omit a module from the .cabal file Hadrian will fail to build the corresponding library or executable correctly.

On 23/08/2019 18:20, Jan van Brügge wrote:

Thanks Sandy, it seems like that did the job

Am 23.08.19 um 18:04 schrieb Sandy Maguire:
Sometimes I see this if I forget to add a file to the `exposed-modules` field of the cabal file. You might be running into that?

On Fri, Aug 23, 2019 at 10:03 AM Jan van Brügge <[hidden email]> wrote:
Hi,

in order to clean up my code, I've moved a bunch of stuff to a new
source file, `TcRowTys.hs` that works similar to `TcTypeNats.hs`. But
when trying to compile a clean build of GHC, I get a linker error:

```

| Run Ghc LinkHs Stage0: _build/stage0/ghc/build/c/hschooks.o (and 1
more) => _build/stage0/bin/ghc
_build/stage0/lib/../lib/x86_64-linux-ghc-8.6.5/ghc-8.9.0.20190722/libHSghc-8.9.0.20190722.a(PrelInfo.o)(.text+0x2814):
error: undefined reference to 'ghc_TcRowTys_rowTyCons_closure'
_build/stage0/lib/../lib/x86_64-linux-ghc-8.6.5/ghc-8.9.0.20190722/libHSghc-8.9.0.20190722.a(PrelInfo.o)(.data+0x578):
error: undefined reference to 'ghc_TcRowTys_rowTyCons_closure'
_build/stage0/lib/../lib/x86_64-linux-ghc-8.6.5/ghc-8.9.0.20190722/libHSghc-8.9.0.20190722.a(TcHsType.o)(.data+0xdd8):
error: undefined reference to 'ghc_TcRowTys_rnilTyCon_closure'
collect2: Fehler: ld gab 1 als Ende-Status zurück
`gcc' failed in phase `Linker'. (Exit code: 1)

```

I had a look at the Wiki including the FAQ, but did not fine anything
about that topic. Does someone know what I have to do for this to work?

Cheers,
Jan

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


--
I'm currently traveling the world, sleeping on people's couches and doing full-time collaboration on Haskell projects. If this seems interesting to you, please consider signing up as a host! https://isovector.github.io/erdos/

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
-- 
Alp Mestanogullari, Haskell Consultant
Well-Typed LLP, https://www.well-typed.com/

Registered in England and Wales, OC335890
118 Wymering Mansions, Wymering Road, London, W9 2NF, England

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs