Skip to content
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

tests: Test extern'd globals on MacOS with the Apple Archiver #11945

Merged
merged 2 commits into from
Sep 6, 2023

Conversation

xclaesse
Copy link
Member

@xclaesse xclaesse commented Jul 5, 2023

This is a regression test for:
#11165.

The test was initially merged as part of:
#10628, but had to be reverted.

A second attempt at fixing the root cause also had to be reverted: #10699.

A 3rd attempt got merged but missed this unit test: #11742.

@jpakkane
Copy link
Member

jpakkane commented Jul 5, 2023

 error: Could not read ffac597fdb6ce8236b5e2da77ab6fbae3d9d9cb7
fatal: revision walk setup failed
error: https://github.com/Homebrew/homebrew-cask did not send all necessary objects

error: Could not read 623226b77a148708197a10c0d1eab3f8d6ca005b
fatal: revision walk setup failed
error: https://github.com/Homebrew/homebrew-core did not send all necessary objects

@jpakkane
Copy link
Member

jpakkane commented Jul 5, 2023

After restart:

@(#)PROGRAM:ld  PROJECT:ld64-820.1
BUILD 20:07:01 Nov  7 2022
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
Library search paths:
	/usr/local/lib
	/Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/lib
Framework search paths:
	/Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/
Undefined symbols for architecture x86_64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@xclaesse
Copy link
Member Author

xclaesse commented Jul 5, 2023

I think the actual bug is a bit further:

[5/5] cc  -o prog prog.p/prog.c.o -L/usr/local/lib -I/usr/local/include -Wl,-dead_strip_dylibs -Wl,-headerpad_max_install_names -Wl,-undefined,error libmylib.a
FAILED: prog 
cc  -o prog prog.p/prog.c.o -L/usr/local/lib -I/usr/local/include -Wl,-dead_strip_dylibs -Wl,-headerpad_max_install_names -Wl,-undefined,error libmylib.a
Undefined symbols for architecture x86_64:
  "_l2", referenced from:
      _l1 in libmylib.a(libfile.c.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

So we did not fix that issue afterall...

CC @ailin-nemui

@ailin-nemui
Copy link
Contributor

thanks for testing!

@xclaesse xclaesse removed this from the 1.2.0 milestone Jul 5, 2023
@osalbahr
Copy link

osalbahr commented Jul 7, 2023

The test failures at Homebrew/homebrew-core#135874 (on macOS and Linux) might help with further debugging this error.

@xclaesse
Copy link
Member Author

xclaesse commented Sep 4, 2023

Added back the original fix from #10628. If I understand correctly that fix has always been needed but was broken because of other bugs that are now fixed. Let's see what CI thinkgs about it...

@xclaesse xclaesse added this to the 1.2.2 milestone Sep 4, 2023
dcbaker and others added 2 commits September 4, 2023 17:47
Apple's AR is old, and doesn't add externed symbols to the symbol table,
instead relying on the user calling ranlib with -c. We need to do that
for the user
This forces the use of the Apple archiver, since that archiver doesn't
add extern'd variables to the symbol table automatically, and instead
requires that ranlib be used. A native file is used to ensure that
Apple's ar is used even in the presence of llvm or gcc in the path with
their superior archivers.

Co-authored-by: Dylan Baker <[email protected]>
@xclaesse
Copy link
Member Author

xclaesse commented Sep 6, 2023

macos CI passed, let's merge then.

@xclaesse xclaesse merged commit 0e99c07 into mesonbuild:master Sep 6, 2023
@xclaesse xclaesse deleted the add-test branch September 6, 2023 14:01
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

Successfully merging this pull request may close these issues.

6 participants