2011/4/12 Fridrich Strba
Another policy is that we don't distribute static libraries unless there is a huge reason for this. The exception nowadays is the iconv implementation that we use win_iconv, because it only translates between iconv APIs and win32 native APIs and distribute it as a dll would not make any sense, especially that it is not developed as such by the developer.
When trying to link a project (pulseaudio) against win_iconv, I got problems. The pulseaudio configure scripts detects the iconv implementation, but then tries to link against the dynamic library, which does not exist. The problem seems to lie in the following line in the mingw32-filesystem macros file: %_mingw32_ldflags -Wl,--exclude-libs=libintl.a -Wl,--exclude-libs=libiconv.a I had to explicitly disable the MINGW32_LDFLAGS to get pulseaudio to compile. Specfile here: https://build.opensuse.org/package/view_file?file=mingw32-pulseaudio.spec&package=mingw32-pulseaudio&project=home%3Amkbosmans%3Amingw32%3Apulseaudio&srcmd5=a08eef2bd51d86e8cac858cdb4f6e428 Is this the correct way of statically linking against win_iconv, or is there some other way? Maarten -- To unsubscribe, e-mail: opensuse-mingw+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-mingw+help@opensuse.org
Maarten, On 13/04/11 11:14, Maarten Bosmans wrote:
When trying to link a project (pulseaudio) against win_iconv, I got problems. The pulseaudio configure scripts detects the iconv implementation, but then tries to link against the dynamic library, which does not exist.
Funny enough, I just removed the MINGW32_LDFLAGS overriding in the package and rebuilt here locally, and everything was just fine. The crucial part of the success to link with a mix of static and shared libraries on win32 is to short-circuit the libtool shared library detection heuristic. This is done by the line: echo "lt_cv_deplibs_check_method='pass_all'" >>%{_mingw32_cache} in the spec file. The linker will then be able to find what it needs.
The problem seems to lie in the following line in the mingw32-filesystem macros file: %_mingw32_ldflags -Wl,--exclude-libs=libintl.a -Wl,--exclude-libs=libiconv.a
Those are just directives to the linker so that it does not export from the given library the symbols contained inside libintl.a and libiconv.a static libraries. Otherwise, many libraries would export the libintl and iconv symbols and other binaries would link them randomly from whichever library is first in the linker line. Fridrich -- Please avoid sending me Word, Excel or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html -- To unsubscribe, e-mail: opensuse-mingw+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-mingw+help@opensuse.org
2011/4/13 Fridrich Strba
Maarten,
On 13/04/11 11:14, Maarten Bosmans wrote:
When trying to link a project (pulseaudio) against win_iconv, I got problems. The pulseaudio configure scripts detects the iconv implementation, but then tries to link against the dynamic library, which does not exist.
Funny enough, I just removed the MINGW32_LDFLAGS overriding in the package and rebuilt here locally, and everything was just fine. The crucial part of the success to link with a mix of static and shared libraries on win32 is to short-circuit the libtool shared library detection heuristic. This is done by the line:
echo "lt_cv_deplibs_check_method='pass_all'" >>%{_mingw32_cache}
in the spec file. The linker will then be able to find what it needs.
Hmm, yes indeed. It just so happened that I added that line at the same time as I added the LDFLAGS override. (I am on Ubuntu, so I can't easily build locally and try many different things) So when it worked, I came to the wrong conclusion.
The problem seems to lie in the following line in the mingw32-filesystem macros file: %_mingw32_ldflags -Wl,--exclude-libs=libintl.a -Wl,--exclude-libs=libiconv.a
Those are just directives to the linker so that it does not export from the given library the symbols contained inside libintl.a and libiconv.a static libraries. Otherwise, many libraries would export the libintl and iconv symbols and other binaries would link them randomly from whichever library is first in the linker line.
Thanks for the explanation.
Fridrich
Maarten -- To unsubscribe, e-mail: opensuse-mingw+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-mingw+help@opensuse.org
participants (2)
-
Fridrich Strba
-
Maarten Bosmans