Coder Social home page Coder Social logo

Comments (10)

andrewssobral avatar andrewssobral commented on June 1, 2024

Hello @Nuwan1654 thanks for reporting this issue.
Can you check please if you have numpy installed ? or send me the output of the following commands:

pip -V
pip list

from bgslibrary.

Nuwan1654 avatar Nuwan1654 commented on June 1, 2024

Here are the outputs. I installed NumPy but

pip -V:
pip 20.0.2 from /home/dinusha/.virtualenvs/bs/lib/python3.8/site-packages/pip (python 3.8)

pip list:
Package Version


numpy 1.24.4
pip 20.0.2
pkg-resources 0.0.0
setuptools 44.0.0
wheel 0.34.2

from bgslibrary.

andrewssobral avatar andrewssobral commented on June 1, 2024

@Nuwan1654 try this:

cmake -D BGS_PYTHON_SUPPORT=ON \ 
  -D PYTHON_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
  -D PYTHON_LIBRARY=$(python3 -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))") ..

from bgslibrary.

Nuwan1654 avatar Nuwan1654 commented on June 1, 2024

@andrewssobral thanks for looking into this, I tried but still got the same error. I am running this on a virtual python environment. When I try to install in the default python environment with pip install pybgs. it also getting a different error, but I see the NUMPY_INCLUDE_DIR: /home/dinusha/.local/lib/python3.8/site-packages/numpy/core/include

Here is the error for pip install pybgs

-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.10", minimum required is "3.8")
      -- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.8.so
      -- pybind11 v2.3.dev1
      --
      -- Python library status:
      --     executable: /usr/bin/python3
      --     library: /usr/lib/x86_64-linux-gnu/libpython3.8.so
      --     include path: /usr/include/python3.8
      -- NUMPY_INCLUDE_DIR: /home/dinusha/.local/lib/python3.8/site-packages/numpy/core/include
      
      -- Bulding bgslibrary_core STATIC
      --
      -- The bgslibrary python package will be installed at: lib/python3/dist-packages
      
      -- Configuring done
      CMake Error at CMakeLists.txt:223 (add_library):
        No SOURCES given to target: bgslibrary_core
      
      
      CMake Generate step failed.  Build files cannot be regenerated correctly.
      error: command 'cmake' failed with exit status 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pybgs

from bgslibrary.

andrewssobral avatar andrewssobral commented on June 1, 2024

@Nuwan1654
Thanks for those inputs.
I need to check why pybgs is generating this error, it's very strange.
Can you try to build the bgs library by manually setting the NUMPY_INCLUDE_DIR, like:

cmake -D BGS_PYTHON_SUPPORT=ON -D NUMPY_INCLUDE_DIR=/home/dinusha/.local/lib/python3.8/site-packages/numpy/core/include ..

from bgslibrary.

Nuwan1654 avatar Nuwan1654 commented on June 1, 2024

Hi @andrewssobral thanks for helping me. Now the numpy error is gone, It seems like an issue with cmake.

error left is

CMake Error at CMakeLists.txt:161 (add_subdirectory):
  The source directory

    /home/dinusha/codebase/bs/bgslibrary/modules/pybind11

  does not contain a CMakeLists.txt file.

-- 
-- Python library status:
--     executable: 
--     library: /usr/lib
--     include path: 
-- NUMPY_INCLUDE_DIR: /home/dinusha/.local/lib/python3.8/site-packages/numpy/core/include

-- Bulding bgslibrary_core SHARED
CMake Error at CMakeLists.txt:242 (pybind11_add_module):
  Unknown CMake command "pybind11_add_module".


-- Configuring incomplete, errors occurred!
See also "/home/dinusha/codebase/bs/bgslibrary/build/CMakeFiles/CMakeOutput.log".
See also "/home/dinusha/codebase/bs/bgslibrary/build/CMakeFiles/CMakeError.log".

Here is the content of the CMakeError.log

Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: /home/dinusha/codebase/bs/bgslibrary/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_3076c/fast && /usr/bin/make -f CMakeFiles/cmTC_3076c.dir/build.make CMakeFiles/cmTC_3076c.dir/build
make[1]: Entering directory '/home/dinusha/codebase/bs/bgslibrary/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_3076c.dir/src.c.o
/usr/bin/cc   -fPIC -DCMAKE_HAVE_LIBC_PTHREAD -fPIE   -o CMakeFiles/cmTC_3076c.dir/src.c.o   -c /home/dinusha/codebase/bs/bgslibrary/build/CMakeFiles/CMakeTmp/src.c
Linking C executable cmTC_3076c
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_3076c.dir/link.txt --verbose=1
/usr/bin/cc -fPIC -DCMAKE_HAVE_LIBC_PTHREAD    -rdynamic CMakeFiles/cmTC_3076c.dir/src.c.o  -o cmTC_3076c
/usr/bin/ld: CMakeFiles/cmTC_3076c.dir/src.c.o: in function `main':
src.c:(.text+0x46): undefined reference to `pthread_create'
/usr/bin/ld: src.c:(.text+0x52): undefined reference to `pthread_detach'
/usr/bin/ld: src.c:(.text+0x63): undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_3076c.dir/build.make:87: cmTC_3076c] Error 1
make[1]: Leaving directory '/home/dinusha/codebase/bs/bgslibrary/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_3076c/fast] Error 2


Source file was:
#include <pthread.h>

void* test_func(void* data)
{
  return data;
}

int main(void)
{
  pthread_t thread;
  pthread_create(&thread, NULL, test_func, NULL);
  pthread_detach(thread);
  pthread_join(thread, NULL);
  pthread_atfork(NULL, NULL, NULL);
  pthread_exit(NULL);

  return 0;
}

Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /home/dinusha/codebase/bs/bgslibrary/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_a7086/fast && /usr/bin/make -f CMakeFiles/cmTC_a7086.dir/build.make CMakeFiles/cmTC_a7086.dir/build
make[1]: Entering directory '/home/dinusha/codebase/bs/bgslibrary/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_a7086.dir/CheckFunctionExists.c.o
/usr/bin/cc   -fPIC -DCHECK_FUNCTION_EXISTS=pthread_create -fPIE   -o CMakeFiles/cmTC_a7086.dir/CheckFunctionExists.c.o   -c /usr/share/cmake-3.16/Modules/CheckFunctionExists.c
Linking C executable cmTC_a7086
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_a7086.dir/link.txt --verbose=1
/usr/bin/cc -fPIC -DCHECK_FUNCTION_EXISTS=pthread_create    -rdynamic CMakeFiles/cmTC_a7086.dir/CheckFunctionExists.c.o  -o cmTC_a7086  -lpthreads
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_a7086.dir/build.make:87: cmTC_a7086] Error 1
make[1]: Leaving directory '/home/dinusha/codebase/bs/bgslibrary/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_a7086/fast] Error 2

from bgslibrary.

andrewssobral avatar andrewssobral commented on June 1, 2024

@Nuwan1654 , perfect!

The new error you encountered is related to the missing submodules of the bgslibrary repository, specifically the pybind11 submodule. Typically, we should clone the bgslibrary using the --recursive option, but you can also run the following command after cloned repo:

git submodule update --init --recursive

After running this command, you can proceed to execute the cmake command.

from bgslibrary.

Nuwan1654 avatar Nuwan1654 commented on June 1, 2024

@andrewssobral Thank you very much, Now I have built it successfully, but in the guidelines, it says (add 'pybgs.so' to your Python path)

But in the build directory I have pybgs.cpython-38-x86_64-linux-gnu.so How can I add this to the python path

from bgslibrary.

andrewssobral avatar andrewssobral commented on June 1, 2024

@Nuwan1654 perfect!

To add the bgslibrary build directory to the PYTHONPATH environment variable, you can use the following command:

export PYTHONPATH="${PYTHONPATH}:/root/bgslibrary/build"

Make sure to replace /root/bgslibrary/build with the correct path to your bgslibrary build directory.

from bgslibrary.

Nuwan1654 avatar Nuwan1654 commented on June 1, 2024

great thanks again for the help

from bgslibrary.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.