Skip to content

os: use _dyld_get_image_name() to increase compatibility with older versions of Mac OS X#26617

Merged
spytheman merged 8 commits into
vlang:masterfrom
programmingkidx:os.executable
Feb 17, 2026
Merged

os: use _dyld_get_image_name() to increase compatibility with older versions of Mac OS X#26617
spytheman merged 8 commits into
vlang:masterfrom
programmingkidx:os.executable

Conversation

@programmingkidx

Copy link
Copy Markdown
Contributor

The libproc.h header is not available on Mac OS 10.4 and older. It prevents V from being built on these operating systems. The solution is to replace the functions from libproc.h with the function _dyld_get_image_name() to get the path of the program.

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

Copy link
Copy Markdown

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: 1737c86493

ℹ️ 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 thread vlib/os/os.c.v Outdated
@programmingkidx

Copy link
Copy Markdown
Contributor Author

I am currently seeing this error:

2026-02-16T22:48:24.190085Z [INFO ] cmd: v -cg -cstrict -o vstrict1 cmd/v
builder error: 
Error: /tmp/v_501/vstrict1.01KHMA7ZW22YXPAT0297Q21JMH.tmp.c:27543:9: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
==================
C error found. It should never happen, when compiling pure V code.
This is a V compiler bug, please report it using `v bug file.v`,
or goto https://github.com/vlang/v/issues/new/choose .
You can also use #help on Discord: https://discord.gg/vlang .
                char* const_path = _dyld_get_image_name(current_application);
                      ^            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

According to https://docs.vlang.io/v-and-c.html it mentions how to handle this issue:

"Note also the second parameter const char *format, which was redeclared as const_format &char . The const_ prefix in that redeclaration may seem arbitrary, but it is important, if you want to compile your code with -cstrict or thirdparty C static analysis tools. V currently does not have another way to express that this parameter is a const (this will probably change in V 1.0)."

I am pretty sure I followed the rules. Does anyone have a suggestion on how to fix this issue?

@programmingkidx

Copy link
Copy Markdown
Contributor Author

Thank you for the help spytheman. Is it ok to change 'charptr' back to '&char'? I only made the change to see if I could fix the problem I was having. The change did not work.

@spytheman spytheman merged commit e475110 into vlang:master Feb 17, 2026
85 checks passed
cestef pushed a commit to cestef/v that referenced this pull request Mar 9, 2026
cestef pushed a commit to cestef/v that referenced this pull request Mar 9, 2026
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