#2 Verify cc is GCC

Open
opened 2 months ago by jdxyz · 3 comments
jdxyz commented 2 months ago

Apologies if this issue stems from upstream coreboot.

When the host cc (/usr/bin/cc, /bin/cc) is linked to a compiler other than gcc (e.g., clang), the build fails.

There is no explicit error to detail that gcc is required - though I didn't believe otherwise.

In Debian, the Alternatives system is responsible for this link, and can be fixed accordingly:

sudo update-alternatives --set cc /usr/bin/gcc

This is an edge case, but may trip up anyone who has been using alternative compilers.

Apologies if this issue stems from upstream coreboot. When the host `cc` (`/usr/bin/cc`, `/bin/cc`) is linked to a compiler other than `gcc` (e.g., `clang`), the build fails. There is no explicit error to detail that `gcc` is required - though I didn't believe otherwise. In Debian, the Alternatives system is responsible for this link, and can be fixed accordingly: `sudo update-alternatives --set cc /usr/bin/gcc` This is an edge case, but may trip up anyone who has been using alternative compilers.
Leah Rowe commented 2 months ago
Owner

Well, coreboot is very cursed when built with Clang.

In general I would recommend GCC. I'm not sure how I would reliable detect what compiler the user has on their distro, because I normally just use GCC.

What do you recommend?

That Debian command you mentioned is nice, but it's debian-specific. I'd like to be distro-agnostic here.

Well, coreboot is very cursed when built with Clang. In general I would recommend GCC. I'm not sure how I would reliable detect what compiler the user has on their distro, because I normally just use GCC. What do you recommend? That Debian command you mentioned is nice, but it's debian-specific. I'd like to be distro-agnostic here.
jdxyz commented 2 months ago
Poster

I'd forgotten I'd changed cc as above, I didn't expect coreboot - or any monolithic software - to build against clang.

I mention it in the interest of preventing repeat occurrences and troubleshooting if cc != gcc.

I don't see anything obvious in the coreboot sources, but I'm not familiar with the toolchain - make can be arcane.

I would suggest patching the source to explicitly define gcc, or wrap build to print a message when $? != 0, but neither of these are elegant.

I'd forgotten I'd changed `cc` as above, I didn't expect `coreboot` - or any monolithic software - to build against `clang`. I mention it in the interest of preventing repeat occurrences and troubleshooting if `cc != gcc`. I don't see anything obvious in the `coreboot` sources, but I'm not familiar with the toolchain - `make` can be arcane. I would suggest patching the source to explicitly define `gcc`, or wrap `build` to print a message when `$? != 0`, but neither of these are elegant.
Leah Rowe commented 1 month ago
Owner

Can you try it? Try modifying the Libreboot build system, accordingly and test it. Then issue a pull request and I'll test your change myself.

Can you try it? Try modifying the Libreboot build system, accordingly and test it. Then issue a pull request and I'll test your change myself.
Sign in to join this conversation.
No Label
No Milestone
No assignee
2 Participants
Loading...
Cancel
Save
There is no content yet.