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

cmake: command not found, but I've installed it. #79

Closed
0x-matt opened this issue Nov 7, 2022 · 6 comments
Closed

cmake: command not found, but I've installed it. #79

0x-matt opened this issue Nov 7, 2022 · 6 comments

Comments

@0x-matt
Copy link

0x-matt commented Nov 7, 2022

General Information

  • MEGA Version: 8.2

  • iOS Version(s): 15.5

  • macOS Monterey 12.5

  • Xcode : 13.4.1

  • Devices/Simulators: Simulators

  • Reproducible? (Yes/No): Yes

What happened?

Xcode throw an error 'cmake: command not found' of PhaseScriptExecution when compiling.

/Users/saint/Library/Developer/Xcode/DerivedData/iMEGA-bccgbbxukiqsjtfbnctkbkynqylr/Build/Intermediates.noindex/Karere.build/Debug-iphonesimulator/Karere.build/Script-A838B2231E96860900875D96.sh: line 3: cmake: command not found
Command PhaseScriptExecution failed with a nonzero exit code

But I've installed cmake command which can be confirmed by which cmake in iTerm.

$ which cmake
/opt/homebrew/bin/cmake

What did you expect to happen?

Xcode can compile successfully.

@0x-matt
Copy link
Author

0x-matt commented Nov 7, 2022

@jnavarrom can you help me please?

@jnavarrom
Copy link
Member

It seems you installed it using brew and the /opt/homebrew/bin/cmake is not in your PATH.

You can manually add the install directory (e.g. /opt/homebrew/bin/cmake) to the PATH

@0x-matt
Copy link
Author

0x-matt commented Nov 7, 2022

Appreciate your reply. I did install cmake using brew. And I manually add the /opt/homebrew/bin/cmake to the PATH, which is like this in my ~/.zshrc file:

PATH="/opt/homebrew/bin/cmake:$PATH"
PATH="/opt/homebrew/bin:$PATH"
PATH="/opt/homebrew/sbin:$PATH"
PATH="$PATH:$HOME/bin"
PATH="$PATH:/usr/local/go/bin"
PATH="~/.cargo/bin:$PATH"

# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
PATH="$PATH:$HOME/.rvm/bin"
export PATH

Unfortunately, the same error still exists. Is that my .zshrc file config isn't correct? Or do I need to do something else, like add the path to .bashrc file?

@jnavarrom
Copy link
Member

If you open a terminal and run cmake, is it found?

I didn't install it using brew, I downloaded the precompiled binary from here: https://cmake.org/download/ and then followed install instructions from here: https://cmake.org/install/

which cmake                 
/usr/local/bin/cmake

Screenshot 2022-11-07 at 10 07 59

@jnavarrom
Copy link
Member

PATH="/opt/homebrew/bin/cmake:$PATH"

I feel you missed here two double quotes (")

PATH="/opt/homebrew/bin/cmake":"$PATH"

@0x-matt
Copy link
Author

0x-matt commented Nov 7, 2022

Appreciate your patience and reply again! It really helped me a lot. At last, I resolved and compiled it successfully by using the following key way:

$ sudo "/Applications/CMake.app/Contents/bin/cmake-gui" --install

Linked: '/usr/local/bin/cmake' -> '/Applications/CMake.app/Contents/bin/cmake'
Linked: '/usr/local/bin/ctest' -> '/Applications/CMake.app/Contents/bin/ctest'
Linked: '/usr/local/bin/cpack' -> '/Applications/CMake.app/Contents/bin/cpack'
Linked: '/usr/local/bin/cmake-gui' -> '/Applications/CMake.app/Contents/bin/cmake-gui'
Linked: '/usr/local/bin/ccmake' -> '/Applications/CMake.app/Contents/bin/ccmake'

which is inspired by your replied image. It is estimated that Xcode use /usr/local/bin/*** as its command path, so we must link these soft chains to installed third-party tools.

In addition, I guess
PATH="/opt/homebrew/bin/cmake:$PATH" vs. PATH="/opt/homebrew/bin/cmake":"$PATH" is the same thing, just written in two different ways.

@0x-matt 0x-matt closed this as completed Nov 7, 2022
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

No branches or pull requests

2 participants