Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 37972 - mjpegtools won't build with -fstack-protector
Summary: mjpegtools won't build with -fstack-protector
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Media-video project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-12 06:52 UTC by Jean-Michel Smith
Modified: 2004-09-25 07:30 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Michel Smith 2004-01-12 06:52:10 UTC
mjpegtool compile fails if -fstack-protector is specified in /etc/make.conf

Reproducible: Always
Steps to Reproduce:
1. add -fstack-protector to CFLAGS in /etc/make.conf
2. emerge mjpegtools
3. watch the compile choke and die

Actual Results:  
compile dies

Expected Results:  
compile should complete successfully

FIX:  strip -fstack-protector out of the CFLAGS in ebuild
Comment 1 Scott Taylor (RETIRED) gentoo-dev 2004-02-07 09:10:25 UTC
Is this where it dies for you? 

motion.c: In function `calc_SAD_mmx':
motion.c:143: internal compiler error: asm clobber conflict with output operand
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugs.gentoo.org/> for instructions.
Preprocessed source stored into /data/tmp/portage/mjpegtools-1.6.2/temp/ccReWJ2E.out file, please attach this to your bugreport
make[2]: *** [motion.o] Error 1
make[2]: Leaving directory `/data/tmp/portage/mjpegtools-1.6.2/work/mjpegtools-1.6.2/yuvdenoise'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/data/tmp/portage/mjpegtools-1.6.2/work/mjpegtools-1.6.2'
make: *** [all] Error 2

!!! ERROR: media-video/mjpegtools-1.6.2 failed.
!!! Function src_compile, Line 85, Exitcode 2
!!! compile problem


Removing the matching enable line and specifically disabling simd as follows fixes it for me:

                myconf="${myconf} --disable-simd-accel"

Granted, thats a sloppy thing to do and doesn't track down the real problem, but it does let it compile.
And doing this, I do NOT need to filter out pic or stack-protector.
Comment 2 solar (RETIRED) gentoo-dev 2004-02-07 09:42:45 UTC
What about something like.

use mmx || myconf="${myconf} --disable-simd-accel"
Comment 3 Max Kalika (RETIRED) gentoo-dev 2004-02-07 09:54:19 UTC
i would prefer:

  myconf="${myconf} `use_enable mmx simd-accel`"

but that is just semantics...
Comment 4 Scott Taylor (RETIRED) gentoo-dev 2004-02-07 09:58:21 UTC
Their simd-accel functions are a generic trigger for allowing mmx/sse/sse2 and so
on. It is entirely possible that the accelerations that are in there work fine if
PIC is not enabled. The processor type is autodetected by ./configure, and the
simd-accel set is enabled unless it is explicitly disabled. And something in that
set of code breaks with -fPIC.
Comment 5 Scott Taylor (RETIRED) gentoo-dev 2004-02-07 10:08:40 UTC
Just confirmed that adding -yet_exec into the Makefile in that directory (that
Makefile forcibly overwrites CC and CFLAGS) compiles without the asm clobber
conflict. So, the enable-simd-accel is appropriate to be turned on UNLESS
hardened-gcc or gcc-pie are active.
Comment 6 Patrick Kursawe (RETIRED) gentoo-dev 2004-03-18 00:31:42 UTC
I just read in the ChangeLog:

*mjpegtools-1.6.1.92 (16 Jan 2004)

  16 Jan 2004; Wout Mertens <wmertens@gentoo.org> mjpegtools-1.6.1.92.ebuild:
  Version bump and disabling -fPIC on x86 where it fails.

