You have to link libarrow_python (arrow_python_shared) where this symbol is
found.

On Tue, May 18, 2021 at 3:09 AM auderson <[email protected]> wrote:

> Hi,
>
> I'm using arrow-cpp 4.0.0 installed from conda. I also have pyarrow 4.0.0
> installed.
>
> In my test.cpp file, import_pyarrow() will throw an error: undefined
> reference to `arrow::py::import_pyarrow()'
>
> #mini_example.cpp
>
> #include "mini_example.h"
> #include <arrow/python/pyarrow.h>
>
> int main() {
>     arrow::py::import_pyarrow();
> }
>
>  #mini_example.h
>
>
> #include <arrow/python/pyarrow.h>
>
> int main() {
>     arrow::py::import_pyarrow();
> }
>
>
> #CMakeLists.txt
>
> cmake_minimum_required(VERSION 3.10.0)
> project(TEST)
> set(CMAKE_CXX_STANDARD 17)
>
> list(APPEND CMAKE_PREFIX_PATH "/home/auderson/miniconda3/lib/cmake/arrow")
> find_package(Arrow REQUIRED)
>
>
> include_directories(.
>         /home/auderson/miniconda3/include
>         /home/auderson/miniconda3/include/python3.8)
>
> add_executable(TEST
>         mini_example.cpp
>         )
>
> target_link_libraries(${PROJECT_NAME} PRIVATE 
> /home/auderson/miniconda3/lib/libpython3.8.so)
> target_link_libraries(${PROJECT_NAME} PRIVATE arrow_shared)
>
> The full output:
>
> CMakeFiles/TEST.dir/mini_example.cpp.o: In function `main':
> /tmp/tmp.vmULkzpuYF/mini_example.cpp:9: undefined reference to 
> `arrow::py::import_pyarrow()'
> collect2: error: ld returned 1 exit status
>
> But other functionalities works fine, like create an Array then build a Table 
> from them. In fact I'm just stuck at the last step where I have to wrap the 
> table so that they can be passed to cython.
>
> Can you find where I'm doing wrong? Thanks!
>
> Auderson
>
>
>

Reply via email to