Skip to content

uhd-4.8.0.0 compilation fails with gcc-15 #844

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
yarda opened this issue Mar 13, 2025 · 12 comments
Closed

uhd-4.8.0.0 compilation fails with gcc-15 #844

yarda opened this issue Mar 13, 2025 · 12 comments

Comments

@yarda
Copy link
Contributor

yarda commented Mar 13, 2025

The gcc-15 defaults to the C23 standard. This compiler is the default in Fedora 42 and newer (e.g. rawhide / f43). The C23 introduced new keyword bool which (beyond others) causes compilation error:

In file included from uhd_dump.c:25:
uhd_dump.h:53:23: error: ‘bool’ cannot be defined via ‘typedef’
   53 | typedef unsigned char bool;
      |                       ^~~~
uhd_dump.h:53:23: note: ‘bool’ is a keyword with ‘-std=c23’ onwards
uhd_dump.h:53:1: warning: useless type name in empty declaration
   53 | typedef unsigned char bool;
      | ^~~~~~~

Possibilities are rename, use of <csdtdbool> or explicitly compile with the -std=gnu17. In fedora we now temporally compile it with the -std=gnu17. There are some other minor problems for which I will open PR.

yarda added a commit to yarda/uhd that referenced this issue Mar 13, 2025
Not all required gcc-15 fixes, see EttusResearch#844 for details.

Related EttusResearch#844
@yarda yarda mentioned this issue Mar 13, 2025
4 tasks
@mbr0wn
Copy link
Contributor

mbr0wn commented Mar 14, 2025

uhd_dump doesn't even use the bool it typedefs. I'll remove that line. Although to be honest, maybe we'll just remove that tool entirely.

@yarda
Copy link
Contributor Author

yarda commented Mar 14, 2025

OK, thanks for the info. I will drop the line and retry, they may be more gcc-15 problems, in such case I will update the #845 or create new one.

@mbr0wn
Copy link
Contributor

mbr0wn commented Mar 14, 2025

@yarda Many thanks for your insights. I'll try and get my hands on a gcc-15 distro (you're probably on rawhide, right? ,<- you say so right at the top, I need to pay better attention) and see if I can reproduce some of the efforts, but it'll be a few days before I get around to that. To save you some time, here's some comments:

  • Some gcc-15 fixes #845 is good and we've already internally approved it, it's just doing some rounds of CI checking. So just leave it as-is and make a new PR.
  • I've also included the typedef bool line in our changeset, but overall, don't worry about uhd_dump. It's time we retired it. You can assume it's going away.
  • If you find some issues within regular UHD that we should know about, those are the most relevant for now.

Again, many thanks for your efforts!

@mbr0wn
Copy link
Contributor

mbr0wn commented Mar 14, 2025

Actually, I did have a quick look and found some warnings outside of your fixes, but no more errors (at least in UHD itself).

@mbr0wn
Copy link
Contributor

mbr0wn commented Mar 14, 2025

...the warnings will be fixed because we internally test UHD with -Werror (at least with gcc).

@yarda
Copy link
Contributor Author

yarda commented Mar 14, 2025

With the dropped typedef bool and the #845 it compiled OK. I am using Fedora 43 (Rawhide), but the same compiler should be in the Fedora 42.

In the #845 I added cstdint because the headers used uint32_t and gcc-15 is more strict and failed because the type was undefined.

@mbr0wn
Copy link
Contributor

mbr0wn commented Mar 14, 2025

Excellent, thanks for the feedback. Like I said, I'll remove the remaining warnings while we're at it, then we should be fine for this gcc version.

@yarda
Copy link
Contributor Author

yarda commented Mar 14, 2025

One more problem noted, it's probably due to the cmake-4.0 in the Rawhide. On s390x and ppc64le it now installs udev rules to the /usr/lib/uhd/... instead of the /usr/lib64/uhd as it does on x86_64 (and did previously). But I think it should install the rules to /usr/lib/udev/rules.d/.

@yarda
Copy link
Contributor Author

yarda commented Mar 14, 2025

One more problem noted, it's probably due to the cmake-4.0 in the Rawhide. On s390x and ppc64le it now installs udev rules to the /usr/lib/uhd/... instead of the /usr/lib64/uhd as it does on x86_64 (and did previously). But I think it should install the rules to /usr/lib/udev/rules.d/.

It's probably this one:
https://bugzilla.redhat.com/show_bug.cgi?id=2351130
With the -DLIB_SUFFIX it compiled OK on all arches.

@mbr0wn
Copy link
Contributor

mbr0wn commented Apr 28, 2025

@yarda I hope to close this out soon, but one FYI: I am planning to start using GNUInstallDirs in the UHD CMake, which will make LIB_SUFFIX redundant (at least, I hope). Any objections from your end?

@yarda
Copy link
Contributor Author

yarda commented Apr 29, 2025

@yarda I hope to close this out soon, but one FYI: I am planning to start using GNUInstallDirs in the UHD CMake, which will make LIB_SUFFIX redundant (at least, I hope). Any objections from your end?

NP, several projects I am maintaining downstream already switched to GNUInstallDirs and it works. If you need some testing in Fedora, feel free to let me know.

@mbr0wn
Copy link
Contributor

mbr0wn commented May 28, 2025

@yarda we've pushed the GNUInstallDirs patch public into master. I'm going to close this, assuming that gcc-15 and F42 are fine now.

@mbr0wn mbr0wn closed this as completed May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants