Skip to content

Commit

Permalink
export -lssp for static libraries
Browse files Browse the repository at this point in the history
.a files in MinGW don't list the other static libraries they depend on.
We need to provide it through the pkg-config file.
  • Loading branch information
robUx4 committed May 22, 2024
1 parent cfe3afc commit 8d4e824
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ if(MINGW AND (WITH_FORTIFY_SOURCE OR WITH_STACK_PROTECTOR))
message(WARNING "Could not find libssp in MinGW, stack protection and/or FORTIFY_SOURCE are unavailable")
else()
link_libraries("ssp.a")
# static libraries don't carry over other static libraries in mingw
# we need to export it in the pkg-config
set(FLAC_STATIC_LIBS "-lssp")
endif()
elseif(NOT MSVC)
set(HAVE_LIBSSP 1)
Expand Down
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -488,9 +488,11 @@ if test x$enable_werror = "xyes" ; then
if test x$enable_stack_smash_protection = "xyes" && test "x$mingw_has_stack_chk_fail" != "xno" ; then
XIPH_GCC_STACK_PROTECTOR
XIPH_GXX_STACK_PROTECTOR
FLAC_STATIC_LIBS="-lssp"
else
enable_stack_smash_protection=no
fi
AC_SUBST(FLAC_STATIC_LIBS)

AH_VERBATIM([FLAC_API_EXPORTS],
[/* libtool defines DLL_EXPORT for windows dll builds,
Expand Down
2 changes: 1 addition & 1 deletion src/libFLAC/flac.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ Description: Free Lossless Audio Codec Library
Version: @VERSION@
Requires.private: @OGG_PACKAGE@
Libs: -L${libdir} -lFLAC
Libs.private: -lm
Libs.private: -lm @FLAC_STATIC_LIBS@
Cflags: -I${includedir}

0 comments on commit 8d4e824

Please sign in to comment.