← Back to team overview

kicad-developers team mailing list archive

Re: RPATH issue on _pcbnew.so

 

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)

diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt
index 520dc1166..78bd19cee 100644
--- a/pcbnew/CMakeLists.txt
+++ b/pcbnew/CMakeLists.txt
@@ -608,12 +608,14 @@ 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 +642,7 @@ if( ${OPENMP_FOUND} )
          )
  endif()

-target_link_libraries( pcbnew_kiface
+set( PCBNEW_KIFACE_LIBRARIES
      3d-viewer
      pcbcommon
      pnsrouter
@@ -660,6 +662,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"
@@ -779,7 +784,11 @@ if( KICAD_SCRIPTING_MODULES )
          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()




On Sun, Feb 25, 2018 at 2:42 PM, Cirilo Bernardo <cirilo.bernardo@xxxxxxxxx <mailto:cirilo.bernardo@xxxxxxxxx>> wrote:

    What do you mean by a second target? Keep in mind that we don't want to
    recompile everything twice just because of the kiface libraries. If
    you can
    create a target which is dependent on the pcbnew stand-alone app and
    which used the object files to create a shared library, that would
    be good.
    I can't recall offhand if some object files would need to be rebuilt for
    the kiface library, but that can be handled by CMake as well.

    Regarding  KiCad using pcbnew.kiface directly, I suspect the
    intention was for
    pcbnew to use that library regardless of whether it was run via the
    KiCad
    application or as the pcbnew standalone application. On that topic
    I'd rather
    do nothing until KiCad could be refactored to the point where a core
    pcb API
    is completely independent of the GUI; at the moment there is such a
    tight
    coupling between the GUI and operations on the PCB that it's
    difficult to
    see how some things work.

    Cirilo

    On Sun, Feb 25, 2018 at 1:20 AM, hauptmech <hauptmech@xxxxxxxxx
    <mailto:hauptmech@xxxxxxxxx>> wrote:
     > I took a look at what approaches might work to fix this.
     >
     > I looked at removing the RPATH manually, in keeping with manual file
     > manipulation approach used by the authors of this section of the
    CMake file.
     > Shell tools to do this don't appear to be universal and it's not
    using the
     > CMake way. So I moved on.
     >
     > The approach that looks the most promising to me is to create a
    second
     > target for the scripting library with the same sources as
    pcbnew.kiface.
     > Then CMakes install Target will remove the RPATH as expected. To
    reduce the
     > impact on compile time one could use:
     > https://cmake.org/Wiki/CMake/Tutorials/Object_Library
    <https://cmake.org/Wiki/CMake/Tutorials/Object_Library>
     >
     > In the CMake file, Dick Hollenbeck mentions a future plan to use the
     > pcbnew.kiface file directly. Not sure what was involved with that.
     >
     > On 25/02/18 10:37, Carsten Schoenert wrote:
     >>
     >> Hello Wayne,
     >>
     >> Am 24.02.18 um 21:44 schrieb Wayne Stambaugh:
     >>>
     >>> Carsten,
     >>>
     >>> On 02/24/2018 02:08 PM, Carsten Schoenert wrote:
     >>>>
     >>>> Hi,
     >>>>
     >>>> I guess it's not intended that the library / shared object
    _pcbnew.so
     >>>> build in pcbnew/ set up a RPATH based on the build directory?
     >>>
     >>> This is the kicad python scripting shared object which should get
     >>> installed in the correct python library path.  CMake installs
    it in the
     >>> correct place on both my Debian and Ubuntu builds so I don't
    understand
     >>> what the issue is here.
     >>
     >> the build and installation is just fine, the issue is that this
    file has
     >> a RUNPATH set to folder there it was compiled. It should have *no*
     >> RUNPATH.
     >>
     >
     >
     > _______________________________________________
     > Mailing list: https://launchpad.net/~kicad-developers
    <https://launchpad.net/~kicad-developers>
     > Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
    <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
     > Unsubscribe : https://launchpad.net/~kicad-developers
    <https://launchpad.net/~kicad-developers>
     > More help   : https://help.launchpad.net/ListHelp
    <https://help.launchpad.net/ListHelp>




_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp



Follow ups

References