Skip to content

Comments

internal/build:support relocatable lib#1163

Merged
xushiwei merged 1 commit intogoplus:mainfrom
luoliwoshang:internal/build/rpath
Aug 21, 2025
Merged

internal/build:support relocatable lib#1163
xushiwei merged 1 commit intogoplus:mainfrom
luoliwoshang:internal/build/rpath

Conversation

@luoliwoshang
Copy link
Member

@luoliwoshang luoliwoshang commented Jun 23, 2025

fixed #1135

reason

library with conan with generate install_name directly with @rpath and the go is not add rpath for these dylib.

llgo/d on  internal/build/rpath [$!?] via C v17.0.0-clang 
❯ otool -D /opt/homebrew/Cellar/cjson/1.7.18/lib/libcjson_utils.dylib
/opt/homebrew/Cellar/cjson/1.7.18/lib/libcjson_utils.dylib:
/opt/homebrew/opt/cjson/lib/libcjson_utils.1.dylib
(base) 
llgo/d on  internal/build/rpath [$!?] via C v17.0.0-clang 
❯ otool -D /Users/zhangzhiyang/.conan2/p/b/cjsond2bd82ff69524/p/lib/libcjson_utils.dylib 
/Users/zhangzhiyang/.conan2/p/b/cjsond2bd82ff69524/p/lib/libcjson_utils.dylib:
@rpath/libcjson_utils.1.dylib

resolution

Treat every link-time library search path, specified by the -L parameter, as a runtime search path as well.This is to ensure the final executable can locate libraries with a relocatable install_name (e.g., "@rpath/libfoo.dylib") at runtime.

current run normally

@codecov
Copy link

codecov bot commented Jun 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.01%. Comparing base (cbac24c) to head (1d76f51).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1163   +/-   ##
=======================================
  Coverage   88.01%   88.01%           
=======================================
  Files          34       34           
  Lines        8374     8374           
=======================================
  Hits         7370     7370           
  Misses        935      935           
  Partials       69       69           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@luoliwoshang luoliwoshang force-pushed the internal/build/rpath branch from 1d6462a to daa2fc7 Compare June 23, 2025 06:39
@luoliwoshang luoliwoshang marked this pull request as draft June 23, 2025 07:11
@luoliwoshang luoliwoshang force-pushed the internal/build/rpath branch 3 times, most recently from ccf191b to e3d2442 Compare June 23, 2025 08:24
@luoliwoshang luoliwoshang changed the title internal/build:support rpath lib internal/build:support relocatable lib Jun 23, 2025
@luoliwoshang luoliwoshang marked this pull request as ready for review June 23, 2025 08:36
@luoliwoshang luoliwoshang force-pushed the internal/build/rpath branch from e3d2442 to 92f95c5 Compare June 23, 2025 09:22
@luoliwoshang luoliwoshang force-pushed the internal/build/rpath branch from faeb706 to eb6ec4e Compare July 2, 2025 07:14
@luoliwoshang
Copy link
Member Author

@cpunion need review

@cpunion
Copy link
Collaborator

cpunion commented Aug 19, 2025

Add a cjson example in _demo/ to compare different results with the switch.

@cpunion
Copy link
Collaborator

cpunion commented Aug 19, 2025

Make all homebrew tests pass to trigger prebuilt binaries tests

@luoliwoshang
Copy link
Member Author

Add a cjson example in _demo/ to compare different results with the switch.

Current testing requires a real environment since llgo uses cjson dylib with @rpath install name, but storing dynamic libraries in the repo is clearly not ideal. We could directly use the precompiled libraries from llpkg/cjsonv1.0.0 release for testing https://github.com/goplus/llpkg/releases/tag/cjson%2Fv1.0.0 , which avoids installing conan in test environments and saves the time overhead of downloading dependencies through conan.

this release is prefix with @rpath which is current pr need support

cjson_darwin_arm64/lib
❯ otool -D ./libcjson.dylib
./libcjson.dylib:
@rpath/libcjson.1.dylib

@luoliwoshang
Copy link
Member Author

luoliwoshang commented Aug 19, 2025

Make all homebrew tests pass to trigger prebuilt binaries tests

I Just merge the main code,and squash my homebrew test'commit to pass commit style check, with the new check process llgo build fail https://github.com/Homebrew/homebrew-core/actions/runs/17058628559/job/48361297264?pr=227010 ,because the go1.25 is released.
And this pr actuall success at go1.24 Homebrew/homebrew-core#234046
the reason is go1.25 release ,check at this pr Homebrew/homebrew-core#234045

@cpunion
Copy link
Collaborator

cpunion commented Aug 19, 2025

I Just merge the main code,and squash my homebrew test'commit to pass commit style check, with the new check process llgo build fail https://github.com/Homebrew/homebrew-core/actions/runs/17058628559/job/48361297264?pr=227010 ,because the go1.25 is released. And this pr actuall success at go1.24 Homebrew/homebrew-core#234046 the reason is go1.25 release ,check at this pr Homebrew/homebrew-core#234045

Maybe lock go to go@1.24 in llgo.rb

@luoliwoshang
Copy link
Member Author

okay, i will upload a llgo.rb update

@luoliwoshang luoliwoshang force-pushed the internal/build/rpath branch 7 times, most recently from 001b979 to a3a375e Compare August 19, 2025 12:28
@luoliwoshang
Copy link
Member Author

luoliwoshang commented Aug 19, 2025

Maybe lock go to go@1.24 in llgo.rb

llgo at homebrew current locked at depend go1.24 Homebrew/homebrew-core#234050

Add a cjson example in _demo/ to compare different results with the switch.

And have test the cargs lib to compare different results with the switch. (cjson current is install at brew&apt),so choose other lib

@luoliwoshang
Copy link
Member Author

And the homebrew test after lock go1.24 ,with this pr update ,is pass correctly Homebrew/homebrew-core#227010

@xushiwei xushiwei merged commit b8d0a26 into goplus:main Aug 21, 2025
34 checks passed
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.

llgo v0.11.5: no LC_RPATH's found when using a third package

3 participants