Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some issues with Gentoo #2

Open
skinkie opened this issue Nov 20, 2021 · 0 comments
Open

Some issues with Gentoo #2

skinkie opened this issue Nov 20, 2021 · 0 comments

Comments

@skinkie
Copy link

skinkie commented Nov 20, 2021

I have had quite some issues getting this to work on Gentoo Linux and still trying to find out how to get this to work in a normal fashion.

  1. Find without cmake .. -DQt5_DIR=/usr/lib64/cmake/Qt5 I cannot get the Qt5 stuff to work.
  2. I had Python 3.8, 3.9, 3.10 installed, but only 3.8 and 3.9 had PySide2 available, I could not make CMake choose Python 3.9. (I unstalled 3.10, after which I found out it was not really the root cause)
  3. The program assumes pyside2_config.py is available, this is not the case for Gentoo
  4. I had to manually set the path to my shiboken2 binary
  5. My Typesystems were added via -T/usr/share/PySide2/typesystems
  6. Then I had to add `target_include_directories(${bindings_library} PRIVATE "/usr/include/shiboken2")
  7. Then I had to add `target_include_directories(${bindings_library} PRIVATE "/usr/include/PySide2")
  8. Then I had to add `target_include_directories(${bindings_library} PRIVATE "/usr/include/PySide2/QtCore")

Until this point it compiled, but when calling main.py, I received a particular error, a similar one with https://github.com/giumas/shiboken2_minimal

Traceback (most recent call last):
  File "/mnt/storage/home/skinkie/Sources/Example_Qt_and_Shiboken2/main.py", line 1, in <module>
    from Shiboken2QtExample import *
ImportError: /mnt/storage/home/skinkie/Sources/Example_Qt_and_Shiboken2/Shiboken2QtExample.so: undefined symbol: _ZN8Shiboken11Conversions22nonePythonToCppNullPtrEP7_objectPv

Eventually traced that back to;

  1. shiboken_shared_libraries was not set, set(shiboken_shared_libraries shiboken2-python3.9)
  2. pyside2_link was not set, set(pyside2_link pyside2-python3.9)

I documented these changes, but maybe something could be done to make the example more forgiving.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index cd6cc3f..d100ab3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,10 +52,13 @@ pyside2_config(--shiboken2-module-path shiboken2_module_path)
 pyside2_config(--shiboken2-generator-path shiboken2_generator_path)
 pyside2_config(--python-include-path python_include_dir)
 pyside2_config(--shiboken2-generator-include-path shiboken_include_dir 1)
-pyside2_config(--shiboken2-module-shared-libraries-cmake shiboken_shared_libraries 0)
-pyside2_config(--pyside2-shared-libraries-cmake pyside2_link 0)
+# pyside2_config(--shiboken2-module-shared-libraries-cmake shiboken_shared_libraries 0)
+# pyside2_config(--pyside2-shared-libraries-cmake pyside2_link 0)
 
-set(shiboken_path "${shiboken2_generator_path}/shiboken2${CMAKE_EXECUTABLE_SUFFIX}")
+set(shiboken_shared_libraries shiboken2-python3.9)
+set(pyside2_link pyside2-python3.9)
+
+set(shiboken_path "/usr/bin/shiboken2")
 if(NOT EXISTS ${shiboken_path})
     message(FATAL_ERROR "Shiboken executable not found at path: ${shiboken_path}")
 endif()
@@ -84,6 +87,7 @@ set(shiboken_options --generator-set=shiboken --enable-parent-ctor-heuristic
     ${lib_includes}
     -I${CMAKE_SOURCE_DIR}
     -T${CMAKE_SOURCE_DIR}
+    -T/usr/share/PySide2/typesystems
     -T${PYSIDE2_DIR}/typesystems/
     --output-directory=${CMAKE_CURRENT_BINARY_DIR}
     )
@@ -106,6 +110,12 @@ target_include_directories(${bindings_library} PRIVATE ${python_include_dir})
 target_include_directories(${bindings_library} PRIVATE ${PYSIDE2_DIR}/include/)
 target_include_directories(${bindings_library} PRIVATE ${PYSIDE2_DIR}/include/QtCore)
 target_include_directories(${bindings_library} PRIVATE ${shiboken_include_dir})
+target_include_directories(${bindings_library} PRIVATE
+    "/usr/include/shiboken2")
+target_include_directories(${bindings_library} PRIVATE
+    "/usr/include/PySide2")
+target_include_directories(${bindings_library} PRIVATE
+    "/usr/include/PySide2/QtCore")
 target_include_directories(${bindings_library} PRIVATE ${CMAKE_SOURCE_DIR})
 
 target_link_libraries(${bindings_library} PRIVATE ${shiboken_shared_libraries})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant