Skip to content

Add Macports legacy software options to builder#26691

Open
programmingkidx wants to merge 6 commits intovlang:masterfrom
programmingkidx:legacy-builder
Open

Add Macports legacy software options to builder#26691
programmingkidx wants to merge 6 commits intovlang:masterfrom
programmingkidx:legacy-builder

Conversation

@programmingkidx
Copy link
Contributor

V on Mac OS 10.4 and older requires the MacPorts legacy software in order to build a program. If it is not included then error messages about missing functions like backtrace() are displayed. To fix this problem, this patch has the MacPorts legacy' include folder and library path sent to the C compiler.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a719f46a3f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +205 to +206
ccoptions.args << "-I./thirdparty/legacy/include/LegacySupport/"
ccoptions.args << "./thirdparty/legacy/lib/libMacportsLegacySupport.a"

Choose a reason for hiding this comment

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

P1 Badge Resolve legacy paths from compiler root

These new flags use ./thirdparty/legacy/..., which is resolved from the caller's current working directory rather than the V installation/repo root. setup_ccompiler_options runs for normal v builds from arbitrary project folders, so on Darwin <= 8 this will often point to missing files and fail with header/library not found errors. Please build these paths from @VEXEROOT/v.pref.vroot (and quote them) like other thirdparty references.

Useful? React with 👍 / 👎.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is always a good idea. Just in case, somehow, the current directory gets changed, such that ./thirdparty is no longer correct.

// Mac OS 10.4 and older requires Macports legacy software to build programs
if user_darwin_version <= 8 {
ccoptions.args << "-I./thirdparty/legacy/include/LegacySupport/"
ccoptions.args << "./thirdparty/legacy/lib/libMacportsLegacySupport.a"

Choose a reason for hiding this comment

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

P1 Badge Move legacy archive out of compile args

The archive is added to ccoptions.args, which are emitted before source inputs in only_compile_args; that makes the static .a appear too early in the final command. On toolchains with order-sensitive static linking, the linker can scan libMacportsLegacySupport.a before the generated object and still report unresolved references (the exact issue this patch is trying to fix). This archive should be appended via linker flags so it is passed in link position.

Useful? React with 👍 / 👎.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👎 It works just fine on Mac OS 10.4.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps, but wouldn't it be better to have the second line start with -L to ensure it is linked rather than included?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried this and used this code:
ccoptions.args << "-L ./thirdparty/legacy/lib/libMacportsLegacySupport.a"
The result was the ld command failed to find the the symbols _backtrace and _backtrace_symbols_fd when trying to build a program.

@JalonSolov
Copy link
Collaborator

Leaving this one up to you @medvednikov

@programmingkidx
Copy link
Contributor Author

@JalonSolov I implemented a change that I think you will find agreeable. What do you think?

programmingkidx and others added 2 commits March 12, 2026 12:28
Co-authored-by: JalonSolov <JalonSolov@gmail.com>
Since we are using @VEXEROOT directly we don't need the vexe_path variable.
@JalonSolov
Copy link
Collaborator

Close/re-open to run CI with latest V.

@JalonSolov JalonSolov closed this Mar 12, 2026
@JalonSolov JalonSolov reopened this Mar 12, 2026
@JalonSolov
Copy link
Collaborator

You need to run v fmt -w on the file.

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