M1 cmake interface example repo not working
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
[...]
That symbol is lives in libCoreLegacy.so, which should certainly not be linked with, so I'm not understanding that step.
Could you give the PyPI M1 builds a try instead (python -m pip install cppyy), just to be able to figure out whether the issue is with the conda builds or the example?
Thanks, did just that, yet I keep gettting the same error. I have updated this post with a more verbose build log, including the compilation commands and linker invocations. I'm not familiar with C++ and compilation, so I'm likely missing something basic.
Meta
Share long lines in a better way.
Environment
OSX 12.5.1 Xcode installed.
mamba create -n cppyy python python-clang libclang compilers cmake ninja
$ mamba list
# packages in environment at $CONDA_DIR:
#
# Name Version Build Channel
boost-cpp 1.74.0 h1cb353e_8 conda-forge
bzip2 1.0.8 h3422bc3_4 conda-forge
c-ares 1.18.1 h3422bc3_0 conda-forge
c-compiler 1.5.0 h5008568_0 conda-forge
ca-certificates 2022.6.15 h4653dfc_0 conda-forge
cctools 973.0.1 hcbb26d4_10 conda-forge
cctools_osx-arm64 973.0.1 he930820_10 conda-forge
cgal-cpp 5.5 h97fd3db_0 conda-forge
clang 14.0.4 hce30654_0 conda-forge
clang-14 14.0.4 default_h81a5282_0 conda-forge
clang_osx-arm64 14.0.4 hc634a12_2 conda-forge
clangxx 14.0.4 default_hb7ecf47_0 conda-forge
clangxx_osx-arm64 14.0.4 hb7a33d8_2 conda-forge
cmake 3.24.1 h967666c_0 conda-forge
compiler-rt 14.0.4 h4418234_0 conda-forge
compiler-rt_osx-arm64 14.0.4 hb07f8d1_0 conda-forge
compilers 1.5.0 hce30654_0 conda-forge
cppyy 2.4.0 pypi_0 pypi
cppyy-backend 1.14.9 pypi_0 pypi
cppyy-cling 6.27.0 pypi_0 pypi
cpycppyy 1.12.11 pypi_0 pypi
cxx-compiler 1.5.0 hffc8910_0 conda-forge
eigen 3.4.0 hc021e02_0 conda-forge
expat 2.4.8 h6b3803e_0 conda-forge
fortran-compiler 1.5.0 h2ccabda_0 conda-forge
gfortran 11.3.0 h1ca8e4b_0 conda-forge
gfortran_impl_osx-arm64 11.3.0 h95416cd_25 conda-forge
gfortran_osx-arm64 11.3.0 h57527a5_0 conda-forge
gmp 6.2.1 h9f76cd9_0 conda-forge
icu 70.1 h6b3803e_0 conda-forge
isl 0.22.1 hb904e53_2 conda-forge
krb5 1.19.3 he492e65_0 conda-forge
ld64 609 h619f069_10 conda-forge
ld64_osx-arm64 609 h132958c_10 conda-forge
libclang 14.0.4 default_h81a5282_0 conda-forge
libclang-cpp14 14.0.4 default_h81a5282_0 conda-forge
libclang13 14.0.4 default_he70ec0d_0 conda-forge
libcurl 7.83.1 h7965298_0 conda-forge
libcxx 14.0.6 h04bba0f_0 conda-forge
libedit 3.1.20191231 hc8eb9b7_2 conda-forge
libev 4.33 h642e427_1 conda-forge
libffi 3.4.2 h3422bc3_5 conda-forge
libgfortran 5.0.0 11_3_0_hd922786_25 conda-forge
libgfortran-devel_osx-arm64 11.3.0 hfe9555d_25 conda-forge
libgfortran5 11.3.0 hdaf2cc0_25 conda-forge
libiconv 1.16 h642e427_0 conda-forge
libllvm14 14.0.4 h37c5ba8_0 conda-forge
libnghttp2 1.47.0 h519802c_1 conda-forge
libsqlite 3.39.2 h2c9beb0_1 conda-forge
libssh2 1.10.0 h7a5bd25_3 conda-forge
libuv 1.44.2 he4db4b2_0 conda-forge
libzlib 1.2.12 ha287fd2_2 conda-forge
llvm-openmp 14.0.4 hd125106_0 conda-forge
llvm-tools 14.0.4 h37c5ba8_0 conda-forge
mpc 1.2.1 h309154c_0 conda-forge
mpfr 4.1.0 h6d7a090_1 conda-forge
ncurses 6.3 h07bb92c_1 conda-forge
ninja 1.11.0 hf86a087_0 conda-forge
openssl 3.0.5 h7aea29f_1 conda-forge
pip 22.2.2 pyhd8ed1ab_0 conda-forge
python 3.10.6 hae75cb6_0_cpython conda-forge
python-clang 14.0.4 default_hccd1708_0 conda-forge
python_abi 3.10 2_cp310 conda-forge
readline 8.1.2 h46ed386_0 conda-forge
rhash 1.4.3 he4db4b2_0 conda-forge
setuptools 65.3.0 py310hbe9552e_0 conda-forge
sigtool 0.1.3 h44b9a77_0 conda-forge
tapi 1100.0.11 he4954df_0 conda-forge
tk 8.6.12 he1e0b03_0 conda-forge
tzdata 2022c h191b570_0 conda-forge
wheel 0.37.1 pyhd8ed1ab_0 conda-forge
xz 5.2.6 h57fd34a_0 conda-forge
zlib 1.2.12 ha287fd2_2 conda-forge
zstd 1.5.2 h8128057_4 conda-forge
Some software versions
cppyy components
Each of these cppyy components merits some entry. For now we just have this listing:
$ mamba list | grep pypi
cppyy 2.4.0 pypi_0 pypi
cppyy-backend 1.14.9 pypi_0 pypi
cppyy-cling 6.27.0 pypi_0 pypi
cpycppyy 1.12.11 pypi_0 pypi
Compiler
$ which $CXX
$CONDA_DIR/bin/arm64-apple-darwin20.0.0-clang++
$ ls -lha $(which $CXX)
lrwxr-xr-x 1 ma staff 8 Aug 26 05:05 $CONDA_DIR/bin/arm64-apple-darwin20.0.0-clang++ -> clang-14
$ clang-14 --version
clang version 14.0.4
Target: arm64-apple-darwin21.6.0
Thread model: posix
InstalledDir: $CONDA_DIR/bin
$CXX points to arm64-apple-darwin20.0.0-clang++ which points to clang-14, and clang14 --version shows arm64-apple-darwin21.6.0.
Is this a problem?
According to Wikipedia, darwin21.6 corresponds to macOS 12.5.
Assuming for now that darwin21.6 is compatible with darwin20.0.
Build command
( \
rm -rdf build && \
mkdir build && \
cd build && \
( cmake -DCMAKE_VERBOSE_MAKEFILE=ON --trace-source=CMakeLists.txt -G Ninja .. && cmake --build . ) > log.txt 2>&1 \
)
It's easier to read by postprocessing to replace project directory by $PROJECT_DIR, conda prefix by $CONDA_PREFIX, home folder by $HOME.
Just the log:
(PROJECT_DIR=$(pwd) ; SDK_ROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"; sed -i '' "s@${CONDA_PREFIX}@\$CONDA_PREFIX@g; s@${PROJECT_DIR}@\$PROJECT_DIR@g; s@${HOME}@\$HOME@g; s@${SDK_ROOT}@\$SDK_ROOT@g" build/log.txt)
All files:
(PROJECT_DIR=$(pwd) ; cd build && LC_ALL=C find . -type f -exec sed -i '' "s@${CONDA_PREFIX}@\$CONDA_PREFIX@g; s@${PROJECT_DIR}@\$PROJECT_DIR@g; s@${HOME}@\$HOME@g" {} \; )
Current cmake script
Original script + policies + -v flag for the compiler.
cmake version 3.24.1.
# these three policies were set
set(CMAKE_POLICY_DEFAULT_CMP0102 NEW)
set(CMAKE_POLICY_DEFAULT_CMP0128 NEW)
set(CMAKE_POLICY_DEFAULT_CMP0126 NEW)
cmake_minimum_required(VERSION 3.10)
# this flag enables verbose output from the compiler
set(CMAKE_CXX_FLAGS "-v")
project(cppyy_example LANGUAGES CXX)
execute_process(COMMAND cling-config --cmake OUTPUT_VARIABLE CPPYY_MODULE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
# Make sure this is set to something like:
# ~/.local/lib/python2.7/site-packages/cpyy_backend/cmake
message("CPYY_MODULE_PATH: " ${CPPYY_MODULE_PATH})
list(INSERT CMAKE_MODULE_PATH 0 ${CPPYY_MODULE_PATH})
find_package(Cppyy)
set(SOURCES nearest_neighbors.cpp)
set(HEADERS nearest_neighbors.h)
# It seems like this library has to be shared...
add_library(knn_lib SHARED ${SOURCES})
# Note this is a necessary compile flag for cppyy bindings to work.
set_target_properties(knn_lib PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_include_directories(knn_lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
cppyy_add_bindings(
"knn_example" "0.0.1" "Joel" "[email protected]"
LANGUAGE_STANDARD "14"
GENERATE_OPTIONS "-D__PIC__;-Wno-macro-redefined"
INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}
LINK_LIBRARIES knn_lib
H_DIRS ${CMAKE_CURRENT_SOURCE_DIR}
H_FILES ${HEADERS})
add_executable(knn main.cpp)
target_link_libraries(knn PUBLIC knn_lib)
Going through the compilation log
How to generate:
( \
( \
export VERBOSE=1 ; \
rm -rdf build && \
mkdir build && \
cd build && \
( cmake -DCMAKE_VERBOSE_MAKEFILE=ON --trace-source=CMakeLists.txt -G Ninja .. && cmake --build . ) > log.txt 2>&1 \
)
( \
PROJECT_DIR=$(pwd) ; \
SDK_ROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"; \
sed -i '' "s@${CONDA_PREFIX}@\$CONDA_PREFIX@g; s@${PROJECT_DIR}@\$PROJECT_DIR@g; s@${HOME}@\$HOME@g; s@${SDK_ROOT}@\$SDK_ROOT@g" build/log.txt \
) \
)
Below, the resulting build/log.txt is included.
It consists of the following sections:
- cmake configuration
- 1/9 Compile
main.cpp - 2/9 Compile nearest_neighbors.cpp
- 3/9 ? nearest_neighbors.cpp.o
- 4/9 ? libknn_lib.dylib
- 5/9 cppyy-generator nearest_neighbors.h
- 6/9 rootcling ?
- 7/9 Compile knn_example.cpp
- 8/9 ? libknn_lib.dylib
The last step fails.
Re-run cmake no build system arguments
$PROJECT_DIR/CMakeLists.txt(1): set(CMAKE_POLICY_DEFAULT_CMP0102 NEW )
$PROJECT_DIR/CMakeLists.txt(2): set(CMAKE_POLICY_DEFAULT_CMP0128 NEW )
$PROJECT_DIR/CMakeLists.txt(3): set(CMAKE_POLICY_DEFAULT_CMP0126 NEW )
$PROJECT_DIR/CMakeLists.txt(4): cmake_minimum_required(VERSION 3.10 )
$PROJECT_DIR/CMakeLists.txt(11): set(CMAKE_CXX_FLAGS -v )
$PROJECT_DIR/CMakeLists.txt(14): project(cppyy_example LANGUAGES CXX )
-- The CXX compiler identification is Clang 14.0.4
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: $CONDA_PREFIX/bin/arm64-apple-darwin20.0.0-clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
$PROJECT_DIR/CMakeLists.txt(17): execute_process(COMMAND cling-config --cmake OUTPUT_VARIABLE CPPYY_MODULE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE )
$PROJECT_DIR/CMakeLists.txt(24): message(CPYY_MODULE_PATH: ${CPPYY_MODULE_PATH} )
CPYY_MODULE_PATH: $CONDA_PREFIX/lib/python3.10/site-packages/cppyy_backend/cmake
$PROJECT_DIR/CMakeLists.txt(25): list(INSERT CMAKE_MODULE_PATH 0 ${CPPYY_MODULE_PATH} )
$PROJECT_DIR/CMakeLists.txt(27): find_package(Cppyy )
-- Found Cppyy: $CONDA_PREFIX/bin/rootcling (found version "6.20.04")
$PROJECT_DIR/CMakeLists.txt(29): set(SOURCES nearest_neighbors.cpp )
$PROJECT_DIR/CMakeLists.txt(30): set(HEADERS nearest_neighbors.h )
$PROJECT_DIR/CMakeLists.txt(33): add_library(knn_lib SHARED ${SOURCES} )
$PROJECT_DIR/CMakeLists.txt(35): set_target_properties(knn_lib PROPERTIES POSITION_INDEPENDENT_CODE ON )
$PROJECT_DIR/CMakeLists.txt(36): target_include_directories(knn_lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} )
$PROJECT_DIR/CMakeLists.txt(38): cppyy_add_bindings(knn_example 0.0.1 Joel [email protected] LANGUAGE_STANDARD 14 GENERATE_OPTIONS -D__PIC__;-Wno-macro-redefined INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} LINK_LIBRARIES knn_lib H_DIRS ${CMAKE_CURRENT_SOURCE_DIR} H_FILES ${HEADERS} )
-- Found LibClang: $CONDA_PREFIX/lib/libclang.dylib (found version "$CONDA_PREFIX/lib/libclang.dylib")
-- $CONDA_PREFIX/lib/python3.10/site-packages/cppyy_backend/pkg_templates/initializor.py
$PROJECT_DIR/CMakeLists.txt(48): add_executable(knn main.cpp )
$PROJECT_DIR/CMakeLists.txt(49): target_link_libraries(knn PUBLIC knn_lib )
-- Configuring done
-- Generating done
-- Build files have been written to: $PROJECT_DIR/build
[0/2] $CONDA_PREFIX/bin/cmake -P $PROJECT_DIR/build/CMakeFiles/VerifyGlobs.cmake
[1/9] $CONDA_PREFIX/bin/arm64-apple-darwin20.0.0-clang++ -Dknn_lib_EXPORTS -I$PROJECT_DIR -v -arch arm64 -isysroot $SDK_ROOT -fPIC -MD -MT CMakeFiles/knn_lib.dir/nearest_neighbors.cpp.o -MF CMakeFiles/knn_lib.dir/nearest_neighbors.cpp.o.d -o CMakeFiles/knn_lib.dir/nearest_neighbors.cpp.o -c $PROJECT_DIR/nearest_neighbors.cpp
clang version 14.0.4
Target: arm64-apple-darwin20.0.0
Thread model: posix
InstalledDir: $CONDA_PREFIX/bin
(in-process)
"$CONDA_PREFIX/bin/clang-14" -cc1 -triple arm64-apple-macosx12.0.0 -Wundef-prefix=TARGET_OS_ -Werror=undef-prefix -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name nearest_neighbors.cpp -mrelocation-model pic -pic-level 2 -mframe-pointer=non-leaf -ffp-contract=on -fno-rounding-math -funwind-tables=2 -target-sdk-version=12.3 -fcompatibility-qualified-id-block-type-checking -fvisibility-inlines-hidden-static-local-var -target-cpu apple-m1 -target-feature +v8.5a -target-feature +fp-armv8 -target-feature +neon -target-feature +crc -target-feature +crypto -target-feature +dotprod -target-feature +fp16fml -target-feature +ras -target-feature +lse -target-feature +rdm -target-feature +rcpc -target-feature +zcm -target-feature +zcz -target-feature +fullfp16 -target-feature +sha2 -target-feature +aes -target-abi darwinpcs -fallow-half-arguments-and-returns -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=lldb -target-linker-version 609 -v -fcoverage-compilation-dir=$PROJECT_DIR/build -resource-dir $CONDA_PREFIX/lib/clang/14.0.4 -dependency-file CMakeFiles/knn_lib.dir/nearest_neighbors.cpp.o.d -MT CMakeFiles/knn_lib.dir/nearest_neighbors.cpp.o -sys-header-deps -isysroot $SDK_ROOT -D knn_lib_EXPORTS -I $PROJECT_DIR -stdlib=libc++ -internal-isystem $CONDA_PREFIX/bin/../include/c++/v1 -internal-isystem $SDK_ROOT/usr/local/include -internal-isystem $CONDA_PREFIX/lib/clang/14.0.4/include -internal-externc-isystem $SDK_ROOT/usr/include -fdeprecated-macro -fdebug-compilation-dir=$PROJECT_DIR/build -ferror-limit 19 -stack-protector 1 -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fmax-type-align=16 -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o CMakeFiles/knn_lib.dir/nearest_neighbors.cpp.o -x c++ $PROJECT_DIR/nearest_neighbors.cpp
clang -cc1 version 14.0.4 based upon LLVM 14.0.4 default target arm64-apple-darwin21.6.0
ignoring nonexistent directory "$SDK_ROOT/usr/local/include"
ignoring nonexistent directory "$SDK_ROOT/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
$PROJECT_DIR
$CONDA_PREFIX/bin/../include/c++/v1
$CONDA_PREFIX/lib/clang/14.0.4/include
$SDK_ROOT/usr/include
$SDK_ROOT/System/Library/Frameworks (framework directory)
End of search list.
[2/9] $CONDA_PREFIX/bin/arm64-apple-darwin20.0.0-clang++ -I$PROJECT_DIR -v -arch arm64 -isysroot $SDK_ROOT -MD -MT CMakeFiles/knn.dir/main.cpp.o -MF CMakeFiles/knn.dir/main.cpp.o.d -o CMakeFiles/knn.dir/main.cpp.o -c $PROJECT_DIR/main.cpp
clang version 14.0.4
Target: arm64-apple-darwin20.0.0
Thread model: posix
InstalledDir: $CONDA_PREFIX/bin
(in-process)
"$CONDA_PREFIX/bin/clang-14" -cc1 -triple arm64-apple-macosx12.0.0 -Wundef-prefix=TARGET_OS_ -Werror=undef-prefix -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name main.cpp -mrelocation-model pic -pic-level 2 -mframe-pointer=non-leaf -ffp-contract=on -fno-rounding-math -funwind-tables=2 -target-sdk-version=12.3 -fcompatibility-qualified-id-block-type-checking -fvisibility-inlines-hidden-static-local-var -target-cpu apple-m1 -target-feature +v8.5a -target-feature +fp-armv8 -target-feature +neon -target-feature +crc -target-feature +crypto -target-feature +dotprod -target-feature +fp16fml -target-feature +ras -target-feature +lse -target-feature +rdm -target-feature +rcpc -target-feature +zcm -target-feature +zcz -target-feature +fullfp16 -target-feature +sha2 -target-feature +aes -target-abi darwinpcs -fallow-half-arguments-and-returns -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=lldb -target-linker-version 609 -v -fcoverage-compilation-dir=$PROJECT_DIR/build -resource-dir $CONDA_PREFIX/lib/clang/14.0.4 -dependency-file CMakeFiles/knn.dir/main.cpp.o.d -MT CMakeFiles/knn.dir/main.cpp.o -sys-header-deps -isysroot $SDK_ROOT -I $PROJECT_DIR -stdlib=libc++ -internal-isystem $CONDA_PREFIX/bin/../include/c++/v1 -internal-isystem $SDK_ROOT/usr/local/include -internal-isystem $CONDA_PREFIX/lib/clang/14.0.4/include -internal-externc-isystem $SDK_ROOT/usr/include -fdeprecated-macro -fdebug-compilation-dir=$PROJECT_DIR/build -ferror-limit 19 -stack-protector 1 -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fmax-type-align=16 -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o CMakeFiles/knn.dir/main.cpp.o -x c++ $PROJECT_DIR/main.cpp
clang -cc1 version 14.0.4 based upon LLVM 14.0.4 default target arm64-apple-darwin21.6.0
ignoring nonexistent directory "$SDK_ROOT/usr/local/include"
ignoring nonexistent directory "$SDK_ROOT/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
$PROJECT_DIR
$CONDA_PREFIX/bin/../include/c++/v1
$CONDA_PREFIX/lib/clang/14.0.4/include
$SDK_ROOT/usr/include
$SDK_ROOT/System/Library/Frameworks (framework directory)
End of search list.
[3/9] : && $CONDA_PREFIX/bin/arm64-apple-darwin20.0.0-clang++ -v -arch arm64 -isysroot $SDK_ROOT -dynamiclib -Wl,-headerpad_max_install_names -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,$CONDA_PREFIX/lib -L$CONDA_PREFIX/lib -o libknn_lib.dylib -install_name @rpath/libknn_lib.dylib CMakeFiles/knn_lib.dir/nearest_neighbors.cpp.o && :
clang version 14.0.4
Target: arm64-apple-darwin20.0.0
Thread model: posix
InstalledDir: $CONDA_PREFIX/bin
"$CONDA_PREFIX/bin/arm64-apple-darwin20.0.0-ld" -demangle -lto_library $CONDA_PREFIX/lib/libLTO.14.dylib -dynamic -dylib -arch arm64 -dylib_install_name @rpath/libknn_lib.dylib -platform_version macos 12.0.0 12.3 -syslibroot $SDK_ROOT -o libknn_lib.dylib -L$CONDA_PREFIX/lib -headerpad_max_install_names -pie -headerpad_max_install_names -dead_strip_dylibs -rpath $CONDA_PREFIX/lib CMakeFiles/knn_lib.dir/nearest_neighbors.cpp.o -lc++ -lSystem $CONDA_PREFIX/lib/clang/14.0.4/lib/darwin/libclang_rt.osx.a
ld: warning: -pie being ignored. It is only used when linking a main executable
[4/9] : && $CONDA_PREFIX/bin/arm64-apple-darwin20.0.0-clang++ -v -arch arm64 -isysroot $SDK_ROOT -Wl,-search_paths_first -Wl,-headerpad_max_install_names -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,$CONDA_PREFIX/lib -L$CONDA_PREFIX/lib CMakeFiles/knn.dir/main.cpp.o -o knn -Wl,-rpath,$PROJECT_DIR/build libknn_lib.dylib && :
clang version 14.0.4
Target: arm64-apple-darwin20.0.0
Thread model: posix
InstalledDir: $CONDA_PREFIX/bin
"$CONDA_PREFIX/bin/arm64-apple-darwin20.0.0-ld" -demangle -lto_library $CONDA_PREFIX/lib/libLTO.14.dylib -dynamic -arch arm64 -platform_version macos 12.0.0 12.3 -syslibroot $SDK_ROOT -o knn -L$CONDA_PREFIX/lib -search_paths_first -headerpad_max_install_names -pie -headerpad_max_install_names -dead_strip_dylibs -rpath $CONDA_PREFIX/lib CMakeFiles/knn.dir/main.cpp.o -rpath $PROJECT_DIR/build libknn_lib.dylib -lc++ -lSystem $CONDA_PREFIX/lib/clang/14.0.4/lib/darwin/libclang_rt.osx.a
[5/9] cd $PROJECT_DIR/build/knn_example && python $CONDA_PREFIX/bin/cppyy-generator --libclang $CONDA_PREFIX/lib/libclang.dylib --flags "\-D__PIC__;\-Wno-macro-redefined;\-std=c++14;\-I$PROJECT_DIR;\-I$PROJECT_DIR" $PROJECT_DIR/build/knn_example/knn_example.map $PROJECT_DIR/nearest_neighbors.h
[6/9] cd $PROJECT_DIR/build/knn_example && $CONDA_PREFIX/bin/rootcling -f $PROJECT_DIR/build/knn_example.cpp -s knn_example -rmf $PROJECT_DIR/build/knn_example/knn_example.rootmap -rml libknn_exampleCppyy.dylib -cxxflags='-D__PIC__ -Wno-macro-redefined -std=c++14 -I$PROJECT_DIR -I$PROJECT_DIR' $PROJECT_DIR/nearest_neighbors.h $PROJECT_DIR/build/linkdef.h
[7/9] $CONDA_PREFIX/bin/arm64-apple-darwin20.0.0-clang++ -Dknn_exampleCppyy_EXPORTS -I$CONDA_PREFIX/lib/python3.10/site-packages/cppyy_backend/cmake/../include -I$PROJECT_DIR -v -arch arm64 -isysroot $SDK_ROOT -fPIC -MD -MT CMakeFiles/knn_exampleCppyy.dir/knn_example.cpp.o -MF CMakeFiles/knn_exampleCppyy.dir/knn_example.cpp.o.d -o CMakeFiles/knn_exampleCppyy.dir/knn_example.cpp.o -c $PROJECT_DIR/build/knn_example.cpp
clang version 14.0.4
Target: arm64-apple-darwin20.0.0
Thread model: posix
InstalledDir: $CONDA_PREFIX/bin
(in-process)
"$CONDA_PREFIX/bin/clang-14" -cc1 -triple arm64-apple-macosx12.0.0 -Wundef-prefix=TARGET_OS_ -Werror=undef-prefix -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name knn_example.cpp -mrelocation-model pic -pic-level 2 -mframe-pointer=non-leaf -ffp-contract=on -fno-rounding-math -funwind-tables=2 -target-sdk-version=12.3 -fcompatibility-qualified-id-block-type-checking -fvisibility-inlines-hidden-static-local-var -target-cpu apple-m1 -target-feature +v8.5a -target-feature +fp-armv8 -target-feature +neon -target-feature +crc -target-feature +crypto -target-feature +dotprod -target-feature +fp16fml -target-feature +ras -target-feature +lse -target-feature +rdm -target-feature +rcpc -target-feature +zcm -target-feature +zcz -target-feature +fullfp16 -target-feature +sha2 -target-feature +aes -target-abi darwinpcs -fallow-half-arguments-and-returns -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=lldb -target-linker-version 609 -v -fcoverage-compilation-dir=$PROJECT_DIR/build -resource-dir $CONDA_PREFIX/lib/clang/14.0.4 -dependency-file CMakeFiles/knn_exampleCppyy.dir/knn_example.cpp.o.d -MT CMakeFiles/knn_exampleCppyy.dir/knn_example.cpp.o -sys-header-deps -isysroot $SDK_ROOT -D knn_exampleCppyy_EXPORTS -I $CONDA_PREFIX/lib/python3.10/site-packages/cppyy_backend/cmake/../include -I $PROJECT_DIR -stdlib=libc++ -internal-isystem $CONDA_PREFIX/bin/../include/c++/v1 -internal-isystem $SDK_ROOT/usr/local/include -internal-isystem $CONDA_PREFIX/lib/clang/14.0.4/include -internal-externc-isystem $SDK_ROOT/usr/include -fdeprecated-macro -fdebug-compilation-dir=$PROJECT_DIR/build -ferror-limit 19 -stack-protector 1 -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fmax-type-align=16 -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o CMakeFiles/knn_exampleCppyy.dir/knn_example.cpp.o -x c++ $PROJECT_DIR/build/knn_example.cpp
clang -cc1 version 14.0.4 based upon LLVM 14.0.4 default target arm64-apple-darwin21.6.0
ignoring nonexistent directory "$SDK_ROOT/usr/local/include"
ignoring nonexistent directory "$SDK_ROOT/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
$CONDA_PREFIX/lib/python3.10/site-packages/cppyy_backend/cmake/../include
$PROJECT_DIR
$CONDA_PREFIX/bin/../include/c++/v1
$CONDA_PREFIX/lib/clang/14.0.4/include
$SDK_ROOT/usr/include
$SDK_ROOT/System/Library/Frameworks (framework directory)
End of search list.
[8/9] : && $CONDA_PREFIX/bin/arm64-apple-darwin20.0.0-clang++ -v -arch arm64 -isysroot $SDK_ROOT -dynamiclib -Wl,-headerpad_max_install_names -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,$CONDA_PREFIX/lib -L$CONDA_PREFIX/lib -o knn_example/libknn_exampleCppyy.dylib -install_name @rpath/libknn_exampleCppyy.dylib CMakeFiles/knn_exampleCppyy.dir/knn_example.cpp.o -Wl,-rpath,$PROJECT_DIR/build libknn_lib.dylib && :
FAILED: knn_example/libknn_exampleCppyy.dylib
: && $CONDA_PREFIX/bin/arm64-apple-darwin20.0.0-clang++ -v -arch arm64 -isysroot $SDK_ROOT -dynamiclib -Wl,-headerpad_max_install_names -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,$CONDA_PREFIX/lib -L$CONDA_PREFIX/lib -o knn_example/libknn_exampleCppyy.dylib -install_name @rpath/libknn_exampleCppyy.dylib CMakeFiles/knn_exampleCppyy.dir/knn_example.cpp.o -Wl,-rpath,$PROJECT_DIR/build libknn_lib.dylib && :
clang version 14.0.4
Target: arm64-apple-darwin20.0.0
Thread model: posix
InstalledDir: $CONDA_PREFIX/bin
"$CONDA_PREFIX/bin/arm64-apple-darwin20.0.0-ld" -demangle -lto_library $CONDA_PREFIX/lib/libLTO.14.dylib -dynamic -dylib -arch arm64 -dylib_install_name @rpath/libknn_exampleCppyy.dylib -platform_version macos 12.0.0 12.3 -syslibroot $SDK_ROOT -o knn_example/libknn_exampleCppyy.dylib -L$CONDA_PREFIX/lib -headerpad_max_install_names -pie -headerpad_max_install_names -dead_strip_dylibs -rpath $CONDA_PREFIX/lib CMakeFiles/knn_exampleCppyy.dir/knn_example.cpp.o -rpath $PROJECT_DIR/build libknn_lib.dylib -lc++ -lSystem $CONDA_PREFIX/lib/clang/14.0.4/lib/darwin/libclang_rt.osx.a
ld: warning: -pie being ignored. It is only used when linking a main executable
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
"CppyyLegacy::TDictionary::CreateAttributeMap()", referenced from:
CppyyLegacy::Point_TClassManip(CppyyLegacy::TClass*) in knn_example.cpp.o
CppyyLegacy::NearestNeighbors_TClassManip(CppyyLegacy::TClass*) in knn_example.cpp.o
"CppyyLegacy::TVersionCheck::TVersionCheck(int)", referenced from:
___cxx_global_var_init in knn_example.cpp.o
"CppyyLegacy::TDictAttributeMap::AddProperty(char const*, char const*)", referenced from:
CppyyLegacy::Point_TClassManip(CppyyLegacy::TClass*) in knn_example.cpp.o
CppyyLegacy::NearestNeighbors_TClassManip(CppyyLegacy::TClass*) in knn_example.cpp.o
"CppyyLegacy::TGenericClassInfo::SetNewArray(void* (*)(long, void*))", referenced from:
CppyyLegacy::GenerateInitInstanceLocal(Point const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(NearestNeighbors const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(std::__1::vector<Point, std::__1::allocator<Point> > const*) in knn_example.cpp.o
"CppyyLegacy::TGenericClassInfo::SetDestructor(void (*)(void*))", referenced from:
CppyyLegacy::GenerateInitInstanceLocal(Point const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(NearestNeighbors const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(std::__1::vector<Point, std::__1::allocator<Point> > const*) in knn_example.cpp.o
"CppyyLegacy::TGenericClassInfo::SetDeleteArray(void (*)(void*))", referenced from:
CppyyLegacy::GenerateInitInstanceLocal(Point const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(NearestNeighbors const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(std::__1::vector<Point, std::__1::allocator<Point> > const*) in knn_example.cpp.o
"CppyyLegacy::TGenericClassInfo::AdoptCollectionProxyInfo(CppyyLegacy::Detail::TCollectionProxyInfo*)", referenced from:
CppyyLegacy::GenerateInitInstanceLocal(std::__1::vector<Point, std::__1::allocator<Point> > const*) in knn_example.cpp.o
"CppyyLegacy::TGenericClassInfo::SetNew(void* (*)(void*))", referenced from:
CppyyLegacy::GenerateInitInstanceLocal(Point const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(NearestNeighbors const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(std::__1::vector<Point, std::__1::allocator<Point> > const*) in knn_example.cpp.o
"CppyyLegacy::TGenericClassInfo::GetClass()", referenced from:
CppyyLegacy::Point_Dictionary() in knn_example.cpp.o
CppyyLegacy::NearestNeighbors_Dictionary() in knn_example.cpp.o
CppyyLegacy::stdcLcLvectorlEPointgR_Dictionary() in knn_example.cpp.o
"CppyyLegacy::TGenericClassInfo::SetDelete(void (*)(void*))", referenced from:
CppyyLegacy::GenerateInitInstanceLocal(Point const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(NearestNeighbors const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(std::__1::vector<Point, std::__1::allocator<Point> > const*) in knn_example.cpp.o
"CppyyLegacy::TGenericClassInfo::TGenericClassInfo(char const*, char const*, int, std::type_info const&, CppyyLegacy::Internal::TInitBehavior const*, CppyyLegacy::TClass* (*)(), CppyyLegacy::TVirtualIsAProxy*, int, int)", referenced from:
CppyyLegacy::GenerateInitInstanceLocal(Point const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(NearestNeighbors const*) in knn_example.cpp.o
"CppyyLegacy::TGenericClassInfo::TGenericClassInfo(char const*, int, char const*, int, std::type_info const&, CppyyLegacy::Internal::TInitBehavior const*, CppyyLegacy::TClass* (*)(), CppyyLegacy::TVirtualIsAProxy*, int, int)", referenced from:
CppyyLegacy::GenerateInitInstanceLocal(std::__1::vector<Point, std::__1::allocator<Point> > const*) in knn_example.cpp.o
"CppyyLegacy::TGenericClassInfo::~TGenericClassInfo()", referenced from:
CppyyLegacy::GenerateInitInstanceLocal(Point const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(NearestNeighbors const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(std::__1::vector<Point, std::__1::allocator<Point> > const*) in knn_example.cpp.o
"CppyyLegacy::Fatal(char const*, char const*, ...)", referenced from:
CppyyLegacy::Detail::TCollectionProxyInfo::Iterators<std::__1::vector<Point, std::__1::allocator<Point> >, false>::next(void*, void const*) in knn_example.cpp.o
"CppyyLegacy::TROOT::RegisterModule(char const*, char const**, char const**, char const*, char const*, void (*)(), std::__1::vector<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int> > > const&, char const**, bool)", referenced from:
(anonymous namespace)::TriggerDictionaryInitialization_knn_example_Impl() in knn_example.cpp.o
"CppyyLegacy::Internal::DefineBehavior(void*, void*)", referenced from:
CppyyLegacy::GenerateInitInstanceLocal(Point const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(NearestNeighbors const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(std::__1::vector<Point, std::__1::allocator<Point> > const*) in knn_example.cpp.o
"CppyyLegacy::TIsAProxy::TIsAProxy(std::type_info const&)", referenced from:
CppyyLegacy::GenerateInitInstanceLocal(Point const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(NearestNeighbors const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(std::__1::vector<Point, std::__1::allocator<Point> > const*) in knn_example.cpp.o
ld: symbol(s) not found for architecture arm64
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
8/9 ? libknn_lib.dylib
[8/9] : && $CONDA_PREFIX/bin/arm64-apple-darwin20.0.0-clang++ -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -fmessage-length=0 -isystem $CONDA_PREFIX/include -arch arm64 -isysroot $SDK_ROOT -dynamiclib -Wl,-headerpad_max_install_names -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,$CONDA_PREFIX/lib -L$CONDA_PREFIX/lib -o knn_example/libknn_exampleCppyy.dylib -install_name @rpath/libknn_exampleCppyy.dylib CMakeFiles/knn_exampleCppyy.dir/knn_example.cpp.o -Wl,-rpath,$PROJECT_DIR/build libknn_lib.dylib && :
FAILED: knn_example/libknn_exampleCppyy.dylib
: && $CONDA_PREFIX/bin/arm64-apple-darwin20.0.0-clang++ -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -fmessage-length=0 -isystem $CONDA_PREFIX/include -arch arm64 -isysroot $SDK_ROOT -dynamiclib -Wl,-headerpad_max_install_names -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,$CONDA_PREFIX/lib -L$CONDA_PREFIX/lib -o knn_example/libknn_exampleCppyy.dylib -install_name @rpath/libknn_exampleCppyy.dylib CMakeFiles/knn_exampleCppyy.dir/knn_example.cpp.o -Wl,-rpath,$PROJECT_DIR/build libknn_lib.dylib && :
ld: warning: -pie being ignored. It is only used when linking a main executable
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
"CppyyLegacy::TDictionary::CreateAttributeMap()", referenced from:
CppyyLegacy::Point_Dictionary() in knn_example.cpp.o
CppyyLegacy::NearestNeighbors_Dictionary() in knn_example.cpp.o
"CppyyLegacy::TVersionCheck::TVersionCheck(int)", referenced from:
__GLOBAL__sub_I_knn_example.cpp in knn_example.cpp.o
"CppyyLegacy::TDictAttributeMap::AddProperty(char const*, char const*)", referenced from:
CppyyLegacy::Point_Dictionary() in knn_example.cpp.o
CppyyLegacy::NearestNeighbors_Dictionary() in knn_example.cpp.o
"CppyyLegacy::TGenericClassInfo::SetNewArray(void* (*)(long, void*))", referenced from:
CppyyLegacy::GenerateInitInstanceLocal(Point const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(NearestNeighbors const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(std::__1::vector<Point, std::__1::allocator<Point> > const*) in knn_example.cpp.o
"CppyyLegacy::TGenericClassInfo::SetDestructor(void (*)(void*))", referenced from:
CppyyLegacy::GenerateInitInstanceLocal(Point const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(NearestNeighbors const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(std::__1::vector<Point, std::__1::allocator<Point> > const*) in knn_example.cpp.o
"CppyyLegacy::TGenericClassInfo::SetDeleteArray(void (*)(void*))", referenced from:
CppyyLegacy::GenerateInitInstanceLocal(Point const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(NearestNeighbors const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(std::__1::vector<Point, std::__1::allocator<Point> > const*) in knn_example.cpp.o
"CppyyLegacy::TGenericClassInfo::AdoptCollectionProxyInfo(CppyyLegacy::Detail::TCollectionProxyInfo*)", referenced from:
CppyyLegacy::GenerateInitInstanceLocal(std::__1::vector<Point, std::__1::allocator<Point> > const*) in knn_example.cpp.o
"CppyyLegacy::TGenericClassInfo::SetNew(void* (*)(void*))", referenced from:
CppyyLegacy::GenerateInitInstanceLocal(Point const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(NearestNeighbors const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(std::__1::vector<Point, std::__1::allocator<Point> > const*) in knn_example.cpp.o
"CppyyLegacy::TGenericClassInfo::GetClass()", referenced from:
CppyyLegacy::Point_Dictionary() in knn_example.cpp.o
CppyyLegacy::NearestNeighbors_Dictionary() in knn_example.cpp.o
CppyyLegacy::stdcLcLvectorlEPointgR_Dictionary() in knn_example.cpp.o
"CppyyLegacy::TGenericClassInfo::SetDelete(void (*)(void*))", referenced from:
CppyyLegacy::GenerateInitInstanceLocal(Point const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(NearestNeighbors const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(std::__1::vector<Point, std::__1::allocator<Point> > const*) in knn_example.cpp.o
"CppyyLegacy::TGenericClassInfo::TGenericClassInfo(char const*, char const*, int, std::type_info const&, CppyyLegacy::Internal::TInitBehavior const*, CppyyLegacy::TClass* (*)(), CppyyLegacy::TVirtualIsAProxy*, int, int)", referenced from:
CppyyLegacy::GenerateInitInstanceLocal(Point const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(NearestNeighbors const*) in knn_example.cpp.o
"CppyyLegacy::TGenericClassInfo::TGenericClassInfo(char const*, int, char const*, int, std::type_info const&, CppyyLegacy::Internal::TInitBehavior const*, CppyyLegacy::TClass* (*)(), CppyyLegacy::TVirtualIsAProxy*, int, int)", referenced from:
CppyyLegacy::GenerateInitInstanceLocal(std::__1::vector<Point, std::__1::allocator<Point> > const*) in knn_example.cpp.o
"CppyyLegacy::TGenericClassInfo::~TGenericClassInfo()", referenced from:
CppyyLegacy::GenerateInitInstanceLocal(Point const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(NearestNeighbors const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(std::__1::vector<Point, std::__1::allocator<Point> > const*) in knn_example.cpp.o
"CppyyLegacy::Fatal(char const*, char const*, ...)", referenced from:
CppyyLegacy::Detail::TCollectionProxyInfo::Iterators<std::__1::vector<Point, std::__1::allocator<Point> >, false>::next(void*, void const*) in knn_example.cpp.o
"CppyyLegacy::TROOT::RegisterModule(char const*, char const**, char const**, char const*, char const*, void (*)(), std::__1::vector<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int> > > const&, char const**, bool)", referenced from:
(anonymous namespace)::TriggerDictionaryInitialization_knn_example_Impl() in knn_example.cpp.o
"CppyyLegacy::Internal::DefineBehavior(void*, void*)", referenced from:
CppyyLegacy::GenerateInitInstanceLocal(Point const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(NearestNeighbors const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(std::__1::vector<Point, std::__1::allocator<Point> > const*) in knn_example.cpp.o
"CppyyLegacy::TIsAProxy::TIsAProxy(std::type_info const&)", referenced from:
CppyyLegacy::GenerateInitInstanceLocal(Point const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(NearestNeighbors const*) in knn_example.cpp.o
CppyyLegacy::GenerateInitInstanceLocal(std::__1::vector<Point, std::__1::allocator<Point> > const*) in knn_example.cpp.o
ld: symbol(s) not found for architecture arm64
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
Understanding the command
( \
PROJECT_DIR=$(pwd) ; \
SDK_ROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"; \
cd build ; \
$CONDA_PREFIX/bin/arm64-apple-darwin20.0.0-clang++ \
-v
-ftree-vectorize \
-fPIC \
-fPIE \
-fstack-protector-strong \
-O2 \
-pipe \
-stdlib=libc++ \
-fvisibility-inlines-hidden \
-fmessage-length=0 \
-isystem \
$CONDA_PREFIX/include \
-arch \
arm64 \
-isysroot \
$SDK_ROOT \
-dynamiclib \
-Wl,-headerpad_max_install_names \
-Wl,-pie \
-Wl,-headerpad_max_install_names \
-Wl,-dead_strip_dylibs \
-Wl,-rpath,$CONDA_PREFIX/lib \
-L$CONDA_PREFIX/lib \
-o \
knn_example/libknn_exampleCppyy.dylib \
-install_name \
@rpath/libknn_exampleCppyy.dylib \
CMakeFiles/knn_exampleCppyy.dir/knn_example.cpp.o \
\
-Wl,-rpath,$PROJECT_DIR/build \
\
libknn_lib.dylib \
\
)
List of files involved:
knn_example/libknn_exampleCppyy.dylibCMakeFiles/knn_exampleCppyy.dir/knn_example.cpp.olibknn_li.dylib
At this point we added the -v option to the CXX compiler via CMakeLists.txt.
This prints some extra information and the linker invocation, which for the bugged command is (replacing by \n):
clang version 14.0.4
Target: arm64-apple-darwin20.0.0
Thread model: posix
InstalledDir: $CONDA_PREFIX/bin
"$CONDA_PREFIX/bin/arm64-apple-darwin20.0.0-ld"
-demangle
-lto_library
$CONDA_PREFIX/lib/libLTO.14.dylib
-dynamic
-dylib
-arch
arm64
-dylib_install_name
@rpath/libknn_exampleCppyy.dylib
-platform_version
macos
12.0.0
12.3
-syslibroot
$SDK_ROOT
-o
knn_example/libknn_exampleCppyy.dylib
-L$CONDA_PREFIX/lib
-headerpad_max_install_names
-pie
-headerpad_max_install_names
-dead_strip_dylibs
-rpath
$CONDA_PREFIX/lib
CMakeFiles/knn_exampleCppyy.dir/knn_example.cpp.o
-rpath
$PROJECT_DIR/build
libknn_lib.dylib
-lc++
-lSystem
$CONDA_PREFIX/lib/clang/14.0.4/lib/darwin/libclang_rt.osx.a
Current reasoning
The compiler complains symbols refered in CMakeFiles/knn_exampleCppyy.dir/knn_example.cpp.o are missing.
CppyyLegacy is a namespace that is defined in build/knn_example.cpp. No other file in the build directory refers to it. It includes several files that define the missing symbols.
Yet, somehow it was built into CMakeFiles/knn_exampleCppyy.dir/knn_example.cpp.o.
- Which command created this file?
- Where did it obtain kAssertMsg and others?
- And why are these not available to the last command?
Just updated the previous comment with a more verbose build log, using pypi cppyy.
Just adding that I'm on macOS 12.6 on an Intel MacBook, and I have the same error with CppyyLegacy , so it seems not limited to M1 silicon.
I added this to the CMakeLists.txt, and now it's at least linking:
link_directories(<home>/micromamba/envs/cppyy/lib/python3.10/site-packages)
link_libraries(CoreLegacy)
I added this to the CMakeLists.txt, and now it's at least linking:
link_directories(<home>/micromamba/envs/cppyy/lib/python3.10/site-packages) link_libraries(CoreLegacy)
I tried it and the linker complains it cannot find CoreLegacy:
[build] ld: library not found for -lCoreLegacy
From the listing in site-packages, seems only libcppyy.cpython-310-darwin.so is contained within.
Can you post which libraries you have in this folder?
Either way thanks for the info.
Below is the contents of my sitepackages and also the current build script.
site-packages$ ls -lha
total 828K
drwxr-xr-x 20 ma staff 640 Aug 26 06:14 .
drwxr-xr-x 209 ma staff 6.6K Aug 26 01:36 ..
drwxr-xr-x 8 ma staff 256 Aug 26 01:36 CPyCppyy-1.12.11.dist-info
-rw-rw-r-- 4 ma staff 119 Aug 22 22:42 README.txt
drwxr-xr-x 5 ma staff 160 Aug 26 06:14 clang
drwxr-xr-x 15 ma staff 480 Aug 26 01:36 cppyy
drwxr-xr-x 10 ma staff 320 Aug 26 01:36 cppyy-2.4.0.dist-info
drwxr-xr-x 19 ma staff 608 Aug 26 01:36 cppyy_backend
drwxr-xr-x 8 ma staff 256 Aug 26 01:36 cppyy_backend-1.14.9.dist-info
drwxr-xr-x 9 ma staff 288 Aug 26 01:36 cppyy_cling-6.27.0.dist-info
-rw-rw-r-- 2 ma staff 151 Aug 24 23:16 distutils-precedence.pth
-rwxr-xr-x 1 ma staff 820K Aug 26 01:36 libcppyy.cpython-310-darwin.so
drwxr-xr-x 9 ma staff 288 Aug 29 16:52 pip
drwxr-xr-x 8 ma staff 256 Aug 26 01:36 pip-22.2.2-py3.10.egg-info
drwxr-xr-x 6 ma staff 192 Aug 26 01:36 pkg_resources
drwxr-xr-x 48 ma staff 1.5K Aug 26 01:36 setuptools
drwxr-xr-x 8 ma staff 256 Aug 26 01:36 setuptools-65.3.0-py3.10.egg-info
drwxr-xr-x 12 ma staff 384 Aug 26 01:36 wheel
drwxr-xr-x 9 ma staff 288 Aug 26 01:36 wheel-0.37.1-py3.8.egg-info
drwxr-xr-x 5 ma staff 160 Aug 26 01:36 _distutils_hack
CMakeLists
set(CMAKE_POLICY_DEFAULT_CMP0102 NEW)
set(CMAKE_POLICY_DEFAULT_CMP0128 NEW)
set(CMAKE_POLICY_DEFAULT_CMP0126 NEW)
cmake_minimum_required(VERSION 3.10)
# add_link_options("LINKER:-v")
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Xlinker -v")
# set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Xlinker -v")
set(CMAKE_CXX_FLAGS "-v")
project(cppyy_example LANGUAGES CXX)
execute_process(COMMAND cling-config --cmake OUTPUT_VARIABLE CPPYY_MODULE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
# Make sure this is set to something like:
# ~/.local/lib/python2.7/site-packages/cpyy_backend/cmake
message("CPYY_MODULE_PATH: " ${CPPYY_MODULE_PATH})
list(INSERT CMAKE_MODULE_PATH 0 ${CPPYY_MODULE_PATH})
find_package(Cppyy)
link_directories($ENV{CONDA_PREFIX}/lib/python3.10/site-packages)
link_libraries(CoreLegacy)
set(SOURCES nearest_neighbors.cpp)
set(HEADERS nearest_neighbors.h)
# It seems like this library has to be shared...
add_library(knn_lib SHARED ${SOURCES})
# Note this is a necessary compile flag for cppyy bindings to work.
set_target_properties(knn_lib PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_include_directories(knn_lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
cppyy_add_bindings(
"knn_example" "0.0.1" "Joel" "[email protected]"
LANGUAGE_STANDARD "14"
GENERATE_OPTIONS "-D__PIC__;-Wno-macro-redefined"
# COMPILE_OPTIONS "-v"
INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}
LINK_LIBRARIES knn_lib
H_DIRS ${CMAKE_CURRENT_SOURCE_DIR}
H_FILES ${HEADERS})
add_executable(knn main.cpp)
target_link_libraries(knn PUBLIC knn_lib)
# set_property(TARGET knn PROPERTY CXX_STANDARD 14)
# set_property(TARGET knn_lib PROPERTY CXX_STANDARD 14)
Ok, so adding this directory works:
link_directories($ENV{CONDA_PREFIX}/lib/python3.10/site-packages/cppyy_backend/lib)
That's where libCoreLegacy.so is on my install.
PS: nicer cmake commands:
get_filename_component(PYTHON_SITE_PACKAGES ${CPPYY_MODULE_PATH} DIRECTORY)
set(CPPYY_LIB_SO ${PYTHON_SITE_PACKAGES}/lib)
message("CPYY_LIB_SO: " ${CPPYY_LIB_SO})
link_directories(${CPPYY_LIB_SO})
link_libraries(CoreLegacy)
cppyycomponentsEach of these cppyy components merits some entry. For now we just have this listing:
$ mamba list | grep pypi cppyy 2.4.0 pypi_0 pypi cppyy-backend 1.14.9 pypi_0 pypi cppyy-cling 6.27.0 pypi_0 pypi cpycppyy 1.12.11 pypi_0 pypi
@wlav just to clarify, in case it was not clear, in this comment I describe an environment where cppyy was installed via pip, while python was installed via conda. I could further try to install python/ other base dependencies via homebrew and then install cppyy via pip. It worries me a bit I might run into further issues by working around it and linking to CoreLegacy, as I am doing now that I have found where it is.