Skip to content

[Apple M2 Pro: Sequoia 15.3.1] clang: error: unable to execute command: Segmentation fault: 11 #300

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
chip opened this issue Mar 19, 2025 · 10 comments

Comments

@chip
Copy link
Contributor

chip commented Mar 19, 2025

Hi, I'm running into a segfault on tebako 0.12.16 during make: *** [miniruby] Error 1 and couldn't find anything in the issues to help me. Happy to provide more details upon request. Thanks in advance!

Config

Xcode

λ xcodebuild -version           
Xcode 16.2
Build version 16C5032a

Clang

λ clang --version               
Apple clang version 16.0.0 (clang-1600.0.26.6)
Target: arm64-apple-darwin24.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Press prep

λ export LG_VADDR=39
λ export PATH="$(brew --prefix bison)/bin:$PATH"

Clean & Press

~/code/ruby
λ tebako clean && tebako press --root=/Users/chip/code/ruby/pathos_macos --entry-point=/Users/chip/code/ruby/pathos_macos/bin/pathos_macos -o ~/Desktop/pathos >> tebako.txt 2>&1

Tebako executable packager version 0.12.16
No prefix specified, using ~/.tebako
Cleaning tebako packaging environment

Output file

tebako.txt

@maxirmx
Copy link
Member

maxirmx commented Mar 19, 2025

Hi @chip
I saw similar or the same issue with XCode 14.3.1
If you can change clang version it may help.
I will try to reproduce it and/or reoder libraries that may also help

@chip
Copy link
Contributor Author

chip commented Mar 19, 2025

@maxirmx - Thank you for your prompt help. Sorry, but the error still persists on the following clang:

λ clang --version
Homebrew clang version 19.1.7
Target: arm64-apple-darwin24.3.0
Thread model: posix
InstalledDir: /opt/homebrew/Cellar/llvm/19.1.7_1/bin
Configuration file: /opt/homebrew/etc/clang/arm64-apple-darwin24.cfg

@maxirmx
Copy link
Member

maxirmx commented Mar 19, 2025

After the failure please query the size of /Users/chip/.tebako/o/p/fs.bin file
It is the image of the solution that Tebako is trying to place inside the executable file
If the executable gets too large apple linker crashes. I saw it when fs.bin grew close to 1Gb

@chip
Copy link
Contributor Author

chip commented Mar 19, 2025

λ du -sh ~/.tebako/o/p/fs.bin 
1.6G	/Users/chip/.tebako/o/p/fs.bin

Thank you, I'll look into ways to reduce the executable size.

@maxirmx
Copy link
Member

maxirmx commented Mar 19, 2025

You may split runtime amd application

https://github.com/tamatebako/tebako?tab=readme-ov-file#creating-separate-runtime-and-application-packages

press with -m both option and run with --tebako-run option
https://github.com/tamatebako/tebako?tab=readme-ov-file#running-tebako-application-using-a-tebako-runtime---tebako-run-option

I did not try it with big files but I guess it may work. May be not ...

@chip
Copy link
Contributor Author

chip commented Mar 19, 2025

Very interesting. I read about splitting that previously and wasn't sure how I could use it.

My app is intended for the AppStore, which has been a long and tedious road on it's own (still unresolved): https://developer.apple.com/forums//thread/774923?page=2

I don't want to bore you with the details, so I'll summarize. The structure of my app is as follows:

❮ tree PATHmanager.app             
PATHmanager.app
└── Contents
    ├── Frameworks
    │   └── libui.dylib
    ├── Info.plist
    ├── MacOS
    │   └── PATHmanager
    ├── PkgInfo
    ├── Resources
    │   └── AppIcon.icns
    └── _CodeSignature
        └── CodeResources

The tebako binary that I pressed is copied to PATHmanager.app/Contents/MacOS/PATHmanager, with any dynamic libraries placed under PATHmanager.app/Contents/Frameworks. In this case, libui.dylib, because I'm using Glimmer DSL for libui.

My guess is that I would place the tebako runtime under the Frameworks directory as well, codesign and create a .pkg file before submitting for review. I'll revisit this tomorrow after I've reworked my code to reduce the executable size.

In any event, I'm grateful for your assistance. It's been impressive, uncommon, and greatly appreciated.

Thank you!

@maxirmx
Copy link
Member

maxirmx commented Mar 20, 2025

@maxirmx
Copy link
Member

maxirmx commented Mar 20, 2025

@chip
You've been using Tebako for a few months and have helped us a lot—thank you!

I’d like to ask if you’d be willing to help us once again by writing a short post for the Tebako blog. We’d love to hear where Tebako can help you to resolve real-world Ruby deployment challenges .

Thank you for considering it!

cc @ronaldtse

@chip
Copy link
Contributor Author

chip commented Mar 20, 2025

@maxirmx - Yes, I'd be happy to do that. Once I get this app submitted, I'll have some time to formalize my notes into something more cohesive for others to benefit.

Quick question... I'm getting the following error after pressing the binary:

<internal:/__tebako_memfs__/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require': cannot load such file -- glimmer/launcher (LoadError)
	from <internal:/__tebako_memfs__/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
	from /__tebako_memfs__/lib/ruby/gems/3.3.0/gems/tebako-runtime-0.7.0/lib/tebako-runtime.rb:74:in `process_all'
	from /__tebako_memfs__/lib/ruby/gems/3.3.0/gems/tebako-runtime-0.7.0/lib/tebako-runtime.rb:113:in `require'
	from /__tebako_memfs__/local/bin/pathos_macos:5:in `<main>'

The command I'm using to press:

tebako clean && tebako press --root=/Users/chip/code/ruby/pathos_macos_without_git --entry-point=/Users/chip/code/ruby/pathos_macos_without_git/bin/pathos_macos -o ~/Desktop/pathos >> tebako.txt 2>&1

The reason I copied the app to a new directory, pathos_macos_without_git, was to make the executable smaller, since the .git directory under the original app was huge, causing the segfault.

Here's the new directory structure (gems are not shown here, but are installed under app/vendor):

λ tree -I vendor         
.
├── Gemfile
├── Gemfile.lock
├── LICENSE.txt
├── VERSION
├── app
│   ├── pathos_macos
│   │   ├── launch.rb
│   │   ├── model
│   │   │   └── greeting.rb
│   │   └── view
│   │       ├── menu_bar.rb
│   │       ├── pathos_macos.rb
│   │       └── toolbar.rb
│   └── pathos_macos.rb
└── bin
    └── pathos_macos

When I run the script located at the --entry-point, the app runs properly, but the resulting executable from pressing gives me that error. Do you have any suggestions?

@chip
Copy link
Contributor Author

chip commented Mar 21, 2025

Apologies for the noise. I found the --tebako-extract option in the README and am troubleshooting there. I'll be in touch once I have something submitted to the AppStore. Thank you for your help.

@chip chip closed this as completed Mar 21, 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