Skip to content

mrpeach: fix GCC 14 build - #371495

Merged
JohnRTitor merged 2 commits into
NixOS:masterfrom
FliegendeWurst:mrpeach-fix
Jan 8, 2025
Merged

JohnRTitor merged 2 commits into
NixOS:masterfrom
FliegendeWurst:mrpeach-fix

Conversation

@FliegendeWurst

Copy link
Copy Markdown
Member

Related #370862

ref. #356812

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Fits CONTRIBUTING.md.

@github-actions github-actions Bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Jan 6, 2025
@nix-owners
nix-owners Bot requested a review from magnetophon January 6, 2025 17:11

@JohnRTitor JohnRTitor left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of ignoring cause of the error, we can just replace error with perror. The error function used here doesn't seem to be imported from the header file <error.h> for GLIBC. So perror will be fine.

image

A simple but careful substituteInPlace will suffice. Make sure to only replace error() calls and not touch pd_error()

@FliegendeWurst

Copy link
Copy Markdown
Member Author

perror only takes a single argument, so it will be slightly more complicated.

@JohnRTitor

Copy link
Copy Markdown
Member

My apologies, replacing function in source file is not a solution, and should be avoided. That does more damage than we think.

Simply ignoring the error isn't a good solution either, this just means CC couldn't find the required function, which can lead to undefined behaviour.

Another thing I can think of is that, sometimes we forget that a specific version of a app can only be compatible with a version of a dependency, in which case this is puredata. Could the definition of error function lie within a header file provided/used to be provided by the puredata package?

I remember being on a similar situation with jack1. celt_encoder_create function (which was being imported from celt) in the jack1 source had an entirely different definition and arg type in later versions of celt. We could've just ignored the error but this would've broken the jack1 package in some way or another. (9e93bb5)

I inspected the source of celt and turned out 0.7 was the most appropriate. And it fixed the build.

TLDR: my point is that are we perhaps using a different version of a dependency or missing a dependency?

@FliegendeWurst

Copy link
Copy Markdown
Member Author

It is in puredata, behind an ifdef

/* keep this in the Pd app for binary extern compatibility but don't
  include in libpd because it conflicts with the posix pd_error(0, ) function. */
#ifdef PD_INTERNAL
EXTERN void error(const char *fmt, ...)
{
    char buf[MAXPDSTRING];
    va_list ap;
    t_int arg[8];
    int i;

    va_start(ap, fmt);
    vsnprintf(buf, MAXPDSTRING-1, fmt, ap);
    va_end(ap);
    strcat(buf, "\n");

    doerror(NULL, buf);
}
#endif

@FliegendeWurst

Copy link
Copy Markdown
Member Author

Turns out PD_INTERNAL is on by default, so I just added the function to the relevant header. Works now with no ignored errors.

@github-actions github-actions Bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. and removed 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. labels Jan 6, 2025
@nix-owners
nix-owners Bot requested a review from carlthome January 6, 2025 21:55
@JohnRTitor

Copy link
Copy Markdown
Member

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 371495


x86_64-linux

❌ 1 package failed to build:
  • cyclone
✅ 9 packages built:
  • gem
  • helmholtz
  • magnetophonDSP.VoiceOfFaust
  • maxlib
  • mrpeach
  • puredata
  • puremapping
  • timbreid
  • zexy

@JohnRTitor JohnRTitor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cyclone build failure is unrelated to this PR.

@JohnRTitor
JohnRTitor merged commit 9f04431 into NixOS:master Jan 8, 2025
@Sigmanificient Sigmanificient mentioned this pull request Mar 8, 2025
27 of 28 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants