junrushao opened a new issue, #18305:
URL: https://github.com/apache/tvm/issues/18305

   When running FFI unittests under `/path-to-tvm/ffi/` via:
   
   ```bash
   pytest -svv tests/python/test_*
   ```
   
   I noticed that all `cpp.load_inline`-related tests failed on macOS.
   
   ## Error message
   
   ```
   tests/python/test_load_inline.py:31:
   _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
   python/tvm_ffi/cpp/load_inline.py:396: in load_inline
       _build_ninja(build_dir)
   _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
   
   build_dir = '/Users/jshao/.cache/tvm-ffi/hello_e822416553bed865'
   
       def _build_ninja(build_dir: str) -> None:
           """Build the module in the given build directory using ninja."""
           command = ["ninja", "-v"]
           num_workers = os.environ.get("MAX_JOBS", None)
           if num_workers is not None:
               command += ["-j", num_workers]
           status = subprocess.run(args=command, cwd=build_dir, 
capture_output=True)
           if status.returncode != 0:
               msg = ["ninja exited with status {}".format(status.returncode)]
               if status.stdout:
                   
msg.append("stdout:\n{}".format(status.stdout.decode("utf-8")))
               if status.stderr:
                   
msg.append("stderr:\n{}".format(status.stderr.decode("utf-8")))
   
   >           raise RuntimeError("\n".join(msg))
   E           RuntimeError: ninja exited with status 1
   E           stdout:
   E           [1/2] c++ -MMD -MF main.o.d -std=c++17 -fPIC -O2 
-I/Users/jshao/Projects/tvm-dev/ffi/python/tvm_ffi/../../include 
-I/Users/jshao/Projects/tvm-dev/ffi/python/tvm_ffi/../../3rdparty/dlpack/include
 -c /Users/jshao/.cache/tvm-ffi/hello_e822416553bed865/main.cpp -o main.o
   E           [2/2] c++ main.o -shared -o hello.so
   E           FAILED: [code=1] hello.so
   E           c++ main.o -shared -o hello.so
   E           Undefined symbols for architecture arm64:
   E             "_TVMFFIErrorSetRaised", referenced from:
   E                 ___tvm_ffi_add_one_cpu in main.o
   E                 ___tvm_ffi_add_one_cpu in main.o
   E             "_TVMFFIGetTypeInfo", referenced from:
   E                 tvm::ffi::TypeIndexToTypeKey(int) in main.o
   E             "_TVMFFITraceback", referenced from:
   E                 add_one_cpu(DLTensor*, DLTensor*) in main.o
   E                 add_one_cpu(DLTensor*, DLTensor*) in main.o
   E                 add_one_cpu(DLTensor*, DLTensor*) in main.o
   E                 add_one_cpu(DLTensor*, DLTensor*) in main.o
   E                 add_one_cpu(DLTensor*, DLTensor*) in main.o
   E                 ___tvm_ffi_add_one_cpu in main.o
   E                 ___tvm_ffi_add_one_cpu in main.o
   E                 ___tvm_ffi_add_one_cpu in main.o
   E                 ...
   E             "_TVMFFITypeGetOrAllocIndex", referenced from:
   E                 ___cxx_global_var_init in main.o
   E                 ___cxx_global_var_init.1 in main.o
   E                 ___cxx_global_var_init.2 in main.o
   E                 ___cxx_global_var_init.3 in main.o
   E           ld: symbol(s) not found for architecture arm64
   E           clang++: error: linker command failed with exit code 1 (use -v 
to see invocation)
   E           ninja: build stopped: subcommand failed.
   ```
   
   ## Environment
   
   - OS: macOS 15.6.1, arm64
   - C++ toolchain
   ```
   >>> c++ --version
   Apple clang version 17.0.0 (clang-1700.0.13.5)
   Target: arm64-apple-darwin24.6.0
   Thread model: posix
   InstalledDir: /Library/Developer/CommandLineTools/usr/bin
   ```
   - Python toolchain: venv via uv
   ```
   >>> python --version
   Python 3.13.1
   >>> uv pip list
   Package        Version Editable project location
   -------------- ------- ---------------------------------
   apache-tvm-ffi 0.1.0a8 /Users/jshao/Projects/tvm-dev/ffi
   iniconfig      2.1.0
   numpy          2.3.3
   packaging      25.0
   pluggy         1.6.0
   pygments       2.19.2
   pytest         8.4.2
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to