[flac-dev] Can't cross-compile from git now.
Hi I have a problem now cross-compiling FLAC from latest git. With Ubuntu 12.04 and g++-mingw-w64-i686 (4.6.3-1ubuntu5+5ubuntu1). I think that the problem might have been introduced on 5 Mar 2013 with commit 05609d5 (configure.ac : Add hardening compile options.) Gives errors like this:- /home/user/FLAC_build/flac-05609d5/src/libFLAC/.libs/libFLAC.a(ogg_helper.o):ogg_helper.c:(.text+0x173): undefined reference to `___stack_chk_guard' /home/user/FLAC_build/flac-05609d5/src/libFLAC/.libs/libFLAC.a(ogg_helper.o):ogg_helper.c:(.text+0x45c): undefined reference to `___stack_chk_guard' /home/user/FLAC_build/flac-05609d5/src/libFLAC/.libs/libFLAC.a(ogg_helper.o):ogg_helper.c:(.text+0x463): undefined reference to `___stack_chk_fail' collect2: ld returned 1 exit status make[3]: *** [test_libFLAC++.exe] Error 1 make[3]: Leaving directory `/home/user/FLAC_build/flac-05609d5/src/test_libFLAC++' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/home/user/FLAC_build/flac-05609d5/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/user/FLAC_build/flac-05609d5' make: *** [all] Error 2 The previous commit 9d057c7 compiles OK for me. This is the (failed) build log for commit 05609d5 --> http://pastebin.com/SqWsJX3e This is the (good) build log for previous commit 9d057c7 --> http://pastebin.com/H4GLXEJB This is the (failed) build log for latest (8 Mar 2013) commit ae663c3 --> http://pastebin.com/39G6Tv4H ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] Can't cross-compile from git now.
On 13-03-08 8:39 AM, bat guano wrote: > /home/user/FLAC_build/flac-05609d5/src/libFLAC/.libs/libFLAC.a(ogg_helper.o):ogg_helper.c:(.text+0x173): > undefined reference to `___stack_chk_guard' I have a vague memory that -fstack-protector doesn't work in mingw, but the configure check passed. Maybe because it's via a library? Can you re-run with --disable-silent-rules and see if the linker is getting -fstack-protector, or add -lssp manually? My system's /usr/i686-w63-mingw32/sys-root/mingw/linux/libssp.a has a __stack_check_fail, but no __stack_check_guard. -r ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] Can't cross-compile from git now.
Can you > re-run with --disable-silent-rules Hi I added "--disable-silent-rules" to config. Like this:- PKG_CONFIG_PATH="$HOME/FLAC_build/lib/pkgconfig" LDFLAGS="-L$HOME/FLAC_build/lib" CFLAGS="-I$HOME/FLAC_build/include" ./configure --prefix=$HOME/FLAC_build --host=i686-w64-mingw32 --enable-static --disable-shared --disable-dependency-tracking --disable-silent-rules The result is here --> http://pastebin.com/9t3q6kEk ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] Can't cross-compile from git now.
bat guano wrote: > > Hi > I have a problem now cross-compiling FLAC from latest git. > With Ubuntu 12.04 and g++-mingw-w64-i686 (4.6.3-1ubuntu5+5ubuntu1). > > I think that the problem might have been introduced on 5 Mar 2013 > with commit 05609d5 (configure.ac : Add hardening compile options.) That was fixed with commit d5b03bcc36474ff1c9f2da2dcb5212e810208a6f Author: Erik de Castro Lopo Date: Sat Mar 9 08:55:37 2013 +1100 configure.ac : Don't enable stack protector for mingw* host_os. Cheers, Erik -- -- Erik de Castro Lopo http://www.mega-nerd.com/ ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] Can't cross-compile from git now.
> > That was fixed with > > commit d5b03bcc36474ff1c9f2da2dcb5212e810208a6f > Author: Erik de Castro Lopo > Date: Sat Mar 9 08:55:37 2013 +1100 > > configure.ac : Don't enable stack protector for mingw* host_os. > Yes, it's fixed. Thanks. :-) ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] Can't cross-compile from git now.
On 3/9/2013 06:20, Erik de Castro Lopo wrote: > bat guano wrote: > >> >> Hi >> I have a problem now cross-compiling FLAC from latest git. >> With Ubuntu 12.04 and g++-mingw-w64-i686 (4.6.3-1ubuntu5+5ubuntu1). >> >> I think that the problem might have been introduced on 5 Mar 2013 >> with commit 05609d5 (configure.ac : Add hardening compile options.) > Resending, likely caught by filters. Hi, Please do a link time test instead, I am not getting this error and would like to keep stack protector on. The test case below will trigger ___stack_chk_guard to emit. int main(){ int i = 0; char a[1000]; while(1){ a[i] = 0; i++; } } "i686-w64-mingw32-gcc -D_FORTIFY_SOURCE=2 -fstack-protector --param ssp-buffer-size=4 -v" shows that libssp is already added. Alternatively, to include __stack_chk_fail, use: extern void __stack_chk_guard(); extern void __stack_chk_fail(); int main(){ void (*ssp[]) = { __stack_chk_guard, __stack_chk_fail }; return 0; } signature.asc Description: OpenPGP digital signature ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] Can't cross-compile from git now.
Please do a link time test instead... The test case below... Hi I am not a programmer/developer. Much more info needed. ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] Can't cross-compile from git now.
JonY wrote: > Please do a link time test instead, I am not getting this error and > would like to keep stack protector on. I'll write an m4 macro. Erik -- -- Erik de Castro Lopo http://www.mega-nerd.com/ ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] Can't cross-compile from git now.
On 3/10/2013 02:31, bat guano wrote: > > > > Please do a link time test instead... > > The test case below... > > Hi > I am not a programmer/developer. > Much more info needed. > > Yes, the message was for the developers. Right now it is disabled for mingw* although SSP works perfectly fine on some mingw install (depending on gcc configuration), hence the need to do a link test. Your mingw gcc install likely has SSP disabled. Contact your installation provider or package maintainer if you did not build it yourself. signature.asc Description: OpenPGP digital signature ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] Can't cross-compile from git now.
Erik de Castro Lopo wrote: > JonY wrote: > > > Please do a link time test instead, I am not getting this error and > > would like to keep stack protector on. > > I'll write an m4 macro. I have attampted to write a macro that reliably detects the availability of stack smash protection. I currently have two configurations where my detection says that SSP is available but the compile fails: - MinGW cross compile from Linux to Windows. - Native FreeBSD compile. Not sure what to do from here. I think I'll probably have to disable this for this upcoming release. Erik -- -- Erik de Castro Lopo http://www.mega-nerd.com/ ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] Can't cross-compile from git now.
On 3/12/2013 18:58, Erik de Castro Lopo wrote: > Erik de Castro Lopo wrote: > >> JonY wrote: >> >>> Please do a link time test instead, I am not getting this error and >>> would like to keep stack protector on. >> >> I'll write an m4 macro. > > I have attampted to write a macro that reliably detects the availability > of stack smash protection. > > I currently have two configurations where my detection says that SSP is > available but the compile fails: > > - MinGW cross compile from Linux to Windows. > - Native FreeBSD compile. > > Not sure what to do from here. I think I'll probably have to disable > this for this upcoming release. > What is your link test checking and how does it fail? signature.asc Description: OpenPGP digital signature ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] Can't cross-compile from git now.
JonY wrote: > What is your link test checking and how does it fail? My m4 macro is really simple, TRY_LINK a simple program with the stack protect CFLAGS: AC_DEFUN([XIPH_GCC_STACK_PROTECTOR], [AC_LANG_ASSERT(C) AC_MSG_CHECKING([if $CC supports stack smash protection]) xiph_stack_check_old_cflags="$CFLAGS" SSP_FLAGS="-fstack-protector --param ssp-buffer-size=4" CFLAGS=$SSP_FLAGS AC_TRY_LINK([ #include ], [puts("Hello, World!"); return 0;], AC_MSG_RESULT([yes]) CFLAGS="$xiph_stack_check_old_cflags $SSP_FLAGS", AC_MSG_RESULT([no]) CFLAGS="$xiph_stack_check_old_cflags" ) ])# XIPH_GCC_STACK_PROTECTOR For the Linux -> Windows cross compile for instance, this detects SSP as working, but when I compile it fails with: CC stream_encoder_framing.lo CC window.lo CCLD libFLAC.la Creating library file: .libs/libFLAC.dll.a .libs/metadata_iterators.o:metadata_iterators.c:(.text+0x8d): undefined reference to `___stack_chk_guard' .libs/metadata_iterators.o:metadata_iterators.c:(.text+0x121): undefined reference to `___stack_chk_guard' .libs/metadata_iterators.o:metadata_iterators.c:(.text+0x14f): undefined reference to `___stack_chk_fail' The odd thinh is, if I use this MinGW cross-compiler to compile a small program, it works perfectly. The problem aboce is related to building a Windows DLL. On FreeBSD everything goes fine until it tries to link test_libFLAC++: Making all in test_libFLAC++ CXX decoders.o CXX encoders.o CXX main.o CXX metadata.o CXX metadata_manip.o CXX metadata_object.o CXXLDtest_libFLAC++ /usr/home/erikd/flac/src/libFLAC/.libs/libFLAC.so: undefined reference to `__stack_chk_fail_local' *** [test_libFLAC++] Error code 1 Erik -- -- Erik de Castro Lopo http://www.mega-nerd.com/ ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] Can't cross-compile from git now.
On 03/12/13 12:39 pm, Erik de Castro Lopo wrote: > For the Linux -> Windows cross compile for instance, this detects > SSP as working, but when I compile it fails with: > > CC stream_encoder_framing.lo > CC window.lo > CCLD libFLAC.la >Creating library file: .libs/libFLAC.dll.a >.libs/metadata_iterators.o:metadata_iterators.c:(.text+0x8d): undefined > reference to `___stack_chk_guard' >.libs/metadata_iterators.o:metadata_iterators.c:(.text+0x121): undefined > reference to `___stack_chk_guard' >.libs/metadata_iterators.o:metadata_iterators.c:(.text+0x14f): undefined > reference to `___stack_chk_fail' > > The odd thinh is, if I use this MinGW cross-compiler to compile a small > program, it works perfectly. The problem aboce is related to building > a Windows DLL. I can get around the undefined symbol errors by doing make LDFLAGS=-lssp Perhaps Windows and FreeBSD will also work if linked against ssp.a / ssp.dll. OF course this introduces another dependency. Dave ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] Can't cross-compile from git now.
On 3/13/2013 03:50, Dave Yeo wrote: > On 03/12/13 12:39 pm, Erik de Castro Lopo wrote: >> For the Linux -> Windows cross compile for instance, this detects >> SSP as working, but when I compile it fails with: >> >> CC stream_encoder_framing.lo >> CC window.lo >> CCLD libFLAC.la >>Creating library file: .libs/libFLAC.dll.a >>.libs/metadata_iterators.o:metadata_iterators.c:(.text+0x8d): undefined >> reference to `___stack_chk_guard' >>.libs/metadata_iterators.o:metadata_iterators.c:(.text+0x121): undefined >> reference to `___stack_chk_guard' >>.libs/metadata_iterators.o:metadata_iterators.c:(.text+0x14f): undefined >> reference to `___stack_chk_fail' >> >> The odd thinh is, if I use this MinGW cross-compiler to compile a small >> program, it works perfectly. The problem aboce is related to building >> a Windows DLL. > > I can get around the undefined symbol errors by doing make LDFLAGS=-lssp > Perhaps Windows and FreeBSD will also work if linked against ssp.a / > ssp.dll. OF course this introduces another dependency. > Dave Dave, my toolchain automatically links libssp already, I am using vanilla sources. Erik, Why not also check if -lssp is required? If the toolchain has SSP disabled it should not be passing. Check onces without -lssp and another time with -lssp if it failed. Also, I don't think a trivial hello world will cause SSP code to be emitted, try adding some arrays in stack with a deliberate overrun possibility for the link test. signature.asc Description: OpenPGP digital signature ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] Can't cross-compile from git now.
Dave Yeo wrote: > I can get around the undefined symbol errors by doing make LDFLAGS=-lssp > Perhaps Windows and FreeBSD will also work if linked against ssp.a / > ssp.dll. OF course this introduces another dependency. Yes, *highly* un-desirable. Erik -- -- Erik de Castro Lopo http://www.mega-nerd.com/ ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] Can't cross-compile from git now.
JonY wrote: > Dave, my toolchain automatically links libssp already, I am using > vanilla sources. Are you doing a native Windows compile with MinGW or cross compiling from Linux? > Why not also check if -lssp is required? If the toolchain has SSP > disabled it should not be passing. Check onces without -lssp and another > time with -lssp if it failed. If we can easily force the linking of libssp then that maky work. I'm not real keen on having the Windows DLL require this extra libssp-X.dll. > Also, I don't think a trivial hello world will cause SSP code to be > emitted, try adding some arrays in stack with a deliberate overrun > possibility for the link test. Unfortunately its even more complicated than that. It can sucessfully link and create a valid executable (with and without -lssp) which then fails at run time because it can't find libssp-0.dll. This stuff is broken. I cannot see any reasonable way to make this work across the board. The best option I can suggest is a ./configure --enable-stack-smash-protect which is disabled by default. Erik -- -- Erik de Castro Lopo http://www.mega-nerd.com/ ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] Can't cross-compile from git now.
Erik de Castro Lopo wrote: > This stuff is broken. I cannot see any reasonable way to make this > work across the board. The best option I can suggest is a > > ./configure --enable-stack-smash-protect > > which is disabled by default. This is now in git. Erik -- -- Erik de Castro Lopo http://www.mega-nerd.com/ ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] Can't cross-compile from git now.
On 3/13/2013 06:50, Erik de Castro Lopo wrote: > JonY wrote: > >> Dave, my toolchain automatically links libssp already, I am using >> vanilla sources. > > Are you doing a native Windows compile with MinGW or cross compiling > from Linux? > Crossing from Cygwin, GCC built from vanilla FSF sources. >> Why not also check if -lssp is required? If the toolchain has SSP >> disabled it should not be passing. Check onces without -lssp and another >> time with -lssp if it failed. > > If we can easily force the linking of libssp then that maky work. I'm > not real keen on having the Windows DLL require this extra libssp-X.dll. > I guess that's libtool doing it. The link test that I used certainly did not require the DLL. >> Also, I don't think a trivial hello world will cause SSP code to be >> emitted, try adding some arrays in stack with a deliberate overrun >> possibility for the link test. > > Unfortunately its even more complicated than that. It can sucessfully > link and create a valid executable (with and without -lssp) which then > fails at run time because it can't find libssp-0.dll. > Libtool forces all DLL code to link to other DLLs. > This stuff is broken. I cannot see any reasonable way to make this > work across the board. The best option I can suggest is a > > ./configure --enable-stack-smash-protect > > which is disabled by default. > I am OK with this. signature.asc Description: OpenPGP digital signature ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] Can't cross-compile from git now.
On 3/9/2013 06:20, Erik de Castro Lopo wrote: > bat guano wrote: > >> >> Hi >> I have a problem now cross-compiling FLAC from latest git. >> With Ubuntu 12.04 and g++-mingw-w64-i686 (4.6.3-1ubuntu5+5ubuntu1). >> >> I think that the problem might have been introduced on 5 Mar 2013 >> with commit 05609d5 (configure.ac : Add hardening compile options.) > > That was fixed with > > commit d5b03bcc36474ff1c9f2da2dcb5212e810208a6f > Author: Erik de Castro Lopo > Date: Sat Mar 9 08:55:37 2013 +1100 > > configure.ac : Don't enable stack protector for mingw* host_os. > Hi, Please do a link time test instead, I am not getting this error and would like to keep stack protector on. The test case below will trigger ___stack_chk_guard to emit. int main(){ int i = 0; char a[1000]; while(1){ a[i] = 0; i++; } } "i686-w64-mingw32-gcc -D_FORTIFY_SOURCE=2 -fstack-protector --param ssp-buffer-size=4 -v" shows that libssp is already added. signature.asc Description: OpenPGP digital signature ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] Can't cross-compile from git now.
On 3/9/2013 09:41, JonY wrote: > On 3/9/2013 06:20, Erik de Castro Lopo wrote: >> bat guano wrote: >> >>> >>> Hi >>> I have a problem now cross-compiling FLAC from latest git. >>> With Ubuntu 12.04 and g++-mingw-w64-i686 (4.6.3-1ubuntu5+5ubuntu1). >>> >>> I think that the problem might have been introduced on 5 Mar 2013 >>> with commit 05609d5 (configure.ac : Add hardening compile options.) >> >> That was fixed with >> >> commit d5b03bcc36474ff1c9f2da2dcb5212e810208a6f >> Author: Erik de Castro Lopo >> Date: Sat Mar 9 08:55:37 2013 +1100 >> >> configure.ac : Don't enable stack protector for mingw* host_os. >> > > Hi, > > Please do a link time test instead, I am not getting this error and > would like to keep stack protector on. > > The test case below will trigger ___stack_chk_guard to emit. > > int main(){ > int i = 0; > char a[1000]; > while(1){ > a[i] = 0; > i++; > } > } > > "i686-w64-mingw32-gcc -D_FORTIFY_SOURCE=2 -fstack-protector --param > ssp-buffer-size=4 -v" shows that libssp is already added. > > Alternatively, to include __stack_chk_fail, use: extern void __stack_chk_guard(); extern void __stack_chk_fail(); int main(){ void (*ssp[]) = { __stack_chk_guard, __stack_chk_fail }; return 0; } signature.asc Description: OpenPGP digital signature ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev