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

Intel Mac build error caused by meta_parser #1

Closed
iaomw opened this issue Apr 4, 2022 · 25 comments
Closed

Intel Mac build error caused by meta_parser #1

iaomw opened this issue Apr 4, 2022 · 25 comments
Labels

Comments

@iaomw
Copy link
Contributor

iaomw commented Apr 4, 2022

I got build errors for both Xcode and CMake builds. The problem is triggered from meta_parser. However, it's still malfunction after adding permission with chmod +x meta_parser.

The meta_parser crashed because dyld: Library not loaded: @rpath/libclang.dylib

macOS Bigsur 11.6.5
Xcode 13.2.1
CMake 3.23

@iaomw iaomw changed the title Intel Mac build error caused by by meta_parser Intel Mac build error caused by meta_parser Apr 4, 2022
@iaomw
Copy link
Contributor Author

iaomw commented Apr 4, 2022

image

image

@Yestercafe
Copy link

Change the missing dylib path, this can help you:
https://stackoverflow.com/questions/17703510/dyld-library-not-loaded-reason-image-not-found

@BoomingTech-YuqiaoZhang
Copy link
Contributor

You can use the following commands to fix the build error on Linux temporarily. A merge request will be provided later.
chmod +x build_linux.sh
chmod +x "./engine/bin/Linux/meta_parse"
chrpath -r '$ORIGIN' "./engine/bin/Linux/meta_parser"
chmod +x "engine/3rdparty/VulkanSDK/bin/Linux/glslangValidator"

@younif
Copy link

younif commented Apr 4, 2022

just cp engine/bin/macOS/libclang.dylib to /usr/local/lib
it works for me

@BoomingTech-YuqiaoZhang
Copy link
Contributor

If you are hasty, you may use this repository instead

@BoomingTech-YuqiaoZhang
Copy link
Contributor

BoomingTech-YuqiaoZhang commented Apr 4, 2022

You can use the following commands to fix the build error on MacOS temporarily
chmod +x "./engine/bin/MacOS/meta_parse"
install_name_tool -rpath "/Users/hywei/Workspace/metaparser-master/Parser/../3rd_party/LLVM/lib/macOS" '@executable_path' './engine/bin/macOS/meta_parser'

@iaomw
Copy link
Contributor Author

iaomw commented Apr 4, 2022

You can use the following commands to fix the build error on MacOS temporarily chmod +x "./engine/bin/MacOS/meta_parse" export LD_LIBRARY_PATH=./engine/bin/macOS${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

Thanks, but it's the same result. I may try another solution using otool for libclang.dylib
But ultimately the project script should take care itself.

https://stackoverflow.com/questions/24045633/dyld-library-not-loaded-error

@deepkolos
Copy link

deepkolos commented Apr 4, 2022

is MacOS 12.2 needed? @BoomingTech-YuqiaoZhang
running meta_parser on MacOS 11.6 throw the error

image

@iaomw
Copy link
Contributor Author

iaomw commented Apr 4, 2022

just cp engine/bin/macOS/libclang.dylib to /usr/local/lib it works for me

Tested with cp command and manual copy, not working. What is your software version?

@BoomingTech-YuqiaoZhang
Copy link
Contributor

BoomingTech-YuqiaoZhang commented Apr 4, 2022

You can use the following commands to fix the build error on MacOS temporarily chmod +x "./engine/bin/MacOS/meta_parse" export LD_LIBRARY_PATH=./engine/bin/macOS${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

Thanks, but it's the same result. I may try another solution using otool for libclang.dylib But ultimately the project script should take care itself.

https://stackoverflow.com/questions/24045633/dyld-library-not-loaded-error

LB_LIBRARY_PATH may not work, you may use the following install_name_tool instead.
install_name_tool -rpath "/Users/hywei/Workspace/metaparser-master/Parser/../3rd_party/LLVM/lib/macOS" '@executable_path' './engine/bin/macOS/meta_parser'

@Kingfish404
Copy link

Kingfish404 commented Apr 4, 2022

macOS 12.3.1 Intel i5 working with fellowing shell command

chmod +x "./engine/bin/MacOS/meta_parser"
cmake -S engine -B build -G "Xcode"
cp engine/bin/macOS/libclang.dylib /usr/local/lib
cmake --build build --config "${CMAKE_ARG_BUILD_TYPE_CONFIG}"
rm /usr/local/lib/libclang.dylib

then

./bin/PilotEditor

running.

Pic demo with still some problem image

@begoss
Copy link

begoss commented Apr 4, 2022

libclang.dylib is on the same path as meta_parser, you can use command:

cd /.../Pilot/engine/bin/macOS
install_name_tool -add_rpath /.../Pilot/engine/bin/macOS ./meta_parser

This works for me.

@BoomingTech-YuqiaoZhang
Copy link
Contributor

BoomingTech-YuqiaoZhang commented Apr 4, 2022

libclang.dylib is on the same path as meta_parser, you can use command:

cd /.../Pilot/engine/bin/macOS
install_name_tool -add_rpath /.../Pilot/engine/bin/macOS ./meta_parser

This works for me.

The following command is much better:
install_name_tool -rpath "/Users/hywei/Workspace/metaparser-master/Parser/../3rd_party/LLVM/lib/macOS" '@executable_path' ./engine/bin/macOS/meta_parser'

@BoomingTech-YuqiaoZhang
Copy link
Contributor

is MacOS 12.2 needed? @BoomingTech-YuqiaoZhang running meta_parser on MacOS 11.6 throw the error

image

libc++.1.dylib is missing, I am fixing now

@BoomingTech-YuqiaoZhang
Copy link
Contributor

BoomingTech-YuqiaoZhang commented Apr 4, 2022

is MacOS 12.2 needed? @BoomingTech-YuqiaoZhang running meta_parser on MacOS 11.6 throw the error

image

using the following commands to fix the libclang.dylib:
install_name_tool -change '/usr/lib/libc++.1.dylib' '@rpath/libc++.1.dylib' './engine/bin/macOS/libclang.dylib'
install_name_tool -rpath '@loader_path/../lib' '@executable_path' './engine/bin/macOS/libclang.dylib'

Then, download the missed libc++.1.dylib from the LLVM official web page

@BoomingTech-YuqiaoZhang
Copy link
Contributor

is MacOS 12.2 needed? @BoomingTech-YuqiaoZhang running meta_parser on MacOS 11.6 throw the error

image

I am using the "objdump -p" to check the dependency of the libclang.dylib, and I find that the libz and libcursor are missing as well.

@hyv1001 hyv1001 added the build label Apr 4, 2022
@BoomingTech-YuqiaoZhang
Copy link
Contributor

is MacOS 12.2 needed? @BoomingTech-YuqiaoZhang running meta_parser on MacOS 11.6 throw the error

image

A merge request is provided. If you are hasty, you may use this repository

@BoomingTech-YuqiaoZhang
Copy link
Contributor

is MacOS 12.2 needed? @BoomingTech-YuqiaoZhang running meta_parser on MacOS 11.6 throw the error

image

If you are hasty, you may use this repository. Github Workflow shows "build macos" is passing.

@BoomingTech-YuqiaoZhang
Copy link
Contributor

If you are hasty, you may use this repository. Github Workflow shows "build macos" is passing.

If you are hasty, you may use this repository. Github Workflow shows "build macos" is passing.

@BoomingTech-YuqiaoZhang
Copy link
Contributor

A pull request is provided.

@forkercat
Copy link

For M1 developers, running these commands works for a temporary fix.

chmod +x .engine/bin/macOS/meta_parser
sudo cp engine/bin/macOS/libclang.dylib /usr/local/lib

@BoomingTech-YuqiaoZhang
Copy link
Contributor

BoomingTech-YuqiaoZhang commented Apr 5, 2022

For M1 developers, running these commands works for a temporary fix.

chmod +x .engine/bin/macOS/meta_parser
sudo cp engine/bin/macOS/libclang.dylib /usr/local/lib

A pull request has been provided. If you are hasty, you may use this repository first. The github workflow shows "build linux" is passing.

@BoomingTech-YuqiaoZhang
Copy link
Contributor

For M1 developers, running these commands works for a temporary fix.

chmod +x .engine/bin/macOS/meta_parser
sudo cp engine/bin/macOS/libclang.dylib /usr/local/lib

This is NOT recommended. The path "/usr/local/lib" may not exist if the user doesn't use homebrew or macport.
And the version of the libclang.dylib provided by us may be different from the libclang.dylib provided by homebrew or macport. Some other software may not work properly due to the confliction of the libs.

@BoomingTech-YuqiaoZhang
Copy link
Contributor

just cp engine/bin/macOS/libclang.dylib to /usr/local/lib it works for me

This is NOT recommended. The path "/usr/local/lib" may not exist if the user doesn't use homebrew or macport.
And the version of the libclang.dylib provided by us may be different from the libclang.dylib provided by homebrew or macport. Some other software may not work properly due to the confliction of the libs.

@hyv1001 hyv1001 added the platform: macOS macOS platform label Apr 6, 2022
@hyv1001
Copy link
Collaborator

hyv1001 commented Apr 7, 2022

This issue should have been fixed by #53, you can reopen or create a new ticket if it still exists on your machine

@hyv1001 hyv1001 closed this as completed Apr 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants