-
-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
gcc (g++): ld: Assertion failed: (resultIndex < sectData.atoms.size())
(Xcode 15)
#145991
Comments
This is indeed an Xcode bug (FB13038083). Workaround is |
@Bo98 compiling with $ CXX='g++-13' make minimal
g++-13 minimal.cpp -o minimal
0 0x1019aef43 __assert_rtn + 64
1 0x1018b0f43 ld::AtomPlacement::findAtom(unsigned char, unsigned long long, ld::AtomPlacement::AtomLoc const*&, long long&) const + 1411
2 0x1018cd431 ld::InputFiles::SliceParser::parseObjectFile(mach_o::Header const*) const + 19745
3 0x1018ddb71 ld::InputFiles::parseAllFiles(void (ld::AtomFile const*) block_pointer)::$_7::operator()(unsigned long, ld::FileInfo const&) const + 657
4 0x7ff80075e066 _dispatch_client_callout2 + 8
5 0x7ff80077118f _dispatch_apply_invoke_and_wait + 213
6 0x7ff800770692 _dispatch_apply_with_attr_f + 1207
7 0x7ff800770847 dispatch_apply + 45
8 0x101976972 ld::AtomFileConsolidator::parseFiles(bool) + 370
9 0x1018fdd67 main + 12263
ld: Assertion failed: (resultIndex < sectData.atoms.size()), function findAtom, file Relocations.cpp, line 1336.
collect2: error: ld returned 1 exit status
make: *** [minimal] Error 1
$ CXX='g++-13' CXXFLAGS='-Wl,-ld_classic' make minimal
g++-13 -Wl,-ld_classic minimal.cpp -o minimal
$ ./minimal
0 |
It seems that simply $ CXX='g++-13' make minimal
g++-13 minimal.cpp -o minimal
$ ./minimal
0
$ g++-13 --version
g++-13 (Homebrew GCC 13.2.0) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ brew config
HOMEBREW_VERSION: 4.1.13-16-g39f76d6
ORIGIN: /~https://github.com/Homebrew/brew
HEAD: 39f76d635105aef18041f2eb1236945face1c6bf
Last commit: 9 hours ago
Core tap origin: /~https://github.com/Homebrew/homebrew-core
Core tap HEAD: 05f8a448ff23501ac834c6d9ce5802ecb23bf520
Core tap last commit: 21 hours ago
Core tap branch: master
Core tap JSON: 26 Sep 18:43 UTC
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_MAKE_JOBS: 4
HOMEBREW_SORBET_RUNTIME: set
Homebrew Ruby: 2.6.10 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: quad-core 64-bit kabylake
Clang: 15.0.0 build 1500
Git: 2.42.0 => /usr/local/bin/git
Curl: 8.1.2 => /usr/bin/curl
macOS: 13.6-x86_64
CLT: 15.0.0.0.1.1694021235
Xcode: N/A Would it be possible to rebuild the Note: in case you want to try it locally, it took me |
ld: Assertion failed: (resultIndex < sectData.atoms.size())
(Xcode 15)ld: Assertion failed: (resultIndex < sectData.atoms.size())
(Xcode 15)
Yeah, we already have a conditional where if Xcode 15 is detected then the build from source will use What we need to test however is whether that GCC built under Xcode 15 still works under Xcode 14. It might well do, but that needs to be confirmed. |
For the record, this appears to be fixed in the Xcode 15.1 beta |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Unstale |
It's definitely stale, and fixed in the next XCode release. Nothing to do for brew. |
Which release is it fixed in? The issue still persists in Command Line Tools for Xcode 15.1 beta 3. % CXX='gcc-13' make minimal
gcc-13 minimal.cpp -o minimal
ld: Undefined symbols:
__ZNSolsEPFRSoS_E, referenced from:
_main in cctbM3mR.o
__ZNSolsEm, referenced from:
_main in cctbM3mR.o
__ZNSt8ios_base4InitC1Ev, referenced from:
__Z41__static_initialization_and_destruction_0v in cctbM3mR.o
__ZNSt8ios_base4InitD1Ev, referenced from:
__Z41__static_initialization_and_destruction_0v in cctbM3mR.o
__ZSt4cout, referenced from:
_main in cctbM3mR.o
__ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_, referenced from:
_main in cctbM3mR.o
__ZdlPvm, referenced from:
__ZNSt15__new_allocatorIiE10deallocateEPim in cctbM3mR.o
___gxx_personality_v0, referenced from:
/private/var/folders/d2/9dxqbydd5796hb7j623rk97w0000gn/T/cctbM3mR.o
collect2: error: ld returned 1 exit status
make: *** [minimal] Error 1
% brew config
HOMEBREW_VERSION: 4.1.22-57-g1130070
ORIGIN: /~https://github.com/Homebrew/brew
HEAD: 11300707964d85f9011bc8f7b418dfe23e1a8862
Last commit: 48 minutes ago
Core tap origin: /~https://github.com/Homebrew/homebrew-core
Core tap HEAD: a85b622e488448c5ec12668f08a3a2d6e0170a86
Core tap last commit: 2 days ago
Core tap branch: bump-vulkan-headers-1.3.271
Core tap JSON: 01 Dec 14:00 UTC
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.m0f0vLisHl/org.xquartz:0
HOMEBREW_MAKE_JOBS: 4
HOMEBREW_SORBET_RUNTIME: set
Homebrew Ruby: 3.1.4 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/bin/ruby
CPU: quad-core 64-bit kabylake
Clang: 15.0.0 build 1500
Git: 2.43.0 => /usr/local/bin/git
Curl: 8.1.2 => /usr/bin/curl
macOS: 13.6.1-x86_64
CLT: 15.1.0.0.1.1699597245
Xcode: N/A |
That doesn't seem to be the same issue. Is that from the same example code as the original report? |
This issue is about the bug Your latest error message seems to be because libstdc++ is missing, probably because |
Yes, that was it.... can confirm now it is fixed in the beta release. Thx for catching it! |
Use `-Wl,-ld_classic` on macOS, to work around a bug in recent versions of XCode when trying to link object files created by GCC. This change has to be coordinated with the Kaleidoscope testing Makefiles, but is safe to apply first. References: Homebrew/homebrew-core#145991 https://developer.apple.com/forums/thread/737707 Signed-off-by: Taylor Yu <code@argon.blue>
brew gist-logs <formula>
link ORbrew config
ANDbrew doctor
outputVerification
brew doctor
output" saysYour system is ready to brew.
and am still able to reproduce my issue.brew update
and am still able to reproduce my issue.brew doctor
and that did not fix my problem.What were you trying to do (and why)?
Compile c++ program for https://open.kattis.com/problems/mancala.
What happened (include all command output)?
What did you expect to happen?
More info:
Afaik, this issue started after upgrading Xcode command line tools. I did some digging, and there's an Apple forum from 6 days ago:
https://developer.apple.com/forums/thread/737707
(also a Discussion https://discussions.apple.com/thread/255137447)
I am not sure if this is just a bug in Xcode, so I am opening this issue to track it.
See also:
Step-by-step reproduction instructions (by running
brew
commands)The text was updated successfully, but these errors were encountered: