Skip to content

configure: remove -c to link test for macOS#9072

Merged
nGoline merged 1 commit into
ElementsProject:masterfrom
daeho-ro:fix-macos-build
Jun 19, 2026
Merged

configure: remove -c to link test for macOS#9072
nGoline merged 1 commit into
ElementsProject:masterfrom
daeho-ro:fix-macos-build

Conversation

@daeho-ro

Copy link
Copy Markdown
Contributor

Important

26.04 FREEZE March 11th: Non-bugfix PRs not ready by this date will wait for 26.06.

RC1 is scheduled on March 23rd

The final release is scheduled for April 15th.

Fix to build on macOS.

Checklist

Before submitting the PR, ensure the following tasks are completed. If an item is not applicable to your PR, please mark it as checked:

  • The changelog has been updated in the relevant commit(s) according to the guidelines.
  • Tests have been added or modified to reflect the changes.
  • Documentation has been reviewed and updated as needed.
  • Related issues have been listed and linked, including any that this PR closes.
  • Important All PRs must consider how to reverse any persistent changes for tools/lightning-downgrade

@madelinevibes

Copy link
Copy Markdown
Collaborator

@daeho-ro it'd be great to add this into the 26.09 release. For that to happen, can you please resolve conflicts so I can run it through CI again?

@madelinevibes madelinevibes added this to the v26.09 milestone Jun 17, 2026
@daeho-ro daeho-ro changed the title configure: remote -c to link test for macOS configure: remove -c to link test for macOS Jun 17, 2026
@daywalker90

Copy link
Copy Markdown
Collaborator

Fix to build on macOS.

What is there to fix? Last time i checked it works.

@daeho-ro

Copy link
Copy Markdown
Contributor Author

As far as I remember, those line tried to link library but -c option means no linking. That makes warning on clang but it is became an error.

clang: warning: argument unused during compilation: '-Wl,--gc-sections'

@daywalker90

Copy link
Copy Markdown
Collaborator

argument unused during compilation

I don't see that warning in CI. Do you see it in your local setup?

@daeho-ro

Copy link
Copy Markdown
Contributor Author

For 26.06.1,

==> ./configure --prefix=/opt/homebrew/Cellar/core-lightning/26.06.1
-n Compiling ccan/tools/configurator/configurator...
ld: unknown options: --gc-sections 
clang: error: linker command failed with exit code 1 (use -v to see invocation)

and same error for head build (master)

@daywalker90

Copy link
Copy Markdown
Collaborator

I think i get it now, just not why CI is NOT failing the macos test.

# Given CC and FLAGS do we support -ffunction-sections and --gc-sections?
have_function_sections()
{
    # This gets removed automatically on exit!
    TMPCFILE=$CONFIG_VAR_FILE.$$.c
    TMPOBJFILE=$CONFIG_VAR_FILE.$$.o
    
    echo "int foo(void); int foo(void) { return 0; }" > $TMPCFILE
    # We *want* this to fail if we get a warning, hence use -Werror.
    $1 $2 -Werror -ffunction-sections -Wl,--gc-sections -c $TMPCFILE -o $TMPOBJFILE
}

This is supposed to check if -ffunction-sections and --gc-sections, where the first is a compiler option and the second a linker option. -c is a compiler option to stop before linking. This might cause the issue? That it does not try to link on some versions and therefore pass this test when it should not?

@daeho-ro

Copy link
Copy Markdown
Contributor Author

First of all, I don't know much about c or c++ languages, so this is totally out of my scope, sorry.

I was just seen this from homebrew bump PR.

@nGoline nGoline self-assigned this Jun 19, 2026

@nGoline nGoline left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Removing -c makes this a proper compile+link probe. With -c (compile-only), -Wl,--gc-sections never reaches the linker. On macOS 14 (our CI), clang warns about the unused linker flag and -Werror causes the test to fail safely. But on macOS 15 (Homebrew CI), clang no longer emits that warning, so the test passes falsely, --gc-sections gets added to LDFLAGS, and the real build fails at link time.

@nGoline nGoline enabled auto-merge (rebase) June 19, 2026 11:53
@nGoline nGoline merged commit 01074ef into ElementsProject:master Jun 19, 2026
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants