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

pyside2 5.12.1 win: wrong SHIBOKEN_SHARED_LIBRARY_DIR #43

Closed
looooo opened this issue Oct 6, 2019 · 11 comments
Closed

pyside2 5.12.1 win: wrong SHIBOKEN_SHARED_LIBRARY_DIR #43

looooo opened this issue Oct 6, 2019 · 11 comments

Comments

@looooo
Copy link
Contributor

looooo commented Oct 6, 2019

in /Library/lib/cmake/Shiboken2-5.13.1/Shiboken2Config.cp37-win_amd64.cmake

set_and_check(SHIBOKEN_SHARED_LIBRARY_DIR "${PACKAGE_PREFIX_DIR}/bin")

should be:

set_and_check(SHIBOKEN_SHARED_LIBRARY_DIR "${PACKAGE_PREFIX_DIR}/Library/lib")

Edit: we are now using library dir via imported target properties.: https://github.com/FreeCAD/FreeCAD/blob/master/cMake/FreeCAD_Helpers/SetupShibokenAndPyside.cmake#L49

@looooo
Copy link
Contributor Author

looooo commented Oct 6, 2019

btw.: the configuration file doesn't look very good:

#----------------------------------------------------------------
# Generated CMake target import file for configuration "Release".
#----------------------------------------------------------------

# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)

# Import target "Shiboken2::libshiboken" for configuration "Release"
set_property(TARGET Shiboken2::libshiboken APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Shiboken2::libshiboken PROPERTIES
  IMPORTED_IMPLIB_RELEASE "D:/bld/pyside2_1569322331212/_h_env/Library/lib/shiboken2.cp37-win_amd64.lib"
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/shiboken2.cp37-win_amd64.dll"
  )

list(APPEND _IMPORT_CHECK_TARGETS Shiboken2::libshiboken )
list(APPEND _IMPORT_CHECK_FILES_FOR_Shiboken2::libshiboken "D:/bld/pyside2_1569322331212/_h_env/Library/lib/shiboken2.cp37-win_amd64.lib" "${_IMPORT_PREFIX}/bin/shiboken2.cp37-win_amd64.dll" )

# Import target "Shiboken2::shiboken2" for configuration "Release"
set_property(TARGET Shiboken2::shiboken2 APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Shiboken2::shiboken2 PROPERTIES
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/shiboken2.exe"
  )

list(APPEND _IMPORT_CHECK_TARGETS Shiboken2::shiboken2 )
list(APPEND _IMPORT_CHECK_FILES_FOR_Shiboken2::shiboken2 "${_IMPORT_PREFIX}/bin/shiboken2.exe" )

# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)

@jschueller
Copy link
Contributor

looks like an upstream issue, please open an issue on their jira

@jschueller
Copy link
Contributor

jschueller commented Oct 9, 2019

@looooo I think there is no bug ihmo SHIBOKEN_SHARED_LIBRARY_DIR is intended to contain the path to the runtime library (.so/.dylib/.dll); see pyside2/tests/CMakeLists.txt:12: set(TEST_LIBRARY_PATH "${libpyside_BINARY_DIR};${pysidetest_BINARY_DIR};${SHIBOKEN_SHARED_LIBRARY_DIR};$ENV{PATH}")
and on windows the runtime library (.dll) is indeed located in PREFIX/bin

@looooo
Copy link
Contributor Author

looooo commented Oct 14, 2019

Ah I see, so the real problem is linking to the runtime-library. This is the output if I try to do so:

[2340/3244] Linking CXX shared library bin\FreeCADGui.dll
.....
%PREFIX%\Library\bin\shiboken2.cp37-win_amd64.dll : fatal error LNK1107: invalid or corrupt file: cannot read at 0x348

@jschueller
Copy link
Contributor

jschueller commented Oct 14, 2019

Try to link to the one of the provided targets: Shiboken2::shiboken2 or Shiboken2::libshiboken

@looooo
Copy link
Contributor Author

looooo commented Oct 14, 2019

I think we are already doing so:
https://github.com/FreeCAD/FreeCAD/blob/3939e4543ef4be6c50581d9bff77e930fb1d9d03/cMake/FreeCAD_Helpers/SetupShibokenAndPyside.cmake#L49

get_property(SHIBOKEN_LIBRARY TARGET Shiboken2::libshiboken PROPERTY IMPORTED_LOCATION_RELEASE)

It works on linux and osx but results in the error reported above for win: #43 (comment)

@jschueller
Copy link
Contributor

jschueller commented Oct 15, 2019

you want IMPORTED_IMPLIB instead of IMPORTED_LOCATION
but its simpler not to use the location, just link directly to Shiboken2::libshiboken in the target_link_libraries

@looooo
Copy link
Contributor Author

looooo commented Oct 15, 2019

thx, I will check in the next iteration.

@looooo
Copy link
Contributor Author

looooo commented Oct 18, 2019

hmm, didn't work out of the box. I now see undefined references to shiboken funtions (windows, linux). Osx seems to work with your suggestion. Does it make any sense to use IMPORTED_IMPLIB_RELEASE insead of IMPORTED_IMPLIB?

@jschueller
Copy link
Contributor

I dont think you have to use IMPORTED_IMPLIB_RELEASE nor IMPORTED_IMPLIB at all.
Just link to Shiboken2::libshiboken.

@looooo
Copy link
Contributor Author

looooo commented Oct 19, 2019

thanks. Using the imported target indeed works.

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

2 participants