Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 877579 - crossdev gcc fails to compile stage2 on multiple musl mips toolchains: ld: cannot find crti.o: No such file or directory
Summary: crossdev gcc fails to compile stage2 on multiple musl mips toolchains: ld: ca...
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on: 515694
Blocks:
  Show dependency tree
 
Reported: 2022-10-18 20:43 UTC by immolo
Modified: 2024-04-27 23:42 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (cross-mips64el-unknown-linux-musl-gcc-stage2.log.xz,62.91 KB, application/x-xz)
2022-10-18 20:43 UTC, immolo
Details
mips64-unknown-linux-musl (cross-mips64-unknown-linux-musl-gcc-stage2.log.xz,58.47 KB, application/x-xz)
2022-12-29 12:52 UTC, immolo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description immolo 2022-10-18 20:43:33 UTC
Created attachment 824697 [details]
build.log

While trying to compile a cross toolchain with musl on MIPS I have noticed Musl puts it libraries in /usr/lib but GCC only looks for them in /lib.

Creating a symlink of /lib to /usr/lib allows the second stage to build but a better solution is required.

Steps to reproduce:

1. emerge crossdev
2. crossdev -s4 mips64-unknown-linux-musl
3. wait for failure when it reaches the gcc stage 2 phase

This only seems to affect mip32, mip32el, mips64 and mips64el as every other mips tuple using Musl seems fine (I may have missed one in testing though.) 

I came across https://bugs.gentoo.org/652724 which shows a similar issue for glibc in the past but using the keepdir solution didn't seem to work for me but I will keep trying to see if some tweaking will fix it.
Comment 1 James Le Cuirot gentoo-dev 2022-12-29 10:56:21 UTC
It's worth trying again. My stage3 armv7a-unknown-linux-musleabihf toolchain from earlier this month wouldn't even build hello.c because of crti.o. I rebuilt it from scratch to stage4 and now it's fine.
Comment 2 immolo 2022-12-29 12:52:34 UTC
Created attachment 845648 [details]
mips64-unknown-linux-musl

I've just tested with a clean mips64-unknown-linux-musl crossdev build and I still getting the same issue with MIPS.
Comment 3 Joshua Kinard gentoo-dev 2022-12-29 20:00:10 UTC
Confirmed on my end about the error w/ CHOST mips64-unknown-linux-musl.  I wonder if this is an artifact of the whole merged-usr thing where some bit got overlooked or we have an unaccounted-for corner case?
Comment 4 immolo 2022-12-29 20:06:52 UTC
I'm pretty confident this predates the commits for merge-usr but it is strange how it only happens on certain tuples for MIPS.
Comment 5 immolo 2023-01-25 11:29:36 UTC
Update as of 2023-01-25

mips-unknown-linux-musl is now building successfully in crossdev, I'll test each toolchain over the next month or so to see if issues still occur elsewhere before closing this however this looks very promising from early tests.
Comment 6 immolo 2023-01-31 03:17:38 UTC
So I've done further tests and mips64-unknown-linux-musl and mips32-unknown-linux-musl are still failing but I can't see any hint to why mips-unknown-linux-musl has started working again (unless it was failing for an unrelated issue and I've grouped it in with this issue).
Comment 7 Andreas K. Hüttel archtester gentoo-dev 2023-07-16 21:52:21 UTC
FWIW I tried various gcc versions, various kernel header versions, and various binutils versions (and the oldest musl in tree, 1.2.3), and could not find a working combination.
Comment 8 Andreas K. Hüttel archtester gentoo-dev 2023-08-20 21:03:44 UTC
(In reply to Andreas K. Hüttel from comment #7)
> FWIW I tried various gcc versions, various kernel header versions, and
> various binutils versions (and the oldest musl in tree, 1.2.3), and could
> not find a working combination.

The problem is deeper than crossdev.

I managed to manually piece together a working mips64 musl system.

However, gcc was unable to rebuild itself natively on it (while correctly building everything else).

Other possible sources of the problem could be binutils or glibc.
Comment 9 immolo 2023-08-24 10:27:16 UTC
I tested glibc on a mipsel32 system and didn't run into this issue last year which seemed likely due to the fix in https://bugs.gentoo.org/652724

I'll try setting up a few different builds to find where I hit the issue unless I've just misunderstood your own findings.
Comment 10 Andreas K. Hüttel archtester gentoo-dev 2024-04-27 23:42:36 UTC
(In reply to immolo from comment #9)
> I tested glibc on a mipsel32 system and didn't run into this issue last year
> which seemed likely due to the fix in https://bugs.gentoo.org/652724
> 
> I'll try setting up a few different builds to find where I hit the issue
> unless I've just misunderstood your own findings.

OK please reopen if it still happens.