Could you please verify if there's still a problem?
Comment 7 Heinrich Wendel (RETIRED) gentoo-dev 2004-04-17 04:36:43 UTC
see bug #47335, it is not needed. what is the proper fix for this bug?
Comment 8 solar (RETIRED) gentoo-dev 2004-04-20 09:18:48 UTC
[ebuild     U ] media-video/mjpegtools-1.6.2-r1 [1.6.0-r7] -3dnow +X +avi -dv -gtk +mmx +quicktime +sdl +sse  0 kB
-----------------------------------------------------------------------------
checking for vidix... no
./configure: line 13191: test: too many arguments
tail: `-1' option is obsolete; use `-n 1' since this will be removed in the future
updating cache ./config.cache
creating ./config.status
-----------------------------------------------------------------------------
r/lib/libquicktime.so: undefined reference to `png_set_compression_level'
/usr/lib/libquicktime.so: undefined reference to `png_create_read_struct'
/usr/lib/libquicktime.so: undefined reference to `png_set_read_fn'
/usr/lib/libquicktime.so: undefined reference to `png_get_io_ptr'
/usr/lib/libquicktime.so: undefined reference to `png_set_IHDR'
/usr/lib/libquicktime.so: undefined reference to `png_create_write_struct'
/usr/lib/libquicktime.so: undefined reference to `png_write_info'
/usr/lib/libquicktime.so: undefined reference to `png_write_end'
/usr/lib/libquicktime.so: undefined reference to `png_set_write_fn'
/usr/lib/libquicktime.so: undefined reference to `png_read_info'
/usr/lib/libquicktime.so: undefined reference to `png_destroy_read_struct'
/usr/lib/libquicktime.so: undefined reference to `png_write_image'
/usr/lib/libquicktime.so: undefined reference to `png_read_image'
/usr/lib/libquicktime.so: undefined reference to `png_create_info_struct'
/usr/lib/libquicktime.so: undefined reference to `png_destroy_write_struct'
collect2: ld returned 1 exit status
make[2]: *** [lavplay] Error 1
make[2]: Leaving directory `/space/tmp/portage/mjpegtools-1.6.2-r1/work/mjpegtools-1.6.2/lavtools'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/space/tmp/portage/mjpegtools-1.6.2-r1/work/mjpegtools-1.6.2'
make: *** [all] Error 2

!!! ERROR: media-video/mjpegtools-1.6.2-r1 failed.
!!! Function src_compile, Line 78, Exitcode 2
!!! compile problem

-----------------------------------------------------------------

The proper fix trigger --disable-simd-accel when fstack-protctor is in CFLAGS
or USE=hardened is enabled and to correct or remove the quicktime behavior.
Comment 9 Heinrich Wendel (RETIRED) gentoo-dev 2004-04-24 08:11:16 UTC
"and to correct or remove the quicktime behaviour" <-- what does that mean?
Comment 10 solar (RETIRED) gentoo-dev 2004-04-24 08:37:40 UTC
This should really be another bug but I lack the time/motivation to track 
down quicktime linking errors.

solar@simple c $ emerge -pv quicktime
[ebuild     U ] media-libs/quicktime4linux-2.0.0-r1 [1.5.5-r1]  3,742 kB

solar@simple c $ ldd /usr/lib/libquicktime.so 
	libc.so.6 => /lib/libc.so.6 (0x21584000)
	/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x0b5d2000)

solar@simple c $ nm /usr/lib/libquicktime.so | grep "U png" 
         U png_create_info_struct
         U png_create_read_struct
         U png_create_write_struct
         U png_destroy_read_struct
         U png_destroy_write_struct
         U png_get_io_ptr
         U png_read_image
         U png_read_info
         U png_set_IHDR
         U png_set_compression_level
         U png_set_read_fn
         U png_set_write_fn
         U png_write_end
         U png_write_image
         U png_write_info
------------------------------------------------

As we can clearly see quicktime itself has undefined 
references to png but the libpng is nowhere to be found in the 
ELF DT_NEEDED.

In short... When building mjpegtools this bug presented itself to me.
It could be probably be worked around by simply adding to either of 
the two .ebuilds. (preferably quicktime itself)

inherit flag-o-matic
append-ldflags -lpng

Note:
- My quicktime is an older version and this may have been fixed already.
------------------------------------------------
Comment 11 Heinrich Wendel (RETIRED) gentoo-dev 2004-09-25 07:30:37 UTC
i don't get the quicktime error and the simd-accel thing is fixed in mjpegtools-1.6.2-r3