← Back to team overview

kicad-developers team mailing list archive

Re: RPATH issue on _pcbnew.so

 


Attached

On 26/02/18 11:15, Wayne Stambaugh wrote:
hauptmech,

Would you please attach this change as a committed patch when you get a chance?  I want to test this on windows and linux and maybe we can get one of our macos devs to test it there as well.  I would like to work out any packaging issues as soon as possible to give our package devs as much time as possible to work out any issue for the stable release.

Thanks,

Wayne

On 02/24/2018 08:49 PM, hauptmech wrote:
I don't have enough understanding of all the platforms to suggest a full patch. However the following works for me on linux (two targets, but shared object files so there should be no significant change in compile time)

>From 4aa94f47c48befee4c9bcd85c974b92a0b99dd4e Mon Sep 17 00:00:00 2001
From: hauptmech <hauptmech@xxxxxxxxx>
Date: Mon, 26 Feb 2018 14:36:12 +1300
Subject: [PATCH] Fix RPATH not removed in shared object file for python
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------2.16.2"

This is a multi-part message in MIME format.
--------------2.16.2
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit


Build pcbnew_kiface files as object target that can then be linked in to pcbnew.kiface and _pcbnew.so
Only create _pcbnew.so target if scripting modules is enabled.
For linux builds only.
---
 pcbnew/CMakeLists.txt | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)


--------------2.16.2
Content-Type: text/x-patch; name="0001-Fix-RPATH-not-removed-in-shared-object-file-for-pyth.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-Fix-RPATH-not-removed-in-shared-object-file-for-pyth.patch"

diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt
index 520dc1166..3ec6bbc23 100644
--- a/pcbnew/CMakeLists.txt
+++ b/pcbnew/CMakeLists.txt
@@ -608,12 +608,15 @@ if( PCBNEW_LINK_MAPS )
 endif()
 
 # the main pcbnew program, in DSO form.
-add_library( pcbnew_kiface MODULE
+add_library( pcbnew_kiface_objects OBJECT
     pcbnew.cpp
     ${PCBNEW_SRCS}
     ${PCBNEW_COMMON_SRCS}
     ${PCBNEW_SCRIPTING_SRCS}
     )
+
+add_library( pcbnew_kiface MODULE $<TARGET_OBJECTS:pcbnew_kiface_objects> )
+
 set_target_properties( pcbnew_kiface PROPERTIES
     # Decorate OUTPUT_NAME with PREFIX and SUFFIX, creating something like
     # _pcbnew.so, _pcbnew.dll, or _pcbnew.kiface
@@ -640,7 +643,7 @@ if( ${OPENMP_FOUND} )
         )
 endif()
 
-target_link_libraries( pcbnew_kiface
+set( PCBNEW_KIFACE_LIBRARIES
     3d-viewer
     pcbcommon
     pnsrouter
@@ -660,6 +663,9 @@ target_link_libraries( pcbnew_kiface
     ${OPENMP_LIBRARIES}
     )
 
+
+target_link_libraries( pcbnew_kiface ${PCBNEW_KIFACE_LIBRARIES} )
+
 set_source_files_properties( pcbnew.cpp PROPERTIES
     # The KIFACE is in pcbnew.cpp, export it:
     COMPILE_DEFINITIONS     "BUILD_KIWAY_DLL;COMPILING_DLL"
@@ -777,9 +783,12 @@ if( KICAD_SCRIPTING_MODULES )
             )
         add_dependencies( ScriptingModulesPcbnewSoCopy ScriptingWxpythonCopy )
         set( PYMOD_EXT "so" )
-
     else()  # only linux remains among supported platforms
-        install( FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.so DESTINATION ${PYTHON_DEST} )
+        add_library( pcbnew_python MODULE $<TARGET_OBJECTS:pcbnew_kiface_objects> )
+        target_link_libraries( pcbnew_python ${PCBNEW_KIFACE_LIBRARIES} )
+        set_target_properties( pcbnew_python PROPERTIES OUTPUT_NAME pcbnew PREFIX "_" SUFFIX ".so" )
+        install( TARGETS pcbnew_python DESTINATION ${PYTHON_DEST} COMPONENT binary )
+
         set( PYMOD_EXT "so" )
     endif()
 

--------------2.16.2--



Follow ups

References