wlav / cppyy

Other
400 stars 41 forks source link

M1 cmake interface not working on example repo #82

Closed LunarLanding closed 2 years ago

LunarLanding commented 2 years ago

Hi, I tried using the cmake integration on python 3.10, M1 MacOS 12.5.1, but I can't reproduce the example repo jclay/cppyy-knearestneighbors-example; I get a missing symbols error.

I understand this is not a configuration easy to support, but I would be thankful for some steps or resources to get started debugging it.

Steps to reproduce

System: M1, MacOS 12.5.1.

Clone cppyy-knearestneighbors-example.

Create a conda environment: mamba create -n cppyy cppyy python cmake ninja python-clang

Activate it: conda activate cppyy

Save/export with: mamba list > mamba_list.txt mamba env export -n cppyy > env.yml.txt

(instead of creating as above, exactly reproduce the one I had by running mamba create -n cppyy -f env.yml).

By trial and error I figured out that python-clang was required otherwise FindLibClang would fail in the cmake config step.

Dump environment variables: env > env.txt.

Home directory and conda base environment path replaced by $HOME and $CONDA_BASE_DIR, respectively.

Perform successfully the check in README.md:

$ ( python -c "from clang.cindex import Config; print(Config().lib)" )
<CDLL 'libclang.dylib', handle 20a59e2e0 at 0x1056a8700>

Attempt to build it: (rm -rdf build && mkdir build && cd build && cmake -G Ninja .. && cmake --build . ) > build_log.txt 2>&1

build_log.txt is attached. Excerpt:

[...]
Undefined symbols for architecture arm64:
  "CppyyLegacy::kAssertMsg", referenced from:
      CppyyLegacy::Detail::TCollectionProxyInfo::Iterators<std::__1::vector<Point, std::__1::allocator<Point> >, false>::next(void*, void const*) in knn_example.cpp.o
[...]

mamba_list.txt env.txt env.yml.txt build_log.txt