Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[buildsystems] applocal.py incorrectly modifies the dynamic library name #40661

Closed
Hackerl opened this issue Aug 27, 2024 · 6 comments · Fixed by #39889
Closed

[buildsystems] applocal.py incorrectly modifies the dynamic library name #40661

Hackerl opened this issue Aug 27, 2024 · 6 comments · Fixed by #39889
Assignees
Labels
category:tool-update The issue is with build tool or build script, which requires update or should be executed correctly

Comments

@Hackerl
Copy link

Hackerl commented Aug 27, 2024

Describe the bug
After installing dependencies with arm64-osx-dynamic triplet, the dynamic library name in the app bundle was incorrectly changed.

image

The first line displayed by otool -L should be the name of the dynamic library.

Environment

  • OS: macos
  • Compiler: clang

To Reproduce

  1. Install libcurl using manifest mode with the arm64-osx-dynamic triplet and define the product as an app bundle:

add_executable(demo MACOSX_BUNDLE main.cpp)

  1. After the build is complete and the app bundle is generated, vcpkg calls applocal.py to put the dependencies into the bundle.

I debugged applocal.py and printed relevant information.
I am confused about this line of code

popen_args = ['install_name_tool', '-id', dep_rpath, binary]

The script executes the following command:

['install_name_tool', '-id', '@executable_path/../Frameworks/libz.1.3.1.dylib', '/Users/runner/terminal/build/terminal.app/Contents/Frameworks/libcurl-d.4.8.0.dylib']

According to the documentation of install_name_tool:

-id name
Changes the shared library identification name of a dynamic shared library to name. If the Mach-O binary is not a dynamic shared library and the -id option is
specified it is ignored.

Because the name was changed incorrectly, fixup_bundle did not work properly because it needs to do some logic based on the name.

I can't guess the purpose of executing "install_name_tool -id", it seems that there is no need to do this.

@WangWeiLin-MV WangWeiLin-MV added the category:tool-update The issue is with build tool or build script, which requires update or should be executed correctly label Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:tool-update The issue is with build tool or build script, which requires update or should be executed correctly
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants
@Hackerl @WangWeiLin-MV and others