Opened 5 years ago

Closed 3 years ago

Last modified 2 years ago

#7452 closed bug (fixed)

[GNU gold] ld: error: cannot find [...]/Types__1.o

Reported by: mrothe Owned by:
Priority: normal Milestone: 7.10.1
Component: Build System Version: 7.6.1
Keywords: Cc: gidyn
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: Building GHC failed Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

/usr/bin/ld is gold linker and I am trying to compile GHC 7.6.1 using it. I grabbed GHC 7.6.1 from haskell.org/ghc and edited settings; i.e. removing --hash-size=31 and --reduce-memory-overheads.

While running make the linker cannot find some object files:

$ make
===--- building phase 0
make -r --no-print-directory -f ghc.mk phase=0 phase_0_builds
make[1]: Nothing to be done for `phase_0_builds'.
===--- building phase 1
make -r --no-print-directory -f ghc.mk phase=1 phase_1_builds
make[1]: Nothing to be done for `phase_1_builds'.
===--- building final phase
make -r --no-print-directory -f ghc.mk phase=final all
/usr/bin/xsltproc  docs/man/flags.xsl docs/man/flags.xml > docs/man/ghc.1
  HC [stage 0] utils/hp2ps/dist/build/tmp/hp2ps
Warning: -rtsopts and -with-rtsopts have no effect with -no-hs-main.
    Call hs_init_ghc() from your main() function to set these options.
"cp" -p utils/hp2ps/dist/build/tmp/hp2ps inplace/bin/hp2ps
  HC [stage 0] utils/genapply/dist/build/tmp/genapply
"cp" -p utils/genapply/dist/build/tmp/genapply inplace/bin/genapply
  HC [stage 1] libraries/ghc-prim/dist-install/build/GHC/Types.o
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../x86_64-pc-linux-gnu/bin/ld: error: cannot find libraries/ghc-prim/dist-install/build/GHC/Types_o_split/Types__1.o
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../x86_64-pc-linux-gnu/bin/ld: error: cannot find libraries/ghc-prim/dist-install/build/GHC/Types_o_split/Types__2.o
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../x86_64-pc-linux-gnu/bin/ld: error: cannot find libraries/ghc-prim/dist-install/build/GHC/Types_o_split/Types__3.o
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../x86_64-pc-linux-gnu/bin/ld: error: cannot find libraries/ghc-prim/dist-install/build/GHC/Types_o_split/Types__4.o
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../x86_64-pc-linux-gnu/bin/ld: error: cannot find libraries/ghc-prim/dist-install/build/GHC/Types_o_split/Types__5.o
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../x86_64-pc-linux-gnu/bin/ld: error: cannot find libraries/ghc-prim/dist-install/build/GHC/Types_o_split/Types__6.o
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../x86_64-pc-linux-gnu/bin/ld: error: cannot find libraries/ghc-prim/dist-install/build/GHC/Types_o_split/Types__7.o
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../x86_64-pc-linux-gnu/bin/ld: error: cannot find libraries/ghc-prim/dist-install/build/GHC/Types_o_split/Types__8.o
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../x86_64-pc-linux-gnu/bin/ld: error: cannot find libraries/ghc-prim/dist-install/build/GHC/Types_o_split/Types__9.o
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../x86_64-pc-linux-gnu/bin/ld: error: cannot find libraries/ghc-prim/dist-install/build/GHC/Types_o_split/Types__10.o
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../x86_64-pc-linux-gnu/bin/ld: error: cannot find libraries/ghc-prim/dist-install/build/GHC/Types_o_split/Types__11.o
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../x86_64-pc-linux-gnu/bin/ld: error: cannot find libraries/ghc-prim/dist-install/build/GHC/Types_o_split/Types__12.o
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../x86_64-pc-linux-gnu/bin/ld: error: cannot find libraries/ghc-prim/dist-install/build/GHC/Types_o_split/Types__13.o
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../x86_64-pc-linux-gnu/bin/ld: error: cannot find libraries/ghc-prim/dist-install/build/GHC/Types_o_split/Types__14.o
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../x86_64-pc-linux-gnu/bin/ld: error: cannot find libraries/ghc-prim/dist-install/build/GHC/Types_o_split/Types__15.o
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../x86_64-pc-linux-gnu/bin/ld: error: cannot find libraries/ghc-prim/dist-install/build/GHC/Types_o_split/Types__16.o
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../x86_64-pc-linux-gnu/bin/ld: error: cannot find libraries/ghc-prim/dist-install/build/GHC/Types_o_split/Types__17.o
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../x86_64-pc-linux-gnu/bin/ld: error: cannot find libraries/ghc-prim/dist-install/build/GHC/Types_o_split/Types__18.o
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../x86_64-pc-linux-gnu/bin/ld: error: cannot find libraries/ghc-prim/dist-install/build/GHC/Types_o_split/Types__19.o
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../x86_64-pc-linux-gnu/bin/ld: error: cannot find libraries/ghc-prim/dist-install/build/GHC/Types_o_split/Types__20.o
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../x86_64-pc-linux-gnu/bin/ld: error: cannot find libraries/ghc-prim/dist-install/build/GHC/Types_o_split/Types__21.o
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../x86_64-pc-linux-gnu/bin/ld: error: cannot find libraries/ghc-prim/dist-install/build/GHC/Types_o_split/Types__22.o
/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../x86_64-pc-linux-gnu/bin/ld: error: cannot find libraries/ghc-prim/dist-install/build/GHC/Types_o_split/Types__23.o
collect2: error: ld returned 1 exit status
make[1]: *** [libraries/ghc-prim/dist-install/build/GHC/Types.o] Error 1
make: *** [all] Error 2

