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

[Bug] Default installation has LLVM errors #17492

Closed
MehdiTantaoui-99 opened this issue Oct 27, 2024 · 12 comments
Closed

[Bug] Default installation has LLVM errors #17492

MehdiTantaoui-99 opened this issue Oct 27, 2024 · 12 comments
Assignees
Labels
needs-triage PRs or issues that need to be investigated by maintainers to find the right assignees to address it type: bug

Comments

@MehdiTantaoui-99
Copy link

MehdiTantaoui-99 commented Oct 27, 2024

I installed tvm like instructed here: https://tvm.apache.org/docs/install/from_source.html

Once I run the test :

python -c "import tvm; print(tvm.__file__)"

Expected behavior

/home/ubuntu/tvm/python/tvm/__init__.py

Actual behavior

[13:07:34] /home/ubuntu/tvm/src/target/llvm/llvm_instance.cc:226: Error: Using LLVM 19.1.2 with `-mcpu=apple-latest` is not valid in `-mtriple=arm64-apple-macos`, using default `-mcpu=generic`
[13:07:34] /home/ubuntu/tvm/src/target/llvm/llvm_instance.cc:226: Error: Using LLVM 19.1.2 with `-mcpu=apple-latest` is not valid in `-mtriple=arm64-apple-macos`, using default `-mcpu=generic`
[13:07:34] /home/ubuntu/tvm/src/target/llvm/llvm_instance.cc:226: Error: Using LLVM 19.1.2 with `-mcpu=apple-latest` is not valid in `-mtriple=arm64-apple-macos`, using default `-mcpu=generic`
/home/ubuntu/tvm/python/tvm/__init__.py

Environment

PRETTY_NAME="Ubuntu 22.04.5 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.5 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

Steps to reproduce

Follow step on : https://tvm.apache.org/docs/install/from_source.html

@MehdiTantaoui-99 MehdiTantaoui-99 added needs-triage PRs or issues that need to be investigated by maintainers to find the right assignees to address it type: bug labels Oct 27, 2024
@youngwayfarer
Copy link

I've met the same problem as well. Have you resolved it?

@MehdiTantaoui-99
Copy link
Author

I found a solution. You have to setup the LLVM config before compiling the library:

cd tvm/build/
vi config.cmake

Set set(USE_LLVM llvm-config) in the config.cmake file. Then run:

cmake ..
make -j$(nproc)

This solved the issue for me.

@youngwayfarer
Copy link

youngwayfarer commented Oct 29, 2024

I found a solution. You have to setup the LLVM config before compiling the library:

cd tvm/build/
vi config.cmake

Set set(USE_LLVM llvm-config) in the config.cmake file. Then run:

cmake ..
make -j$(nproc)

This solved the issue for me.

Thanks!!! I'll try.

@youngwayfarer
Copy link

I found a solution. You have to setup the LLVM config before compiling the library:

cd tvm/build/
vi config.cmake

Set set(USE_LLVM llvm-config) in the config.cmake file. Then run:

cmake ..
make -j$(nproc)

This solved the issue for me.

I'm sorry, but I have a few more questions. According to https://tvm.apache.org/docs/install/from_source.html, I need to execute the "echo "set(USE_LLVM "llvm-config --ignore-libllvm --link-static")" >> config.cmake" command,. Do you mean changing this command to "echo "set(USE_LLVM llvm-config)" >> config.cmake"? I have done this, but the problems above remain.

@TenOne506
Copy link

I found a solution. You have to setup the LLVM config before compiling the library:

cd tvm/build/
vi config.cmake

Set set(USE_LLVM llvm-config) in the config.cmake file. Then run:

cmake ..
make -j$(nproc)

This solved the issue for me.

I'm sorry, but I have a few more questions. According to https://tvm.apache.org/docs/install/from_source.html, I need to execute the "echo "set(USE_LLVM "llvm-config --ignore-libllvm --link-static")" >> config.cmake" command,. Do you mean changing this command to "echo "set(USE_LLVM llvm-config)" >> config.cmake"? I have done this, but the problems above remain.

HI,I try to use ninja to build it ,and meet the same question. I try to use the Set set(USE_LLVM llvm-config) and set(USE_LLVM "llvm-config") in the config.cmake file。the latter set(USE_LLVM "llvm-config") is success , maybe you can try it.do not use the echo command, i directly modify the config.cmake file。

@youngwayfarer
Copy link

I found a solution. You have to setup the LLVM config before compiling the library:

cd tvm/build/
vi config.cmake

Set set(USE_LLVM llvm-config) in the config.cmake file. Then run:

cmake ..
make -j$(nproc)

This solved the issue for me.

I'm sorry, but I have a few more questions. According to https://tvm.apache.org/docs/install/from_source.html, I need to execute the "echo "set(USE_LLVM "llvm-config --ignore-libllvm --link-static")" >> config.cmake" command,. Do you mean changing this command to "echo "set(USE_LLVM llvm-config)" >> config.cmake"? I have done this, but the problems above remain.

HI,I try to use ninja to build it ,and meet the same question. I try to use the Set set(USE_LLVM llvm-config) and set(USE_LLVM "llvm-config") in the config.cmake file。the latter set(USE_LLVM "llvm-config") is success , maybe you can try it.do not use the echo command, i directly modify the config.cmake file。

I still failed,(T⌓T)

@HonestDeng
Copy link

I met the same problem.

@cbalint13 cbalint13 assigned cbalint13 and unassigned cbalint13 Nov 30, 2024
@cbalint13
Copy link
Contributor

@MehdiTantaoui-99 ,
@HonestDeng ,

Could please help with results from these two outputs below ?
$ python -c "import tvm; print(tvm.version)"
$ python -c "import tvm; print(tvm.target.codegen.llvm_version_major())"

@HonestDeng
Copy link

@MehdiTantaoui-99 , @HonestDeng ,

Could please help with results from these two outputs below ? $ python -c "import tvm; print(tvm.version)" $ python -c "import tvm; print(tvm.target.codegen.llvm_version_major())"

$ python -c "import tvm; print(tvm.version)"
[15:12:38] /Users/orange/tvm/src/target/llvm/llvm_instance.cc:226: Error: Using LLVM 19.1.4 with -mcpu=apple-latest is not valid in -mtriple=arm64-apple-macos, using default -mcpu=generic
[15:12:38] /Users/orange/tvm/src/target/llvm/llvm_instance.cc:226: Error: Using LLVM 19.1.4 with -mcpu=apple-latest is not valid in -mtriple=arm64-apple-macos, using default -mcpu=generic
[15:12:38] /Users/orange/tvm/src/target/llvm/llvm_instance.cc:226: Error: Using LLVM 19.1.4 with -mcpu=apple-latest is not valid in -mtriple=arm64-apple-macos, using default -mcpu=generic
Traceback (most recent call last):
File "", line 1, in
AttributeError: module 'tvm' has no attribute 'version'

$ python -c "import tvm; print(tvm.target.codegen.llvm_version_major())"
[15:12:49] /Users/orange/tvm/src/target/llvm/llvm_instance.cc:226: Error: Using LLVM 19.1.4 with -mcpu=apple-latest is not valid in -mtriple=arm64-apple-macos, using default -mcpu=generic
[15:12:49] /Users/orange/tvm/src/target/llvm/llvm_instance.cc:226: Error: Using LLVM 19.1.4 with -mcpu=apple-latest is not valid in -mtriple=arm64-apple-macos, using default -mcpu=generic
[15:12:49] /Users/orange/tvm/src/target/llvm/llvm_instance.cc:226: Error: Using LLVM 19.1.4 with -mcpu=apple-latest is not valid in -mtriple=arm64-apple-macos, using default -mcpu=generic
19

$ python -c "import tvm; print('\n'.join(f'{k}: {v}' for k, v in tvm.support.libinfo().items()))"
[15:15:35] /Users/orange/tvm/src/target/llvm/llvm_instance.cc:226: Error: Using LLVM 19.1.4 with -mcpu=apple-latest is not valid in -mtriple=arm64-apple-macos, using default -mcpu=generic
[15:15:35] /Users/orange/tvm/src/target/llvm/llvm_instance.cc:226: Error: Using LLVM 19.1.4 with -mcpu=apple-latest is not valid in -mtriple=arm64-apple-macos, using default -mcpu=generic
[15:15:35] /Users/orange/tvm/src/target/llvm/llvm_instance.cc:226: Error: Using LLVM 19.1.4 with -mcpu=apple-latest is not valid in -mtriple=arm64-apple-macos, using default -mcpu=generic
... a lot of output
USE_METAL: OFF
GIT_COMMIT_HASH: 7ae7ea8
GIT_COMMIT_TIME: 2024-11-26 08:46:17 -0500
... a lot of output

@cbalint13
Copy link
Contributor

@HonestDeng ,

Thanks a lot for your input !
I addressed a fix in latest main, can you try it ?

@cbalint13
Copy link
Contributor

I close this as fixed, if issue persists please report it here.

@HonestDeng
Copy link

@HonestDeng ,

Thanks a lot for your input ! I addressed a fix in latest main, can you try it ?

I pulled the new code and rebuilt. It works for me. Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage PRs or issues that need to be investigated by maintainers to find the right assignees to address it type: bug
Projects
None yet
Development

No branches or pull requests

5 participants