diff mbox series

[v3,1/1] package/zziplib: fix static build failure with mpd

Message ID 20220320114138.433796-1-br015@umbiko.net
State Accepted
Headers show
Series [v3,1/1] package/zziplib: fix static build failure with mpd | expand

Commit Message

Andreas Ziegler March 20, 2022, 11:41 a.m. UTC
The current released version of zziplib copies static libraries with appended 
major version, but omits creating the necessary links to the base file names. 
This prevents the linker to find the libraries via the search path.

The issue (https://github.com/gdraheim/zziplib/issues/117) has been 
fixed upstream; this patch extracts the necessary part of commit 0e8d35f92efb680c81f6ec1fca9f11d173dce389, to enable creation of symlinks.

This resolves the following autobuild issues:

http://autobuild.buildroot.net/results/6c56b645a2b723920f07b98474452824fba5e2c1
http://autobuild.buildroot.net/results/032aaff121fb114f388c67dbca3ad2b02f670e38
http://autobuild.buildroot.net/results/ba711034c0abe980f677e26de41739223e2f66e9

Signed-off-by: Andreas Ziegler <br015@umbiko.net>
---
Changes v1 -> v2:
 - extract link creation from commit 0e8d35f
Changes v2 -> v3:
 - update failure list

 ...-implant-ZZIP_LIBLATEST-for-zzip_lib.patch | 78 +++++++++++++++++++
 1 file changed, 78 insertions(+)
 create mode 100644 package/zziplib/0001-implant-ZZIP_LIBLATEST-for-zzip_lib.patch

Comments

Arnout Vandecappelle March 27, 2022, 3:57 p.m. UTC | #1
On 20/03/2022 12:41, Andreas Ziegler wrote:
> The current released version of zziplib copies static libraries with appended
> major version, but omits creating the necessary links to the base file names.
> This prevents the linker to find the libraries via the search path.
> 
> The issue (https://github.com/gdraheim/zziplib/issues/117) has been
> fixed upstream; this patch extracts the necessary part of commit 0e8d35f92efb680c81f6ec1fca9f11d173dce389, to enable creation of symlinks.
> 
> This resolves the following autobuild issues:
> 
> http://autobuild.buildroot.net/results/6c56b645a2b723920f07b98474452824fba5e2c1
> http://autobuild.buildroot.net/results/032aaff121fb114f388c67dbca3ad2b02f670e38
> http://autobuild.buildroot.net/results/ba711034c0abe980f677e26de41739223e2f66e9
> 
> Signed-off-by: Andreas Ziegler <br015@umbiko.net>
> ---
> Changes v1 -> v2:
>   - extract link creation from commit 0e8d35f
> Changes v2 -> v3:
>   - update failure list
> 
>   ...-implant-ZZIP_LIBLATEST-for-zzip_lib.patch | 78 +++++++++++++++++++
>   1 file changed, 78 insertions(+)
>   create mode 100644 package/zziplib/0001-implant-ZZIP_LIBLATEST-for-zzip_lib.patch
> 
> diff --git a/package/zziplib/0001-implant-ZZIP_LIBLATEST-for-zzip_lib.patch b/package/zziplib/0001-implant-ZZIP_LIBLATEST-for-zzip_lib.patch
> new file mode 100644
> index 0000000000..50380861bc
> --- /dev/null
> +++ b/package/zziplib/0001-implant-ZZIP_LIBLATEST-for-zzip_lib.patch
> @@ -0,0 +1,78 @@
> +Extract link creation for versioned libraries from commit
> +0e8d35f92efb680c81f6ec1fca9f11d173dce389.
> +
> +Signed-off-by: Andreas Ziegler <br015@umbiko.net>
> +
> +---
> +From 0e8d35f92efb680c81f6ec1fca9f11d173dce389 Mon Sep 17 00:00:00 2001
> +From: Guido Draheim <guidod@gmx.de>
> +Date: Sat, 22 May 2021 15:13:28 +0200
> +Subject: [PATCH] #117 implant ZZIP_LIBLATEST for zzip.lib

  I've moved the part that you added down here, so it stays as a git-formatted 
patch.

[Andreas: Extract link creation for versioned libraries from commit
0e8d35f92efb680c81f6ec1fca9f11d173dce389.]
Signed-off-by: Andreas Ziegler <br015@umbiko.net>


  Applied to master, thanks.

  Regards,
  Arnout


> +
> +---
> + zzip/CMakeLists.txt | 57 +++++++++++++++++++++++++++++++++++----------
> + 1 file changed, 45 insertions(+), 12 deletions(-)
> +
> +diff --git a/zzip/CMakeLists.txt b/zzip/CMakeLists.txt
> +index a966d5f..ccd08b6 100644
> +--- a/zzip/CMakeLists.txt
> ++++ b/zzip/CMakeLists.txt
> +@@ -28,6 +28,12 @@ option(ZZIP_LIBTOOL "Ensure binary compatibility with libtool" OFF)
> + option(ZZIP_PKGCONFIG "Generate pkg-config files for linking" OFF)
> + endif()
> +
> ++if(ZZIP_LIBTOOL OR ZZIP_PKGCONFIG)
> ++option(ZZIP_LIBLATEST "Ensure libname.lib links to libname-REL.lib" ON)
> ++else()
> ++option(ZZIP_LIBLATEST "Ensure libname.lib links to libname-REL.lib" OFF)
> ++endif()
> ++
> + # used in zzip/_config.h
> + set(ZZIP_PACKAGE "${PROJECT_NAME}lib")
> + set(ZZIP_VERSION "${PROJECT_VERSION}")
> +@@ -346,6 +340,45 @@ if(ZZIP_LIBTOOL)
> +   endif(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG)
> + endif(ZZIP_LIBTOOL)
> +
> ++if(ZZIP_LIBLATEST)
> ++  if(BUILD_SHARED_LIBS)
> ++    set(lib ${CMAKE_SHARED_LIBRARY_PREFIX})
> ++    set(dll ${CMAKE_SHARED_LIBRARY_SUFFIX})
> ++  else()
> ++    set(lib ${CMAKE_STATIC_LIBRARY_PREFIX})
> ++    set(dll ${CMAKE_STATIC_LIBRARY_SUFFIX})
> ++  endif()
> ++    get_target_property(libname libzzip OUTPUT_NAME)
> ++    get_target_property(librelease libzzip RELEASE_POSTFIX)
> ++    add_custom_target(libzzip_latest ALL
> ++        COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_NAME:libzzip> ${lib}${libname}${dll}
> ++        )
> ++    install(FILES
> ++        ${outdir}/${lib}${libname}${dll}
> ++        DESTINATION ${CMAKE_INSTALL_LIBDIR})
> ++    if(ZZIPFSEEKO)
> ++    get_target_property(libname libzzipfseeko OUTPUT_NAME)
> ++    get_target_property(librelease libzzipfseeko RELEASE_POSTFIX)
> ++    add_custom_target(libzzipfseeko_latest ALL
> ++        COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_NAME:libzzipfseeko> ${lib}${libname}${dll}
> ++        )
> ++    install(FILES
> ++        ${outdir}/${lib}${libname}${dll}
> ++        DESTINATION ${CMAKE_INSTALL_LIBDIR})
> ++    endif(ZZIPFSEEKO)
> ++    if(ZZIPMMAPPED)
> ++    get_target_property(libname libzzipmmapped OUTPUT_NAME)
> ++    get_target_property(librelease libzzipmmapped RELEASE_POSTFIX)
> ++    add_custom_target(libzzipmmaped_latest ALL
> ++        COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_NAME:libzzipmmapped> ${lib}${libname}${dll}
> ++        )
> ++    install(FILES
> ++        ${outdir}/${lib}${libname}${dll}
> ++        DESTINATION ${CMAKE_INSTALL_LIBDIR})
> ++    endif(ZZIPMMAPPED)
> ++endif(ZZIP_LIBLATEST)
> ++
> ++
> + ## messages ##############################################
> +
> + message(STATUS "lib zzipfseeko  to be compiled: ${ZZIPFSEEKO}")
Peter Korsgaard March 30, 2022, 7:43 p.m. UTC | #2
>>>>> "Andreas" == Andreas Ziegler <br015@umbiko.net> writes:

 > The current released version of zziplib copies static libraries with appended 
 > major version, but omits creating the necessary links to the base file names. 
 > This prevents the linker to find the libraries via the search path.

 > The issue (https://github.com/gdraheim/zziplib/issues/117) has been 
 > fixed upstream; this patch extracts the necessary part of commit
 > 0e8d35f92efb680c81f6ec1fca9f11d173dce389, to enable creation of
 > symlinks.

 > This resolves the following autobuild issues:

 > http://autobuild.buildroot.net/results/6c56b645a2b723920f07b98474452824fba5e2c1
 > http://autobuild.buildroot.net/results/032aaff121fb114f388c67dbca3ad2b02f670e38
 > http://autobuild.buildroot.net/results/ba711034c0abe980f677e26de41739223e2f66e9

 > Signed-off-by: Andreas Ziegler <br015@umbiko.net>
 > ---
 > Changes v1 -> v2:
 >  - extract link creation from commit 0e8d35f
 > Changes v2 -> v3:
 >  - update failure list

Committed to 2021.02.x and 2022.02.x, thanks.
Arnout Vandecappelle July 25, 2022, 8:49 p.m. UTC | #3
Hi Andreas,

On 20/03/2022 12:41, Andreas Ziegler wrote:
> The current released version of zziplib copies static libraries with appended
> major version, but omits creating the necessary links to the base file names.
> This prevents the linker to find the libraries via the search path.
> 
> The issue (https://github.com/gdraheim/zziplib/issues/117) has been
> fixed upstream; this patch extracts the necessary part of commit 0e8d35f92efb680c81f6ec1fca9f11d173dce389, to enable creation of symlinks.
> 
> This resolves the following autobuild issues:
> 
> http://autobuild.buildroot.net/results/6c56b645a2b723920f07b98474452824fba5e2c1
> http://autobuild.buildroot.net/results/032aaff121fb114f388c67dbca3ad2b02f670e38
> http://autobuild.buildroot.net/results/ba711034c0abe980f677e26de41739223e2f66e9
> 
> Signed-off-by: Andreas Ziegler <br015@umbiko.net>

  Since this patch was merged, we have failures [1] like:

[ 37%] Building C object zzipwrap/CMakeFiles/zzipwrap.dir/zzipwrap.c.o
make[3]: stat: zzip/libzzip.a: Too many levels of symbolic links
make[3]: *** No rule to make target 'zzip/libzzip.a', needed by 
'zzipwrap/zzipwrap'.  Stop.

  Since this is about symlinks, it might be related to this patch. Could you 
have a look?

  Regards,
  Arnout

[1] 
http://autobuild.buildroot.net/results/743/7433a2ad111e2f014c81f196d3d1e2f63dffa858/



> ---
> Changes v1 -> v2:
>   - extract link creation from commit 0e8d35f
> Changes v2 -> v3:
>   - update failure list
> 
>   ...-implant-ZZIP_LIBLATEST-for-zzip_lib.patch | 78 +++++++++++++++++++
>   1 file changed, 78 insertions(+)
>   create mode 100644 package/zziplib/0001-implant-ZZIP_LIBLATEST-for-zzip_lib.patch
> 
> diff --git a/package/zziplib/0001-implant-ZZIP_LIBLATEST-for-zzip_lib.patch b/package/zziplib/0001-implant-ZZIP_LIBLATEST-for-zzip_lib.patch
> new file mode 100644
> index 0000000000..50380861bc
> --- /dev/null
> +++ b/package/zziplib/0001-implant-ZZIP_LIBLATEST-for-zzip_lib.patch
> @@ -0,0 +1,78 @@
> +Extract link creation for versioned libraries from commit
> +0e8d35f92efb680c81f6ec1fca9f11d173dce389.
> +
> +Signed-off-by: Andreas Ziegler <br015@umbiko.net>
> +
> +---
> +From 0e8d35f92efb680c81f6ec1fca9f11d173dce389 Mon Sep 17 00:00:00 2001
> +From: Guido Draheim <guidod@gmx.de>
> +Date: Sat, 22 May 2021 15:13:28 +0200
> +Subject: [PATCH] #117 implant ZZIP_LIBLATEST for zzip.lib
> +
> +---
> + zzip/CMakeLists.txt | 57 +++++++++++++++++++++++++++++++++++----------
> + 1 file changed, 45 insertions(+), 12 deletions(-)
> +
> +diff --git a/zzip/CMakeLists.txt b/zzip/CMakeLists.txt
> +index a966d5f..ccd08b6 100644
> +--- a/zzip/CMakeLists.txt
> ++++ b/zzip/CMakeLists.txt
> +@@ -28,6 +28,12 @@ option(ZZIP_LIBTOOL "Ensure binary compatibility with libtool" OFF)
> + option(ZZIP_PKGCONFIG "Generate pkg-config files for linking" OFF)
> + endif()
> +
> ++if(ZZIP_LIBTOOL OR ZZIP_PKGCONFIG)
> ++option(ZZIP_LIBLATEST "Ensure libname.lib links to libname-REL.lib" ON)
> ++else()
> ++option(ZZIP_LIBLATEST "Ensure libname.lib links to libname-REL.lib" OFF)
> ++endif()
> ++
> + # used in zzip/_config.h
> + set(ZZIP_PACKAGE "${PROJECT_NAME}lib")
> + set(ZZIP_VERSION "${PROJECT_VERSION}")
> +@@ -346,6 +340,45 @@ if(ZZIP_LIBTOOL)
> +   endif(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG)
> + endif(ZZIP_LIBTOOL)
> +
> ++if(ZZIP_LIBLATEST)
> ++  if(BUILD_SHARED_LIBS)
> ++    set(lib ${CMAKE_SHARED_LIBRARY_PREFIX})
> ++    set(dll ${CMAKE_SHARED_LIBRARY_SUFFIX})
> ++  else()
> ++    set(lib ${CMAKE_STATIC_LIBRARY_PREFIX})
> ++    set(dll ${CMAKE_STATIC_LIBRARY_SUFFIX})
> ++  endif()
> ++    get_target_property(libname libzzip OUTPUT_NAME)
> ++    get_target_property(librelease libzzip RELEASE_POSTFIX)
> ++    add_custom_target(libzzip_latest ALL
> ++        COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_NAME:libzzip> ${lib}${libname}${dll}
> ++        )
> ++    install(FILES
> ++        ${outdir}/${lib}${libname}${dll}
> ++        DESTINATION ${CMAKE_INSTALL_LIBDIR})
> ++    if(ZZIPFSEEKO)
> ++    get_target_property(libname libzzipfseeko OUTPUT_NAME)
> ++    get_target_property(librelease libzzipfseeko RELEASE_POSTFIX)
> ++    add_custom_target(libzzipfseeko_latest ALL
> ++        COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_NAME:libzzipfseeko> ${lib}${libname}${dll}
> ++        )
> ++    install(FILES
> ++        ${outdir}/${lib}${libname}${dll}
> ++        DESTINATION ${CMAKE_INSTALL_LIBDIR})
> ++    endif(ZZIPFSEEKO)
> ++    if(ZZIPMMAPPED)
> ++    get_target_property(libname libzzipmmapped OUTPUT_NAME)
> ++    get_target_property(librelease libzzipmmapped RELEASE_POSTFIX)
> ++    add_custom_target(libzzipmmaped_latest ALL
> ++        COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_NAME:libzzipmmapped> ${lib}${libname}${dll}
> ++        )
> ++    install(FILES
> ++        ${outdir}/${lib}${libname}${dll}
> ++        DESTINATION ${CMAKE_INSTALL_LIBDIR})
> ++    endif(ZZIPMMAPPED)
> ++endif(ZZIP_LIBLATEST)
> ++
> ++
> + ## messages ##############################################
> +
> + message(STATUS "lib zzipfseeko  to be compiled: ${ZZIPFSEEKO}")
Andreas Ziegler July 26, 2022, 6:24 a.m. UTC | #4
Hi Arnout,

On 2022-07-25 20:49, Arnout Vandecappelle wrote:
> Hi Andreas,
> 
> On 20/03/2022 12:41, Andreas Ziegler wrote:
>> The current released version of zziplib copies static libraries with 
>> appended
>> major version, but omits creating the necessary links to the base file 
>> names.
>> This prevents the linker to find the libraries via the search path.
>> 
>> The issue (https://github.com/gdraheim/zziplib/issues/117) has been
>> fixed upstream; this patch extracts the necessary part of commit 
>> 0e8d35f92efb680c81f6ec1fca9f11d173dce389, to enable creation of 
>> symlinks.
>> 
>> This resolves the following autobuild issues:
>> 
>> http://autobuild.buildroot.net/results/6c56b645a2b723920f07b98474452824fba5e2c1
>> http://autobuild.buildroot.net/results/032aaff121fb114f388c67dbca3ad2b02f670e38
>> http://autobuild.buildroot.net/results/ba711034c0abe980f677e26de41739223e2f66e9
>> 
>> Signed-off-by: Andreas Ziegler <br015@umbiko.net>
> 
>  Since this patch was merged, we have failures [1] like:
> 
> [ 37%] Building C object zzipwrap/CMakeFiles/zzipwrap.dir/zzipwrap.c.o
> make[3]: stat: zzip/libzzip.a: Too many levels of symbolic links
> make[3]: *** No rule to make target 'zzip/libzzip.a', needed by
> 'zzipwrap/zzipwrap'.  Stop.
> 
>  Since this is about symlinks, it might be related to this patch.
> Could you have a look?
> 

This build [1] creates recursive links for two libraries:

$ ls -l zzip/*.a
-rw-r--r-- 1 iago iago 173008 Jul 26 07:26 zzip/libzzip.a
lrwxrwxrwx 1 iago iago     15 Jul 26 07:26 zzip/libzzipfseeko.a -> 
libzzipfseeko.a
lrwxrwxrwx 1 iago iago     16 Jul 26 07:26 zzip/libzzipmmapped.a -> 
libzzipmmapped.a

Removing the patch lets the build complete successfully.

I will have a look.

Kind regards,
Andreas

>  Regards,
>  Arnout
> 
> [1] 
> http://autobuild.buildroot.net/results/743/7433a2ad111e2f014c81f196d3d1e2f63dffa858/
> 
> 
> 
>> ---
>> Changes v1 -> v2:
>>   - extract link creation from commit 0e8d35f
>> Changes v2 -> v3:
>>   - update failure list
>> 
>>   ...-implant-ZZIP_LIBLATEST-for-zzip_lib.patch | 78 
>> +++++++++++++++++++
>>   1 file changed, 78 insertions(+)
>>   create mode 100644 
>> package/zziplib/0001-implant-ZZIP_LIBLATEST-for-zzip_lib.patch
>> 
>> diff --git 
>> a/package/zziplib/0001-implant-ZZIP_LIBLATEST-for-zzip_lib.patch 
>> b/package/zziplib/0001-implant-ZZIP_LIBLATEST-for-zzip_lib.patch
>> new file mode 100644
>> index 0000000000..50380861bc
>> --- /dev/null
>> +++ b/package/zziplib/0001-implant-ZZIP_LIBLATEST-for-zzip_lib.patch
>> @@ -0,0 +1,78 @@
>> +Extract link creation for versioned libraries from commit
>> +0e8d35f92efb680c81f6ec1fca9f11d173dce389.
>> +
>> +Signed-off-by: Andreas Ziegler <br015@umbiko.net>
>> +
>> +---
>> +From 0e8d35f92efb680c81f6ec1fca9f11d173dce389 Mon Sep 17 00:00:00 
>> 2001
>> +From: Guido Draheim <guidod@gmx.de>
>> +Date: Sat, 22 May 2021 15:13:28 +0200
>> +Subject: [PATCH] #117 implant ZZIP_LIBLATEST for zzip.lib
>> +
>> +---
>> + zzip/CMakeLists.txt | 57 
>> +++++++++++++++++++++++++++++++++++----------
>> + 1 file changed, 45 insertions(+), 12 deletions(-)
>> +
>> +diff --git a/zzip/CMakeLists.txt b/zzip/CMakeLists.txt
>> +index a966d5f..ccd08b6 100644
>> +--- a/zzip/CMakeLists.txt
>> ++++ b/zzip/CMakeLists.txt
>> +@@ -28,6 +28,12 @@ option(ZZIP_LIBTOOL "Ensure binary compatibility 
>> with libtool" OFF)
>> + option(ZZIP_PKGCONFIG "Generate pkg-config files for linking" OFF)
>> + endif()
>> +
>> ++if(ZZIP_LIBTOOL OR ZZIP_PKGCONFIG)
>> ++option(ZZIP_LIBLATEST "Ensure libname.lib links to libname-REL.lib" 
>> ON)
>> ++else()
>> ++option(ZZIP_LIBLATEST "Ensure libname.lib links to libname-REL.lib" 
>> OFF)
>> ++endif()
>> ++
>> + # used in zzip/_config.h
>> + set(ZZIP_PACKAGE "${PROJECT_NAME}lib")
>> + set(ZZIP_VERSION "${PROJECT_VERSION}")
>> +@@ -346,6 +340,45 @@ if(ZZIP_LIBTOOL)
>> +   endif(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG)
>> + endif(ZZIP_LIBTOOL)
>> +
>> ++if(ZZIP_LIBLATEST)
>> ++  if(BUILD_SHARED_LIBS)
>> ++    set(lib ${CMAKE_SHARED_LIBRARY_PREFIX})
>> ++    set(dll ${CMAKE_SHARED_LIBRARY_SUFFIX})
>> ++  else()
>> ++    set(lib ${CMAKE_STATIC_LIBRARY_PREFIX})
>> ++    set(dll ${CMAKE_STATIC_LIBRARY_SUFFIX})
>> ++  endif()
>> ++    get_target_property(libname libzzip OUTPUT_NAME)
>> ++    get_target_property(librelease libzzip RELEASE_POSTFIX)
>> ++    add_custom_target(libzzip_latest ALL
>> ++        COMMAND ${CMAKE_COMMAND} -E create_symlink 
>> $<TARGET_FILE_NAME:libzzip> ${lib}${libname}${dll}
>> ++        )
>> ++    install(FILES
>> ++        ${outdir}/${lib}${libname}${dll}
>> ++        DESTINATION ${CMAKE_INSTALL_LIBDIR})
>> ++    if(ZZIPFSEEKO)
>> ++    get_target_property(libname libzzipfseeko OUTPUT_NAME)
>> ++    get_target_property(librelease libzzipfseeko RELEASE_POSTFIX)
>> ++    add_custom_target(libzzipfseeko_latest ALL
>> ++        COMMAND ${CMAKE_COMMAND} -E create_symlink 
>> $<TARGET_FILE_NAME:libzzipfseeko> ${lib}${libname}${dll}
>> ++        )
>> ++    install(FILES
>> ++        ${outdir}/${lib}${libname}${dll}
>> ++        DESTINATION ${CMAKE_INSTALL_LIBDIR})
>> ++    endif(ZZIPFSEEKO)
>> ++    if(ZZIPMMAPPED)
>> ++    get_target_property(libname libzzipmmapped OUTPUT_NAME)
>> ++    get_target_property(librelease libzzipmmapped RELEASE_POSTFIX)
>> ++    add_custom_target(libzzipmmaped_latest ALL
>> ++        COMMAND ${CMAKE_COMMAND} -E create_symlink 
>> $<TARGET_FILE_NAME:libzzipmmapped> ${lib}${libname}${dll}
>> ++        )
>> ++    install(FILES
>> ++        ${outdir}/${lib}${libname}${dll}
>> ++        DESTINATION ${CMAKE_INSTALL_LIBDIR})
>> ++    endif(ZZIPMMAPPED)
>> ++endif(ZZIP_LIBLATEST)
>> ++
>> ++
>> + ## messages ##############################################
>> +
>> + message(STATUS "lib zzipfseeko  to be compiled: ${ZZIPFSEEKO}")
Andreas Ziegler July 28, 2022, 2:36 p.m. UTC | #5
[added Fabrice, he is aware of this issue]

Hi Arnout, all

Analysis /result inline, I now need to test this fix with the known 
defects [2][3][4]

An additional column "debug?" in the autobuild results might be useful.

Kind regards,
Andreas

[2] http://autobuild.buildroot.net/?reason=mpd-0.23.3
[3] http://autobuild.buildroot.net/?reason=mpd-0.23.5
[4] http://autobuild.buildroot.net/?reason=zziplib-0.13.72


On 2022-07-25 20:49, Arnout Vandecappelle wrote:
> Hi Andreas,
> 
> On 20/03/2022 12:41, Andreas Ziegler wrote:
>> The current released version of zziplib copies static libraries with 
>> appended
>> major version, but omits creating the necessary links to the base file 
>> names.
>> This prevents the linker to find the libraries via the search path.
>> 
>> The issue (https://github.com/gdraheim/zziplib/issues/117) has been
>> fixed upstream; this patch extracts the necessary part of commit 
>> 0e8d35f92efb680c81f6ec1fca9f11d173dce389, to enable creation of 
>> symlinks.
>> 
>> This resolves the following autobuild issues:
>> 
>> http://autobuild.buildroot.net/results/6c56b645a2b723920f07b98474452824fba5e2c1
>> http://autobuild.buildroot.net/results/032aaff121fb114f388c67dbca3ad2b02f670e38
>> http://autobuild.buildroot.net/results/ba711034c0abe980f677e26de41739223e2f66e9
>> 
>> Signed-off-by: Andreas Ziegler <br015@umbiko.net>
> 
>  Since this patch was merged, we have failures [1] like:
> 
> [ 37%] Building C object zzipwrap/CMakeFiles/zzipwrap.dir/zzipwrap.c.o
> make[3]: stat: zzip/libzzip.a: Too many levels of symbolic links
> make[3]: *** No rule to make target 'zzip/libzzip.a', needed by
> 'zzipwrap/zzipwrap'.  Stop.
> 
>  Since this is about symlinks, it might be related to this patch.
> Could you have a look?
> 
>  Regards,
>  Arnout

ANALYSIS

zziplib normally uses a version number (major version only) when 
building libraries; zziplib version 0.13.72 omits creating the usual 
links from versioned file names to the base name, which created 
autobuild errors for downstream components in the past.

Porting part of the CMake code present in the latest version of the 
zziplib repository solved this problem, but creates another one whenever 
versioning is not employed, since zzip/CMakeLists.txt does not handle 
this case properly: existing libraries are overwritten with a recursive 
link.

The mechanism used in zzip/CMakeLists.txt is identical for all libraries 
and implemented like this:

if(ZZIP_LIBLATEST)

	...

	get_target_property(libname libzzip OUTPUT_NAME)
	get_target_property(librelease libzzip RELEASE_POSTFIX)
	add_custom_target(libzzip_latest ALL
		COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_NAME:libzzip> 
${lib}${libname}${dll}
		)
	install(FILES
		${outdir}/${lib}${libname}${dll}
		DESTINATION ${CMAKE_INSTALL_LIBDIR})

	...

endif(ZZIP_LIBLATEST)

The librelease variable is never used. $<TARGET_FILE_NAME:libzzip*> 
contains either a versioned or an unversioned file name (depending on 
RELEASE_POSTFIX being used by CMake). The link creation is handled by an 
unconditional cmake target that is executed regardless of the target 
file presence. Since both arguments to the create_symlink command may be 
identical, this can result in a recursive symlink overwriting the 
original file.


ROOT CAUSE:

CMAKE_BUILD_TYPE was set to Debug:

>>> zziplib 0.13.72 Installing to staging directory
PATH="/home/data/test/autobuild/host/bin:/home/data/test/autobuild/host/sbin:/home/iago/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" 
  /usr/bin/make -j5  
DESTDIR=/home/data/test/autobuild/host/microblaze-buildroot-linux-uclibc/sysroot 
install/fast -C /home/data/test/autobuild/build/zziplib-0.13.72/
Install the project...
-- Install configuration: "Debug"

zziplib settings are only complete for release builds, therefore, for 
example the version info is missing from the library files.

> 
> [1] 
> http://autobuild.buildroot.net/results/743/7433a2ad111e2f014c81f196d3d1e2f63dffa858/
> 
> 
> 
>> ---
>> Changes v1 -> v2:
>>   - extract link creation from commit 0e8d35f
>> Changes v2 -> v3:
>>   - update failure list
>> 
>>   ...-implant-ZZIP_LIBLATEST-for-zzip_lib.patch | 78 
>> +++++++++++++++++++
>>   1 file changed, 78 insertions(+)
>>   create mode 100644 
>> package/zziplib/0001-implant-ZZIP_LIBLATEST-for-zzip_lib.patch
>> 
>> diff --git 
>> a/package/zziplib/0001-implant-ZZIP_LIBLATEST-for-zzip_lib.patch 
>> b/package/zziplib/0001-implant-ZZIP_LIBLATEST-for-zzip_lib.patch
>> new file mode 100644
>> index 0000000000..50380861bc
>> --- /dev/null
>> +++ b/package/zziplib/0001-implant-ZZIP_LIBLATEST-for-zzip_lib.patch
>> @@ -0,0 +1,78 @@
>> +Extract link creation for versioned libraries from commit
>> +0e8d35f92efb680c81f6ec1fca9f11d173dce389.
>> +
>> +Signed-off-by: Andreas Ziegler <br015@umbiko.net>
>> +
>> +---
>> +From 0e8d35f92efb680c81f6ec1fca9f11d173dce389 Mon Sep 17 00:00:00 
>> 2001
>> +From: Guido Draheim <guidod@gmx.de>
>> +Date: Sat, 22 May 2021 15:13:28 +0200
>> +Subject: [PATCH] #117 implant ZZIP_LIBLATEST for zzip.lib
>> +
>> +---
>> + zzip/CMakeLists.txt | 57 
>> +++++++++++++++++++++++++++++++++++----------
>> + 1 file changed, 45 insertions(+), 12 deletions(-)
>> +
>> +diff --git a/zzip/CMakeLists.txt b/zzip/CMakeLists.txt
>> +index a966d5f..ccd08b6 100644
>> +--- a/zzip/CMakeLists.txt
>> ++++ b/zzip/CMakeLists.txt
>> +@@ -28,6 +28,12 @@ option(ZZIP_LIBTOOL "Ensure binary compatibility 
>> with libtool" OFF)
>> + option(ZZIP_PKGCONFIG "Generate pkg-config files for linking" OFF)
>> + endif()
>> +
>> ++if(ZZIP_LIBTOOL OR ZZIP_PKGCONFIG)
>> ++option(ZZIP_LIBLATEST "Ensure libname.lib links to libname-REL.lib" 
>> ON)
>> ++else()
>> ++option(ZZIP_LIBLATEST "Ensure libname.lib links to libname-REL.lib" 
>> OFF)
>> ++endif()
>> ++
>> + # used in zzip/_config.h
>> + set(ZZIP_PACKAGE "${PROJECT_NAME}lib")
>> + set(ZZIP_VERSION "${PROJECT_VERSION}")
>> +@@ -346,6 +340,45 @@ if(ZZIP_LIBTOOL)
>> +   endif(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG)
>> + endif(ZZIP_LIBTOOL)
>> +
>> ++if(ZZIP_LIBLATEST)
>> ++  if(BUILD_SHARED_LIBS)
>> ++    set(lib ${CMAKE_SHARED_LIBRARY_PREFIX})
>> ++    set(dll ${CMAKE_SHARED_LIBRARY_SUFFIX})
>> ++  else()
>> ++    set(lib ${CMAKE_STATIC_LIBRARY_PREFIX})
>> ++    set(dll ${CMAKE_STATIC_LIBRARY_SUFFIX})
>> ++  endif()
>> ++    get_target_property(libname libzzip OUTPUT_NAME)
>> ++    get_target_property(librelease libzzip RELEASE_POSTFIX)
>> ++    add_custom_target(libzzip_latest ALL
>> ++        COMMAND ${CMAKE_COMMAND} -E create_symlink 
>> $<TARGET_FILE_NAME:libzzip> ${lib}${libname}${dll}
>> ++        )
>> ++    install(FILES
>> ++        ${outdir}/${lib}${libname}${dll}
>> ++        DESTINATION ${CMAKE_INSTALL_LIBDIR})
>> ++    if(ZZIPFSEEKO)
>> ++    get_target_property(libname libzzipfseeko OUTPUT_NAME)
>> ++    get_target_property(librelease libzzipfseeko RELEASE_POSTFIX)

Using a conditional CMake target ensures that existing files will not be 
overwritten:

	set(libzzip_target "${outdir}/${lib}${libname}${dll}")
	add_custom_target(libzzip_latest ${libzzip_target}

>> ++    add_custom_target(libzzipfseeko_latest ALL
>> ++        COMMAND ${CMAKE_COMMAND} -E create_symlink 
>> $<TARGET_FILE_NAME:libzzipfseeko> ${lib}${libname}${dll}
>> ++        )
>> ++    install(FILES
>> ++        ${outdir}/${lib}${libname}${dll}
>> ++        DESTINATION ${CMAKE_INSTALL_LIBDIR})
>> ++    endif(ZZIPFSEEKO)
>> ++    if(ZZIPMMAPPED)
>> ++    get_target_property(libname libzzipmmapped OUTPUT_NAME)
>> ++    get_target_property(librelease libzzipmmapped RELEASE_POSTFIX)
>> ++    add_custom_target(libzzipmmaped_latest ALL
>> ++        COMMAND ${CMAKE_COMMAND} -E create_symlink 
>> $<TARGET_FILE_NAME:libzzipmmapped> ${lib}${libname}${dll}
>> ++        )
>> ++    install(FILES
>> ++        ${outdir}/${lib}${libname}${dll}
>> ++        DESTINATION ${CMAKE_INSTALL_LIBDIR})
>> ++    endif(ZZIPMMAPPED)
>> ++endif(ZZIP_LIBLATEST)
>> ++
>> ++
>> + ## messages ##############################################
>> +
>> + message(STATUS "lib zzipfseeko  to be compiled: ${ZZIPFSEEKO}")
diff mbox series

Patch

diff --git a/package/zziplib/0001-implant-ZZIP_LIBLATEST-for-zzip_lib.patch b/package/zziplib/0001-implant-ZZIP_LIBLATEST-for-zzip_lib.patch
new file mode 100644
index 0000000000..50380861bc
--- /dev/null
+++ b/package/zziplib/0001-implant-ZZIP_LIBLATEST-for-zzip_lib.patch
@@ -0,0 +1,78 @@ 
+Extract link creation for versioned libraries from commit
+0e8d35f92efb680c81f6ec1fca9f11d173dce389.
+
+Signed-off-by: Andreas Ziegler <br015@umbiko.net>
+
+---
+From 0e8d35f92efb680c81f6ec1fca9f11d173dce389 Mon Sep 17 00:00:00 2001
+From: Guido Draheim <guidod@gmx.de>
+Date: Sat, 22 May 2021 15:13:28 +0200
+Subject: [PATCH] #117 implant ZZIP_LIBLATEST for zzip.lib
+
+---
+ zzip/CMakeLists.txt | 57 +++++++++++++++++++++++++++++++++++----------
+ 1 file changed, 45 insertions(+), 12 deletions(-)
+
+diff --git a/zzip/CMakeLists.txt b/zzip/CMakeLists.txt
+index a966d5f..ccd08b6 100644
+--- a/zzip/CMakeLists.txt
++++ b/zzip/CMakeLists.txt
+@@ -28,6 +28,12 @@ option(ZZIP_LIBTOOL "Ensure binary compatibility with libtool" OFF)
+ option(ZZIP_PKGCONFIG "Generate pkg-config files for linking" OFF)
+ endif()
+ 
++if(ZZIP_LIBTOOL OR ZZIP_PKGCONFIG)
++option(ZZIP_LIBLATEST "Ensure libname.lib links to libname-REL.lib" ON)
++else()
++option(ZZIP_LIBLATEST "Ensure libname.lib links to libname-REL.lib" OFF)
++endif()
++
+ # used in zzip/_config.h
+ set(ZZIP_PACKAGE "${PROJECT_NAME}lib")
+ set(ZZIP_VERSION "${PROJECT_VERSION}")
+@@ -346,6 +340,45 @@ if(ZZIP_LIBTOOL)
+   endif(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG)
+ endif(ZZIP_LIBTOOL)
+ 
++if(ZZIP_LIBLATEST)
++  if(BUILD_SHARED_LIBS)
++    set(lib ${CMAKE_SHARED_LIBRARY_PREFIX})
++    set(dll ${CMAKE_SHARED_LIBRARY_SUFFIX})
++  else()
++    set(lib ${CMAKE_STATIC_LIBRARY_PREFIX})
++    set(dll ${CMAKE_STATIC_LIBRARY_SUFFIX})
++  endif()
++    get_target_property(libname libzzip OUTPUT_NAME)
++    get_target_property(librelease libzzip RELEASE_POSTFIX)
++    add_custom_target(libzzip_latest ALL
++        COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_NAME:libzzip> ${lib}${libname}${dll}
++        )
++    install(FILES
++        ${outdir}/${lib}${libname}${dll}
++        DESTINATION ${CMAKE_INSTALL_LIBDIR})
++    if(ZZIPFSEEKO)
++    get_target_property(libname libzzipfseeko OUTPUT_NAME)
++    get_target_property(librelease libzzipfseeko RELEASE_POSTFIX)
++    add_custom_target(libzzipfseeko_latest ALL
++        COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_NAME:libzzipfseeko> ${lib}${libname}${dll}
++        )
++    install(FILES
++        ${outdir}/${lib}${libname}${dll}
++        DESTINATION ${CMAKE_INSTALL_LIBDIR})
++    endif(ZZIPFSEEKO)
++    if(ZZIPMMAPPED)
++    get_target_property(libname libzzipmmapped OUTPUT_NAME)
++    get_target_property(librelease libzzipmmapped RELEASE_POSTFIX)
++    add_custom_target(libzzipmmaped_latest ALL
++        COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_NAME:libzzipmmapped> ${lib}${libname}${dll}
++        )
++    install(FILES
++        ${outdir}/${lib}${libname}${dll}
++        DESTINATION ${CMAKE_INSTALL_LIBDIR})
++    endif(ZZIPMMAPPED)
++endif(ZZIP_LIBLATEST)
++
++
+ ## messages ##############################################
+ 
+ message(STATUS "lib zzipfseeko  to be compiled: ${ZZIPFSEEKO}")