Menu

Flaw in .deb Packaging

2024-08-05
2024-08-23
  • Andrew E Page

    Andrew E Page - 2024-08-05

    In the course of our development offirmware foran embedded device we
    build on Ubuntu 22.04 machinesfor native execution and cross-compile for
    our embedded device.   When we install liblog4cpp-1.1.3 with apt for our
    host developmentand then install liblog4cpp for Arm64, we can no longer
    build for our x86 host and have toreinstall the x86 version, after which
    we can’tbuild for Arm64.

    We had a similar situationfor libyaml-cpp. That was solved by doing
    local CMakebuilds using our local CMAKE_TOOLCHAIN_FILE for Arm64 and
    using the existing apt package.Which would deposit the library in
    /usr/local/lib/aarch64-linux-gnu which would  beused when cross compiling.

    However, applying that solution liblog4cpp the liblog4cpp.awould end up
    in /usr/local/lib. We corrected this with the following patch:

    --- a/CMakeLists.txt2017-07-13 01:39:11.000000000 -0400

    +++ b/CMakeLists.txt2024-08-02 14:02:19.896233224 -0400

    @@ -87,7 +87,7 @@

    INSTALL (

    DIRECTORY include/log4cpp

    -  DESTINATION include

    +  DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}

    PATTERN "config.h" EXCLUDE

    PATTERN ".svn" EXCLUDE

    PATTERN "*.am" EXCLUDE

    @@ -96,5 +96,5 @@

    INSTALL (

    TARGETS ${LOG4CPP_LIBRARY_NAME}

    -  ARCHIVE DESTINATION lib

    +  ARCHIVE

    )

    --- a/CMakeLists.txt2017-07-13 01:39:11.000000000 -0400

    +++ b/CMakeLists.txt2024-08-02 14:02:19.896233224 -0400

    @@ -87,7 +87,7 @@

    INSTALL (

    DIRECTORY include/log4cpp

    -  DESTINATION include

    +  DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}

    PATTERN "config.h" EXCLUDE

    PATTERN ".svn" EXCLUDE

    PATTERN "*.am" EXCLUDE

    @@ -96,5 +96,5 @@

    INSTALL (

    TARGETS ${LOG4CPP_LIBRARY_NAME}

    -  ARCHIVE DESTINATION lib

    +  ARCHIVE

    )

    Which results in the library installed in /usr/local/lib/aarch64-linux-gnu.

    Apparently forthe CMakeINSTALL() function the
    DESTINATIONoptionisn’tneeded when the ARCHIVE option is applied.

     
  • Alexander Perepelkin

    Andrew E Page,

    Thank you for this contribution.

    Could you elaborate a bit more please?
    Could you show what were the installation paths prior the fix (and after them, to compare them easily, and clearly see the clash)? For both x86/Arm64 compilations.

    --
    Alexander

     
    • Andrew E Page

      Andrew E Page - 2024-08-08

      both runs configured for an arm64 toolchain

      root@a8b4e71c175e:/home/andrew/packages/log4cpp/build# make install
      Consolidate compiler generated dependencies of target log4cpp
      [100%] Built target log4cpp
      Install the project...
      -- Install configuration: ""
      -- Installing: /usr/local/include/log4cpp
      -- Installing: /usr/local/include/log4cpp/StringQueueAppender.hh
      ...
      -- Installing: /usr/local/include/log4cpp/BasicConfigurator.hh
      -- Installing: /usr/local/lib/liblog4cpp.a
      root@a8b4e71c175e:/home/andrew/packages/log4cpp/build#

      after patching:

      root@16e345bafce3:/home/andrew/packages/log4cpp/build# make install
      Consolidate compiler generated dependencies of target log4cpp
      [100%] Built target log4cpp
      Install the project...
      -- Install configuration: ""
      -- Installing: /usr/local/include/aarch64-linux-gnu/log4cpp
      -- Installing: /usr/local/include/aarch64-linux-gnu/log4cpp/StringQueueAppender.hh
      ...
      -- Installing: /usr/local/include/aarch64-linux-gnu/log4cpp/BasicConfigurator.hh
      -- Installing: /usr/local/lib/aarch64-linux-gnu/liblog4cpp.a

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.