Skip to contentSkip to conversation

package/wireshark: fix static build with brotli

PATCH New Fabrice Fontaine 3 participants 3 messages Jan 3, 2020 – Jan 10, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/wireshark: fix static build with brotli

Fixes:
- http://autobuild.buildroot.org/results/2387d4590c5dce73d5f6d72bccf253e79f9a73d8

---
Changes v1 -> v2 (after review of Thomas Petazzoni):
- Drop CMAKE_FIND_LIBRARY_SUFFIXES STREQUAL ".a" from patch

 ...-FindBROTLI.cmake-fix-static-linking.patch | 54 +++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 package/wireshark/0002-FindBROTLI.cmake-fix-static-linking.patch
package/wireshark/0002-FindBROTLI.cmake-fix-static-linking.patch new file +54 -0
new file mode 100644
index 0000000000..1300a65167
@@ -0,0 +1,54 @@
+From e1d88b868f57d79a3e90af34f3961f56172998ba Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <[email protected]>
+Date: Fri, 3 Jan 2020 10:47:30 +0100
+Subject: [PATCH 2/2] FindBROTLI.cmake: fix static linking
+
+Use pkg-config to retrieve dependencies of libbrotlidec such as
+libbrotlicommon otherwise static build will fail on:
+
+[100%] Building C object CMakeFiles/tshark.dir/ui/cli/tap-smbsids.c.o
+/home/buildroot/autobuild/instance-1/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/8.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: /home/buildroot/autobuild/instance-1/output-1/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libbrotlidec.a(decode.c.o): in function `ProcessCommands':
+decode.c:(.text+0x36d0): undefined reference to `BrotliTransformDictionaryWord'
+/home/buildroot/autobuild/instance-1/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/8.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: /home/buildroot/autobuild/instance-1/output-1/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libbrotlidec.a(decode.c.o): in function `SafeProcessCommands':
+decode.c:(.text+0x418c): undefined reference to `BrotliTransformDictionaryWord'
+/home/buildroot/autobuild/instance-1/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/8.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: /home/buildroot/autobuild/instance-1/output-1/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libbrotlidec.a(state.c.o): in function `BrotliDecoderStateInit':
+state.c:(.text+0x120): undefined reference to `BrotliGetDictionary'
+/home/buildroot/autobuild/instance-1/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/8.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: state.c:(.text+0x128): undefined reference to `BrotliGetTransforms'
+
+Fixes:
+ - http://autobuild.buildroot.org/results/2387d4590c5dce73d5f6d72bccf253e79f9a73d8
+
+Signed-off-by: Fabrice Fontaine <[email protected]>
+[Upstream status: Not sent yet (waiting for feedback on first patch)]
+---
+ cmake/modules/FindBROTLI.cmake | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/cmake/modules/FindBROTLI.cmake b/cmake/modules/FindBROTLI.cmake
+index 4ab8dbb41c..687afd6e5e 100644
+--- a/cmake/modules/FindBROTLI.cmake
++++ b/cmake/modules/FindBROTLI.cmake
+@@ -11,6 +11,9 @@
+ include( FindWSWinLibs )
+ FindWSWinLibs( "brotli-.*" "BROTLI_HINTS" )
+ 
++find_package(PkgConfig QUIET)
++PKG_CHECK_MODULES(PC_BROTLI QUIET libbrotlidec)
++
+ find_path(BROTLI_INCLUDE_DIR
+   NAMES "brotli/decode.h"
+   HINTS "${BROTLI_HINTS}/include"
+@@ -28,6 +31,10 @@ if( BROTLI_FOUND )
+   set( BROTLI_INCLUDE_DIRS ${BROTLI_INCLUDE_DIR} )
+   set( BROTLI_LIBRARIES ${BROTLIDEC_LIBRARY} )
+ 
++  if(UNIX)
++    list(APPEND BROTLI_LIBRARIES ${PC_BROTLI_LIBRARIES})
++  endif()
++
+   if (WIN32)
+     set ( BROTLI_DLL_DIR "${BROTLI_HINTS}/bin"
+       CACHE PATH "Path to the brotli DLLs"
+-- 
+2.24.0
+
Signature · 1 line
2.24.0
#1 lore raw

PATCH v2 1/1 package/wireshark: fix static build with brotli

Hello Fabrice,

Thanks for your new iteration!

package/wireshark/0002-FindBROTLI.cmake-fix-static-linking.patch line 47

Quoted 13 lines · On Fri, 3 Jan 2020 14:48:21 +0100 Fabrice Fontaine…

++find_package(PkgConfig QUIET)
++PKG_CHECK_MODULES(PC_BROTLI QUIET libbrotlidec)
++
+ find_path(BROTLI_INCLUDE_DIR

package/wireshark/0002-FindBROTLI.cmake-fix-static-linking.patch new file +9 -0
+   NAMES "brotli/decode.h"
+   HINTS "${BROTLI_HINTS}/include"
+@@ -28,6 +31,10 @@ if( BROTLI_FOUND )
+   set( BROTLI_INCLUDE_DIRS ${BROTLI_INCLUDE_DIR} )
+   set( BROTLI_LIBRARIES ${BROTLIDEC_LIBRARY} )
+ 
++  if(UNIX)
++    list(APPEND BROTLI_LIBRARIES ${PC_BROTLI_LIBRARIES})
++  endif()

I'm not sure the UNIX condition is needed.

Also, if pkg-config is available, I guess you could simply set BROTLI_INCLUDE_DIRS and BROTLI_LIBRARIES from the results given by pkg-config.

Ah, but looking at cmake/modules/FindLibXml2.cmake, I see that this is where you took the:

# Include transitive dependencies for static linking. if(UNIX AND CMAKE_FIND_LIBRARY_SUFFIXES STREQUAL ".a")
list(APPEND LIBXML2_LIBRARIES ${PC_LIBXML_LIBRARIES})
endif()

logic.

So, I'm not sure what Wireshark upstream wants to do. It's probably best to work with them directly.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH v2 1/1 package/wireshark: fix static build with brotli

In reply to Fabrice Fontaine

Fabrice, All,

On 2020-01-03 14:48 +0100, Fabrice Fontaine spake thusly:

Quoted 4 lines

Fixes:
- http://autobuild.buildroot.org/results/2387d4590c5dce73d5f6d72bccf253e79f9a73d8

Since wireshark now depends on dynamic libraries, this build failure with static brotli should no longer be a concern, right?

Patch marked as "not applicable" now.

Thanks again for looking at all such mess...

Regards,
Yann E. MORIN.

Quoted 75 lines

---
Changes v1 -> v2 (after review of Thomas Petazzoni):
- Drop CMAKE_FIND_LIBRARY_SUFFIXES STREQUAL ".a" from patch

 ...-FindBROTLI.cmake-fix-static-linking.patch | 54 +++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 package/wireshark/0002-FindBROTLI.cmake-fix-static-linking.patch
package/wireshark/0002-FindBROTLI.cmake-fix-static-linking.patch new file +54 -0
new file mode 100644
index 0000000000..1300a65167
@@ -0,0 +1,54 @@
+From e1d88b868f57d79a3e90af34f3961f56172998ba Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <[email protected]>
+Date: Fri, 3 Jan 2020 10:47:30 +0100
+Subject: [PATCH 2/2] FindBROTLI.cmake: fix static linking
+
+Use pkg-config to retrieve dependencies of libbrotlidec such as
+libbrotlicommon otherwise static build will fail on:
+
+[100%] Building C object CMakeFiles/tshark.dir/ui/cli/tap-smbsids.c.o
+/home/buildroot/autobuild/instance-1/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/8.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: /home/buildroot/autobuild/instance-1/output-1/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libbrotlidec.a(decode.c.o): in function `ProcessCommands':
+decode.c:(.text+0x36d0): undefined reference to `BrotliTransformDictionaryWord'
+/home/buildroot/autobuild/instance-1/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/8.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: /home/buildroot/autobuild/instance-1/output-1/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libbrotlidec.a(decode.c.o): in function `SafeProcessCommands':
+decode.c:(.text+0x418c): undefined reference to `BrotliTransformDictionaryWord'
+/home/buildroot/autobuild/instance-1/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/8.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: /home/buildroot/autobuild/instance-1/output-1/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libbrotlidec.a(state.c.o): in function `BrotliDecoderStateInit':
+state.c:(.text+0x120): undefined reference to `BrotliGetDictionary'
+/home/buildroot/autobuild/instance-1/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/8.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: state.c:(.text+0x128): undefined reference to `BrotliGetTransforms'
+
+Fixes:
+ - http://autobuild.buildroot.org/results/2387d4590c5dce73d5f6d72bccf253e79f9a73d8
+
+Signed-off-by: Fabrice Fontaine <[email protected]>
+[Upstream status: Not sent yet (waiting for feedback on first patch)]
+---
+ cmake/modules/FindBROTLI.cmake | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/cmake/modules/FindBROTLI.cmake b/cmake/modules/FindBROTLI.cmake
+index 4ab8dbb41c..687afd6e5e 100644
+--- a/cmake/modules/FindBROTLI.cmake
++++ b/cmake/modules/FindBROTLI.cmake
+@@ -11,6 +11,9 @@
+ include( FindWSWinLibs )
+ FindWSWinLibs( "brotli-.*" "BROTLI_HINTS" )
+ 
++find_package(PkgConfig QUIET)
++PKG_CHECK_MODULES(PC_BROTLI QUIET libbrotlidec)
++
+ find_path(BROTLI_INCLUDE_DIR
+   NAMES "brotli/decode.h"
+   HINTS "${BROTLI_HINTS}/include"
+@@ -28,6 +31,10 @@ if( BROTLI_FOUND )
+   set( BROTLI_INCLUDE_DIRS ${BROTLI_INCLUDE_DIR} )
+   set( BROTLI_LIBRARIES ${BROTLIDEC_LIBRARY} )
+ 
++  if(UNIX)
++    list(APPEND BROTLI_LIBRARIES ${PC_BROTLI_LIBRARIES})
++  endif()
++
+   if (WIN32)
+     set ( BROTLI_DLL_DIR "${BROTLI_HINTS}/bin"
+       CACHE PATH "Path to the brotli DLLs"
+-- 
+2.24.0
+
Signature · 6 lines
2.24.0

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'