
Hi All I am a new joiner.Using macbook. Can someone please guide me how to debug numpy using clion? I am able to build not sure about debugging the c code. ProductName: Mac OS X ProductVersion: 10.15.7 BuildVersion: 19H2 thx

On Sat, 2020-10-24 at 01:50 +0800, Amardeep Singh wrote:
Hi, I have set up an bogus `CMakeLists.txt` (actually using `python runtests.py` for compilation and running). That should allow you to use debugging tools in editors relying on cmake normally. My current file is below. This is the opposite of polished or thought out, so happy to learn of a better solution. And for example recently I added `NULL=0` because I had issues without really digging into why and I am sure it lists many files multiple times: cmake_minimum_required(VERSION 3.13) #cmake_policy(SET CMP0074 NEW) project(NumPy-dummy) AUX_SOURCE_DIRECTORY(numpy/core/src/multiarray/ MULTIARRAY) AUX_SOURCE_DIRECTORY(numpy/core/src/umath/ UMATH) AUX_SOURCE_DIRECTORY(numpy/core/src/common/ COMMON) AUX_SOURCE_DIRECTORY(numpy/core/src/npymath/ NPYMATH) AUX_SOURCE_DIRECTORY(numpy/core/src/npysort/ NPYSORT) AUX_SOURCE_DIRECTORY(numpy/core/include/ NPYINCLUDE) AUX_SOURCE_DIRECTORY(numpy/core/include/numpy/ NPYINCLUDEFULL) AUX_SOURCE_DIRECTORY(build/testenv/lib/python3.8/site-packages/numpy/core/include/numpy/ INSTALLED_NUMPY) AUX_SOURCE_DIRECTORY(build/src.linux-x86_64-3.8/numpy/core/src/multiarray/ HELPER_FOR_C_SCR_FILES) set( SOURCE_FILES ${MULTIARRAY} ${UMATH} ${COMMON} ${NPYMATH} ${NPYSORT} numpy/core/src/multiarray/ build/src.linux-x86_64-3.8/numpy/core/include/ build/src.linux-x86_64-3.8/numpy/core/include/numpy/ build/src.linux-x86_64-3.8/numpy/core/include/numpy/__multiarray_api.c build/src.linux-x86_64-3.8/numpy/core/src/common/ build/src.linux-x86_64-3.8/numpy/core/src/umath/ build/src.linux-x86_64-3.8/numpy/core/src/multiarray/ build/src.linux-x86_64-3.8/numpy/core/src/npymath/ build/src.linux-x86_64-3.8/numpy/core/src/npysort/ numpy/core/src/common/ numpy/core/include/) set(CMAKE_INCLUDE_PATH SOURCE_FILES) add_compile_definitions(NPY_INTERNAL_BUILD) add_compile_definitions([=[NPY_VISIBILITY_HIDDEN=__attribute__((visibility("hidden")))]=]) # add_compile_definitions(NPY_VISIBILITY_HIDDEN=) add_compile_definitions(NULL=0) #add_compile_definitions(NPY_SIZEOF_SHORT=2) #add_compile_definitions(NPY_SIZEOF_INT=4) #add_compile_definitions(NPY_SIZEOF_LONG=8) #add_compile_definitions(NPY_SIZEOF_LONGLONG=8) #add_compile_definitions(NPY_SIZEOF_PY_INTPTR_T=8) # Find default python libraries and interpreter #find_package(PythonInterp 3 REQUIRED) #find_package(PythonLibs 3 REQUIRED) #include_directories(${SOURCE_FILES} ${PYTHON_INCLUDE_DIRS}) # PYTHON_INCLUDE_DIRS also picks up the wrong numpy files... # The "clean" version below is manually edited with numpy removed... # I manuall deleted sudo rm -rf /usr/include/numpy, but I do not think it should have been there?! #include_directories(${SOURCE_FILES} /home/sebastian/venvs/pydbg-clean/include/python3.8d) include_directories(${SOURCE_FILES} /usr/include/python3.8) add_executable(asdf build/src.linux-x86_64-3.8/numpy/core/include/numpy/__multiarray_api.c ${SOURCE_FILES})

How do you use the debug enabled cpython on mac.i guess we need it. You build cpython from source? this is mytest.py file import numpy as np x = np.arange(5) np.empty_like(x) i run this command gdb --args python3 runtests.py -g --python3 mytest.py i get this Reading symbols from python3... (No debugging symbols found in python3) (gdb) sh-3.2# which python3 /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 sh-3.2# On Sat, Oct 24, 2020 at 2:09 AM Sebastian Berg <sebastian@sipsolutions.net> wrote:

Hi All, Thx.Debug enabled build worked fine on windows10.Also python for macos does not give option to install debug enabled build . I was able to build and debug via clion on windows not on mac. lldb did not work for me on mac.Not sure why.seems gdb has some version issues with macos even after code signing. thx On Sat, Oct 24, 2020 at 5:38 AM Amardeep Singh <amardeepjk@gmail.com> wrote:

On Sat, 2020-10-24 at 01:50 +0800, Amardeep Singh wrote:
Hi, I have set up an bogus `CMakeLists.txt` (actually using `python runtests.py` for compilation and running). That should allow you to use debugging tools in editors relying on cmake normally. My current file is below. This is the opposite of polished or thought out, so happy to learn of a better solution. And for example recently I added `NULL=0` because I had issues without really digging into why and I am sure it lists many files multiple times: cmake_minimum_required(VERSION 3.13) #cmake_policy(SET CMP0074 NEW) project(NumPy-dummy) AUX_SOURCE_DIRECTORY(numpy/core/src/multiarray/ MULTIARRAY) AUX_SOURCE_DIRECTORY(numpy/core/src/umath/ UMATH) AUX_SOURCE_DIRECTORY(numpy/core/src/common/ COMMON) AUX_SOURCE_DIRECTORY(numpy/core/src/npymath/ NPYMATH) AUX_SOURCE_DIRECTORY(numpy/core/src/npysort/ NPYSORT) AUX_SOURCE_DIRECTORY(numpy/core/include/ NPYINCLUDE) AUX_SOURCE_DIRECTORY(numpy/core/include/numpy/ NPYINCLUDEFULL) AUX_SOURCE_DIRECTORY(build/testenv/lib/python3.8/site-packages/numpy/core/include/numpy/ INSTALLED_NUMPY) AUX_SOURCE_DIRECTORY(build/src.linux-x86_64-3.8/numpy/core/src/multiarray/ HELPER_FOR_C_SCR_FILES) set( SOURCE_FILES ${MULTIARRAY} ${UMATH} ${COMMON} ${NPYMATH} ${NPYSORT} numpy/core/src/multiarray/ build/src.linux-x86_64-3.8/numpy/core/include/ build/src.linux-x86_64-3.8/numpy/core/include/numpy/ build/src.linux-x86_64-3.8/numpy/core/include/numpy/__multiarray_api.c build/src.linux-x86_64-3.8/numpy/core/src/common/ build/src.linux-x86_64-3.8/numpy/core/src/umath/ build/src.linux-x86_64-3.8/numpy/core/src/multiarray/ build/src.linux-x86_64-3.8/numpy/core/src/npymath/ build/src.linux-x86_64-3.8/numpy/core/src/npysort/ numpy/core/src/common/ numpy/core/include/) set(CMAKE_INCLUDE_PATH SOURCE_FILES) add_compile_definitions(NPY_INTERNAL_BUILD) add_compile_definitions([=[NPY_VISIBILITY_HIDDEN=__attribute__((visibility("hidden")))]=]) # add_compile_definitions(NPY_VISIBILITY_HIDDEN=) add_compile_definitions(NULL=0) #add_compile_definitions(NPY_SIZEOF_SHORT=2) #add_compile_definitions(NPY_SIZEOF_INT=4) #add_compile_definitions(NPY_SIZEOF_LONG=8) #add_compile_definitions(NPY_SIZEOF_LONGLONG=8) #add_compile_definitions(NPY_SIZEOF_PY_INTPTR_T=8) # Find default python libraries and interpreter #find_package(PythonInterp 3 REQUIRED) #find_package(PythonLibs 3 REQUIRED) #include_directories(${SOURCE_FILES} ${PYTHON_INCLUDE_DIRS}) # PYTHON_INCLUDE_DIRS also picks up the wrong numpy files... # The "clean" version below is manually edited with numpy removed... # I manuall deleted sudo rm -rf /usr/include/numpy, but I do not think it should have been there?! #include_directories(${SOURCE_FILES} /home/sebastian/venvs/pydbg-clean/include/python3.8d) include_directories(${SOURCE_FILES} /usr/include/python3.8) add_executable(asdf build/src.linux-x86_64-3.8/numpy/core/include/numpy/__multiarray_api.c ${SOURCE_FILES})

How do you use the debug enabled cpython on mac.i guess we need it. You build cpython from source? this is mytest.py file import numpy as np x = np.arange(5) np.empty_like(x) i run this command gdb --args python3 runtests.py -g --python3 mytest.py i get this Reading symbols from python3... (No debugging symbols found in python3) (gdb) sh-3.2# which python3 /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 sh-3.2# On Sat, Oct 24, 2020 at 2:09 AM Sebastian Berg <sebastian@sipsolutions.net> wrote:

Hi All, Thx.Debug enabled build worked fine on windows10.Also python for macos does not give option to install debug enabled build . I was able to build and debug via clion on windows not on mac. lldb did not work for me on mac.Not sure why.seems gdb has some version issues with macos even after code signing. thx On Sat, Oct 24, 2020 at 5:38 AM Amardeep Singh <amardeepjk@gmail.com> wrote:
participants (2)
-
Amardeep Singh
-
Sebastian Berg