All object files that cannot be found are present and switching /usr/bin/ld to the bfd linker solves the problem.

Attachments (2)

gold-absolute-path.diff (622 bytes) - added by slomo 3 years ago.
0001-Use-absolute-paths-in-GNU-ld-linker-scripts.patch (1.2 KB) - added by slomo 3 years ago.

Download all attachments as: .zip

Change History (15)

comment:1 Changed 5 years ago by mrothe

The above description is not quite correct: I'm using the binary from [1] in order to compile the sources from haskell.org, because the binaries from haskell.org require an old version of gmp.

[1] http://code.haskell.org/~slyfox/ghc-amd64/

comment:2 Changed 4 years ago by igloo

difficulty: Unknown
Milestone: 7.8.1
Priority: normalhigh

Thanks for the report. We'll take a look.

comment:3 Changed 4 years ago by gidyn

Cc: gideon@… added

I'm being hit by this (using the official 7.6.3 binary distribution to compile the sources), although it used to work. I have no idea what's changed in the meantime.

comment:4 Changed 4 years ago by gidyn

The gold linker doesn't understand relative paths. This also effects building anything with -split-objs, see https://bugzilla.redhat.com/show_bug.cgi?id=635935

comment:6 Changed 3 years ago by thoughtpolice

Milestone: 7.8.37.10.1
Priority: highnormal
Status: newinfoneeded

Since this looks like a binutils bug, I'm lowering priority and moving out of 7.8.3 - can we do anything to help?

comment:7 in reply to:  6 Changed 3 years ago by octoploid

Replying to thoughtpolice:

Since this looks like a binutils bug, I'm lowering priority and moving out of 7.8.3 - can we do anything to help?

Sure. Just don't use relative paths in linker scripts. Use full paths instead.

Changed 3 years ago by slomo

Attachment: gold-absolute-path.diff added

comment:8 Changed 3 years ago by slomo

The attached patch against 7.8.3 works around this by always putting absolute paths to the .o files into the linker script. Works with gold but should also just work fine with bfd (but I didn't test that).

comment:9 Changed 3 years ago by thoughtpolice

Status: infoneededpatch

comment:10 Changed 3 years ago by Austin Seipp <austin@…>

In 021b7978d14799bae779907faf7490cfd21b3f46/ghc:

driver: use absolute paths in ld scripts (#7452)

Patch contributed by slowmo.

Signed-off-by: Austin Seipp <austin@well-typed.com>

comment:11 Changed 3 years ago by thoughtpolice

Resolution: fixed
Status: patchclosed

comment:12 Changed 2 years ago by gidyn

Cc: gideon@… removed

comment:13 Changed 2 years ago by gidyn

Cc: gidyn added
Note: See TracTickets for help on using tickets.