Skip to content

pref: disable -macosx-version-min clang flag by default - #20297

Merged
spytheman merged 1 commit into
vlang:masterfrom
edam:pr-mac-ver-default
Dec 30, 2023
Merged

spytheman merged 1 commit into
vlang:masterfrom
edam:pr-mac-ver-default

Conversation

@edam

@edam edam commented Dec 28, 2023

Copy link
Copy Markdown
Member

Disable the -macosx-version-min clang flag which is poorly documented, but which seems to affect STL (and some other headers) and also which runtime is linked against.

This flag causes problems (on my Intel-based mac, at least), such as

  • use of C.environ causes segfault
  • os.Process._spawn() segfaults

This results in total breakage of some v commands, including v run and v test. E.g., v run segfaults as follows:

signal 11: segmentation fault
0   libsystem_platform.dylib            0x00007ff8009cf37d _sigtramp + 29
1   ???                                 0x0000000000000000 0x0 + 0
2   v                                   0x000000010bd3e5db os__Process__spawn + 155
3   v                                   0x000000010bd3e503 os__Process_wait + 35
4   v                                   0x000000010c072aa5 v__builder__Builder_run_compiled_executable_and_exit + 3701
5   v                                   0x000000010c07027c v__builder__compile + 124
6   v                                   0x000000010c07bd19 main__rebuild + 121
7   v                                   0x000000010c07af25 main__main + 2181
8   v                                   0x000000010c080830 main + 64
9   dyld                                0x00007ff8006193a6 start + 1942

This PR changes default behaviour of V compiler so that it does not pass a min macosx version to clang by default.

@spytheman

spytheman commented Dec 29, 2023 •

Copy link
Copy Markdown
Contributor

Please try v run examples/tetris with the modified compiler. I think the main reason for the flag, was to allow gg apps to run. If that is no longer needed, that would be great.

@edam

edam commented Dec 30, 2023

Copy link
Copy Markdown
Member Author

I tried running examples/tetris...

Run Result Output
With this PR Blank (white) window Screenshot 2023-12-30 at 10 11 23β€―am
Without this PR (stock V) Compiler error Screenshot 2023-12-30 at 10 30 50β€―am
With this PR and -macosx-version-min=10.7 Same compiler error Screenshot 2023-12-30 at 10 29 03β€―am

...baring in mind this is just on my mac, which is:

  • 2.4 GHz 8-Core Intel Core i9
  • AMD Radeon Pro 5500M 8 GB
  • Intel UHD Graphics 630 1536 MB
  • 64 GB 2667 MHz DDR4
  • Sonoma 14.1.2 (23B92)

The compiler error is interesting, though. Without this PR, doing a v run always segfaults when it tries to spawn the subprocess. But for tetris, it doesn't even get that far.

@edam

edam commented Dec 30, 2023

Copy link
Copy Markdown
Member Author

Actually, all gg examples seem to be broken for me. I can't run 2048, flappylearning-v, or anything in examples/gg. They are all blank (white, or black, it seems) windows.

So I can't run any of them in with any branch or command line arguments at the moment!

@spytheman

Copy link
Copy Markdown
Contributor

Well, at least with your changes, it compiled, which is better than a cgen error, due to the missing library πŸ€” .

@spytheman

Copy link
Copy Markdown
Contributor

On m1 with Sonoma 14.0, it still works with the changes, so it seems that it is a net positive:
image

@spytheman spytheman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Excellent find.

@spytheman
spytheman merged commit 053d2be into vlang:master Dec 30, 2023
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.

2 participants