Skip to content

builtin: Simplify linking with libgc#26695

Open
programmingkidx wants to merge 3 commits intovlang:masterfrom
programmingkidx:libgc-linking
Open

builtin: Simplify linking with libgc#26695
programmingkidx wants to merge 3 commits intovlang:masterfrom
programmingkidx:libgc-linking

Conversation

@programmingkidx
Copy link
Copy Markdown
Contributor

Currently V fails to run on Mac OS 10.4 because a feature called rpath is sent to the linker. This feature is only available on Mac OS 10.5 and higher. To fix compatibility with versions of Mac OS X before 10.5, the linking has been simplified to statically link to libgc.a.

@programmingkidx
Copy link
Copy Markdown
Contributor Author

The one test that failed reports this:
FAIL [ 384/2698] C: 35474.1 ms, R: 0.000 ms vlib/orm/orm_option_array_test.v

compilation failed:
================== C compilation error (from gcc): ==============

cc: C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/15.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\RUNNER~1\AppData\Local\Temp\ccQ1OnTq.o:orm_option_array_test.exe.01KK252VBAVG7H7WCZJRD68K79.tmp.c:(.text+0x2da76): undefined reference to `sqlite3_finalize'

cc: collect2.exe: error: ld returned 1 exit status

I do not believe this is related to my changes. I think this is a bug with orm.

@JalonSolov
Copy link
Copy Markdown
Collaborator

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

@JalonSolov JalonSolov closed this Mar 10, 2026
@JalonSolov JalonSolov reopened this Mar 10, 2026
Hopefully the issues with the tests have been fixed.
@programmingkidx
Copy link
Copy Markdown
Contributor Author

Seeing these tests fail:

  • CI Windows MSVC / msvc-windows (pull_request)
  • Cross CI / cross-windows (pull_request)
  • Docker CI / docker-alpine-musl-gcc (pull_request)
  • Sanitized CI / sanitize-address-msvc (pull_request)
  • Tools CI / tools-windows (msvc) (pull_request)
  • V Apps and Modules / v-apps-compile (ubuntu-latest)

@JalonSolov Do you think this an issue with my pull request or a problem with the tests?

@JalonSolov
Copy link
Copy Markdown
Collaborator

It's a problem with the tests. Once those are sorted, I'll be re-running CI for a bunch of PRs.

@programmingkidx
Copy link
Copy Markdown
Contributor Author

Anything we can do to help?

@JalonSolov
Copy link
Copy Markdown
Collaborator

It's all on Alex, with his v2 changes.

@JalonSolov
Copy link
Copy Markdown
Collaborator

Close/re-open to force CI.

@JalonSolov JalonSolov closed this Mar 16, 2026
@JalonSolov JalonSolov reopened this Mar 16, 2026
@programmingkidx
Copy link
Copy Markdown
Contributor Author

@JalonSolov What would have to be done in order for this pull request to be merged?

@JalonSolov
Copy link
Copy Markdown
Collaborator

Bouncing for another CI check.

@JalonSolov JalonSolov closed this Mar 19, 2026
@JalonSolov JalonSolov reopened this Mar 19, 2026
@programmingkidx
Copy link
Copy Markdown
Contributor Author

Why was "VSL and VTL / vsl-compiles (ubuntu-24.04) (pull_request)" cancelled? The log does not provide a reason.

@JalonSolov
Copy link
Copy Markdown
Collaborator

May have taken too long. Will have to check.

@programmingkidx
Copy link
Copy Markdown
Contributor Author

I didn't see any errors in the log but I did see this warning:

Compiling /home/runner/.vmodules/vsl/examples/ml_logreg/main.v
Warning: /home/runner/.vmodules/vsl/examples/ml_logreg/main.v:4:8: warning: module 'plot (vsl.plot)' is imported but never used. Use `import plot (vsl.plot) as _`, to silence this warning, or just remove the unused import line
    2 | 
    3 | import vsl.ml
    4 | import vsl.plot
      |        ~~~~~~~~
    5 | 
    6 | struct TestCase {

@JalonSolov
Copy link
Copy Markdown
Collaborator

Yes, but if you look further, the same test is done on 3 other platforms, and those all succeed in about 5 minutes. The failing test was cancelled after 25 minutes, which means it was cancelled because it was taking too long.

That failure has nothing to do with your PR.

However, your PR looks as though it will affect all systems, since you removed the entire $if macos block.

@medvednikov what do you think of this change?

@medvednikov medvednikov force-pushed the master branch 2 times, most recently from cdf4550 to 4dc97d9 Compare March 22, 2026 10:27
@programmingkidx
Copy link
Copy Markdown
Contributor Author

@JalonSolov Could you run the CI tests again?

@JalonSolov JalonSolov closed this Apr 3, 2026
@JalonSolov JalonSolov reopened this Apr 3, 2026
@programmingkidx
Copy link
Copy Markdown
Contributor Author

programmingkidx commented Apr 3, 2026

April 3, 2026 note - 13 tests failed:

CI Linux / clang-linux (pull_request)Failing after 24m
CI Linux / gcc-linux (pull_request)Failing after 15m
CI Linux / tcc-linux (pull_request)Failing after 14m
CI macOS / clang-macos (macos-14) (pull_request)Failing after 28m
Database CI / mssql-driver-tests (pull_request)Failing after 1m
Database CI / mysql-driver-tests (pull_request)Failing after 1m
Docker CI / docker-alpine-musl-gcc (pull_request)Failing after 6m
Docker CI / docker-ubuntu-musl (pull_request)Failing after 21m
native backend CI / native-backend-ubuntu (pull_request)Failing after 46s
Sanitized CI / sanitize-address-clang (pull_request)Failing after 53m
Sanitized CI / sanitize-address-gcc (pull_request)Failing after 70m
Sanitized CI / sanitize-memory-clang (pull_request)Failing after 71m
wasm backend CI / wasm-backend (windows-2022) (pull_request)Failing after 31s

😕

@JalonSolov
Copy link
Copy Markdown
Collaborator

Alex knows. He'll probably get things fixed up soon, and we can try again.

@programmingkidx
Copy link
Copy Markdown
Contributor Author

I tried this patch on Debian Linux ARM64 using v 0.5.1 and the result was it worked. I was able to build a program on Linux and it successfully ran. So this means the patch works on both Debian Linux and Mac OS X.

Why I think this patch is a good idea

  • It fixes problems with linking on Mac OS 10.4.
  • Linking is simplified to static linking. This eliminates the need for the libgc library file.
  • Possibly better security since the threat of a compromised libgc being used is gone.
  • Makes the v program more self-contained.
  • V becomes easier to distribute when there are less files to track.
  • Library version mismatch problems are eliminated.
  • Reduces dynamic linker overhead.

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