Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Problem building ffmpeg on amd64 (solved)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
causality
Apprentice
Apprentice


Joined: 03 Jun 2006
Posts: 236

PostPosted: Thu Dec 07, 2017 2:55 am    Post subject: Problem building ffmpeg on amd64 (solved) Reply with quote

I recently re-installed my system from scratch (thankfully /home and other important things were on separate disks). During the first build of ffmpeg, everything went smoothly. One of the first things I did after booting into the new system was to install the ~amd64 gcc-7.2.0 and make it the default compiler (after rebuilding libtool per the GCC Upgrade Guide wiki). All of this was on the (then default) Profile 13.

At that time, building ffmpeg for the first time went smoothly. It was just a little piece of my building of a full-blown KDE desktop.

Then I upgraded to Profile 17 and followed the directions of the "eselect news" article. I had to rebuild the toolchain and then "emerge --emptytree @world". During this world rebuild, ffmpeg failed with an error "asm operand has impossible constraints". I checked out https://bugs.gentoo.org/578802 and it appears to be because ffmpeg does not like to be compiled with a "-fpic" CFLAG. The comment on that bug can be paraphrased as, "oh sure, just get rid of -fpic and everything is peachy!" This was not my experience.

The package ffmpeg has a "pic" useflag which is *unset* on my system. "-fpic" is not in my make.conf CFLAGS. Perhaps this is coming from the similar "-pie" flag that is now a GCC default with the new profile? While I realize they are two distinct flags, I think PIE and PIC are similar in nature, though I don't understand what the exact difference is.

As an experiment, I tried using package.env to build ffmpeg with the following variables:

Code:
CFLAGS="-O2 -march=native -pipe -fomit-frame-pointer -finline-functions -fsched-pressure -ftree-loop-distribution -fno-pic"
CXXFLAGS="${CFLAGS}"
LDFLAGS="-Wl,-O2 -Wl,--as-needed -Wl,--hash-style=gnu -Wl,--sort-common -Wl,--strip-debug ${CFLAGS}"


This build fails at the very end, giving the following error message:

Code:
./libavcodec/sinewin_tablegen > libavcodec/sinewin_tables.h
./libavcodec/sinewin_fixed_tablegen > libavcodec/sinewin_fixed_tables.h
x86_64-pc-linux-gnu-gcc -shared -Wl,-soname,libavutil.so.55 -Wl,-Bsymbolic -Wl,--version-script,libavutil/libavutil.ver -Llibavcodec -Llibavdevice -Llibavfilter -Llibavformat -Llibavresample -Llibavutil -Llibpostproc -Llibswscale -Llibswresample -Wl,-O2 -Wl,--as-needed -Wl,--hash-style=gnu -Wl,--sort-common -Wl,--strip-debug -O2 -march=native -pipe -fomit-frame-pointer -finline-functions -fsched-pressure -ftree-loop-distribution -fno-pic  -march=skylake -Wl,--as-needed -Wl,-z,noexecstack -Wl,--warn-common -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample  -o libavutil/libavutil.so.55 libavutil/adler32.o libavutil/aes.o libavutil/aes_ctr.o libavutil/audio_fifo.o libavutil/avstring.o libavutil/base64.o libavutil/blowfish.o libavutil/bprint.o libavutil/buffer.o libavutil/camellia.o libavutil/cast5.o libavutil/channel_layout.o libavutil/color_utils.o libavutil/cpu.o libavutil/crc.o libavutil/des.o libavutil/dict.o libavutil/display.o libavutil/downmix_info.o libavutil/error.o libavutil/eval.o libavutil/fifo.o libavutil/file.o libavutil/file_open.o libavutil/fixed_dsp.o libavutil/float_dsp.o libavutil/frame.o libavutil/hash.o libavutil/hmac.o libavutil/hwcontext.o libavutil/hwcontext_cuda.o libavutil/imgutils.o libavutil/integer.o libavutil/intmath.o libavutil/lfg.o libavutil/lls.o libavutil/log.o libavutil/log2_tab.o libavutil/lzo.o libavutil/mastering_display_metadata.o libavutil/mathematics.o libavutil/md5.o libavutil/mem.o libavutil/murmur3.o libavutil/opt.o libavutil/parseutils.o libavutil/pixdesc.o libavutil/pixelutils.o libavutil/random_seed.o libavutil/rational.o libavutil/rc4.o libavutil/reverse.o libavutil/ripemd.o libavutil/samplefmt.o libavutil/sha.o libavutil/sha512.o libavutil/spherical.o libavutil/stereo3d.o libavutil/tea.o libavutil/threadmessage.o libavutil/time.o libavutil/timecode.o libavutil/tree.o libavutil/twofish.o libavutil/utils.o libavutil/x86/cpu.o libavutil/x86/cpuid.o libavutil/x86/fixed_dsp.o libavutil/x86/fixed_dsp_init.o libavutil/x86/float_dsp.o libavutil/x86/float_dsp_init.o libavutil/x86/imgutils.o libavutil/x86/imgutils_init.o libavutil/x86/lls.o libavutil/x86/lls_init.o libavutil/x86/pixelutils.o libavutil/x86/pixelutils_init.o libavutil/xga_font_data.o libavutil/xtea.o  -lXv -lX11 -lXext -ldl -lxcb -lxcb-shm -lxcb-xfixes -lxcb-shape -lasound -lSDL2 -lssl -lcrypto -lGL -lxvidcore -lx264 -lvorbisenc -lvorbis -logg -lopenjp2 -lmp3lame -lfreetype -lm -llzma -lbz2 -lz -pthread
x86_64-pc-linux-gnu-gcc -I. -Isrc/ -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -DZLIB_CONST -DHAVE_AV_CONFIG_H -O2 -march=native -pipe -fomit-frame-pointer -finline-functions -fsched-pressure -ftree-loop-distribution -fno-pic   -march=skylake -std=c11 -fomit-frame-pointer -fPIC -pthread -I/usr/include/freetype2   -D_REENTRANT -I/usr/include/SDL2  -Wdeclaration-after-statement -Wall -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -Wmissing-prototypes -Wno-pointer-to-int-cast -Wstrict-prototypes -Wempty-body -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -Wno-unused-const-variable -O2 -march=native -pipe -fomit-frame-pointer -finline-functions -fsched-pressure -ftree-loop-distribution -fno-pic -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -Werror=format-security -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=return-type -Werror=vla -Wformat -fdiagnostics-color=auto -Wno-maybe-uninitialized  -MMD -MF libavcodec/aacps_fixed.d -MT libavcodec/aacps_fixed.o -c -o libavcodec/aacps_fixed.o src/libavcodec/aacps_fixed.c
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/aes.o: relocation R_X86_64_32S against `.bss' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/avstring.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/base64.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/blowfish.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/bprint.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/buffer.o: relocation R_X86_64_32S against symbol `av_buffer_default_free' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/camellia.o: relocation R_X86_64_32S against `.bss' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/cast5.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/channel_layout.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/color_utils.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/cpu.o: relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/crc.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/des.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/dict.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/error.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/eval.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/file.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/file_open.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/fixed_dsp.o: relocation R_X86_64_32S against `.text' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/float_dsp.o: relocation R_X86_64_32S against `.text' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/frame.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/hash.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/hmac.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/hwcontext.o: relocation R_X86_64_32 against `.text' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/hwcontext_cuda.o: relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/imgutils.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/lls.o: relocation R_X86_64_32S against `.text' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/log.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/lzo.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/mathematics.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/md5.o: relocation R_X86_64_32 against `.LC1' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/mem.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/opt.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/parseutils.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/pixdesc.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/random_seed.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/ripemd.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/samplefmt.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/sha.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/sha512.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/spherical.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/stereo3d.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/threadmessage.o: relocation R_X86_64_32 against `.text' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/timecode.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/twofish.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/utils.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/x86/cpu.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/x86/fixed_dsp_init.o: relocation R_X86_64_32S against hidden symbol `ff_butterflies_fixed_sse2' can not be used when making a shared object
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/x86/float_dsp_init.o: relocation R_X86_64_32S against hidden symbol `ff_vector_fmul_sse' can not be used when making a shared object
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/x86/lls_init.o: relocation R_X86_64_32S against hidden symbol `ff_update_lls_sse2' can not be used when making a shared object
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/x86/pixelutils_init.o: relocation R_X86_64_32S against hidden symbol `ff_pixelutils_sad_8x8_mmx' can not be used when making a shared object
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: libavutil/pixelutils.o: warning: relocation in readonly section `.rodata'
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
make: *** [/var/tmp/portage/media-video/ffmpeg-3.3.5/work/ffmpeg-3.3.5/library.mak:94: libavutil/libavutil.so.55] Error 1
make: *** Waiting for unfinished jobs....
echo skipping strip -wN '..@*' libswresample/x86/audio_convert.o
skipping strip -wN ..@* libswresample/x86/audio_convert.o
 * ERROR: media-video/ffmpeg-3.3.5::gentoo failed (compile phase):
 *   emake failed
 *
 * If you need support, post the output of `emerge --info '=media-video/ffmpeg-3.3.5::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=media-video/ffmpeg-3.3.5::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/media-video/ffmpeg-3.3.5/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/media-video/ffmpeg-3.3.5/temp/environment'.
 * Working directory: '/var/tmp/portage/media-video/ffmpeg-3.3.5/work/ffmpeg-3.3.5-abi_x86_64.amd64'
 * S: '/var/tmp/portage/media-video/ffmpeg-3.3.5/work/ffmpeg-3.3.5'

>>> Failed to emerge media-video/ffmpeg-3.3.5

 * Messages for package media-video/ffmpeg-3.3.5:

 * ERROR: media-video/ffmpeg-3.3.5::gentoo failed (compile phase):
 *   emake failed
 *
 * If you need support, post the output of `emerge --info '=media-video/ffmpeg-3.3.5::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=media-video/ffmpeg-3.3.5::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/media-video/ffmpeg-3.3.5/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/media-video/ffmpeg-3.3.5/temp/environment'.
 * Working directory: '/var/tmp/portage/media-video/ffmpeg-3.3.5/work/ffmpeg-3.3.5-abi_x86_64.amd64'
 * S: '/var/tmp/portage/media-video/ffmpeg-3.3.5/work/ffmpeg-3.3.5'


I noticed most of those errors point to assembly code for SIMD extensions. Yet, even trying it with CPU_FLAGS_X86 set to "" didn't work.

So I altered the flags I set in package.env to this:

Code:
CFLAGS="-O2 -march=native -pipe -fomit-frame-pointer -finline-functions -fsched-pressure -ftree-loop-distribution -fno-pic -no-pie"
CXXFLAGS="${CFLAGS}"
LDFLAGS="-Wl,-O2 -Wl,--as-needed -Wl,--hash-style=gnu -Wl,--sort-common -Wl,--strip-debug ${CFLAGS}"


in an attempt to undo the profile's -pie flag. Now I receive the following error:

Code:
x86_64-pc-linux-gnu-gcc -m32 -shared -Wl,-soname,libavutil.so.55 -Wl,-Bsymbolic -Wl,--version-script,libavutil/libavutil.ver -Llibavcodec -Llibavdevice -Llibavfilter -Llibavformat -Llibavresample -Llibavutil -Llibpostproc -Llibswscale -Llibswresample -Wl,-O2 -Wl,--as-needed -Wl,--hash-style=gnu -Wl,--sort-common -Wl,--strip-debug -O2 -march=native -pipe -fomit-frame-pointer -finline-functions -fsched-pressure -ftree-loop-distribution -fno-pic -no-pie  -march=skylake -Wl,--as-needed -Wl,-z,noexecstack -Wl,--warn-common -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample  -o libavutil/libavutil.so.55 libavutil/adler32.o libavutil/aes.o libavutil/aes_ctr.o libavutil/audio_fifo.o libavutil/avstring.o libavutil/base64.o libavutil/blowfish.o libavutil/bprint.o libavutil/buffer.o libavutil/camellia.o libavutil/cast5.o libavutil/channel_layout.o libavutil/color_utils.o libavutil/cpu.o libavutil/crc.o libavutil/des.o libavutil/dict.o libavutil/display.o libavutil/downmix_info.o libavutil/error.o libavutil/eval.o libavutil/fifo.o libavutil/file.o libavutil/file_open.o libavutil/fixed_dsp.o libavutil/float_dsp.o libavutil/frame.o libavutil/hash.o libavutil/hmac.o libavutil/hwcontext.o libavutil/hwcontext_cuda.o libavutil/imgutils.o libavutil/integer.o libavutil/intmath.o libavutil/lfg.o libavutil/lls.o libavutil/log.o libavutil/log2_tab.o libavutil/lzo.o libavutil/mastering_display_metadata.o libavutil/mathematics.o libavutil/md5.o libavutil/mem.o libavutil/murmur3.o libavutil/opt.o libavutil/parseutils.o libavutil/pixdesc.o libavutil/pixelutils.o libavutil/random_seed.o libavutil/rational.o libavutil/rc4.o libavutil/reverse.o libavutil/ripemd.o libavutil/samplefmt.o libavutil/sha.o libavutil/sha512.o libavutil/spherical.o libavutil/stereo3d.o libavutil/tea.o libavutil/threadmessage.o libavutil/time.o libavutil/timecode.o libavutil/tree.o libavutil/twofish.o libavutil/utils.o libavutil/x86/cpu.o libavutil/x86/cpuid.o libavutil/x86/fixed_dsp.o libavutil/x86/fixed_dsp_init.o libavutil/x86/float_dsp.o libavutil/x86/float_dsp_init.o libavutil/x86/imgutils.o libavutil/x86/imgutils_init.o libavutil/x86/lls.o libavutil/x86/lls_init.o libavutil/x86/pixelutils.o libavutil/x86/pixelutils_init.o libavutil/xga_font_data.o libavutil/xtea.o  -lXv -lX11 -lXext -ldl -L/usr/lib32 -lxcb -L/usr/lib32 -lxcb-shm -L/usr/lib32 -lxcb-xfixes -L/usr/lib32 -lxcb-shape -lasound -L/usr/lib32 -lSDL2 -L/usr/lib32 -lssl -lcrypto -lGL -lxvidcore -L/usr/lib32 -lx264 -lvorbisenc -lvorbis -logg -lopenjp2 -lmp3lame -L/usr/lib32 -lfreetype -lm -llzma -lbz2 -lz -pthread
x86_64-pc-linux-gnu-gcc -m32 -I. -Isrc/ -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DZLIB_CONST -DHAVE_AV_CONFIG_H -O2 -march=native -pipe -fomit-frame-pointer -finline-functions -fsched-pressure -ftree-loop-distribution -fno-pic -no-pie   -march=skylake -std=c11 -fomit-frame-pointer -pthread -I/usr/include/freetype2   -D_REENTRANT -I/usr/include/SDL2  -Wdeclaration-after-statement -Wall -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -Wmissing-prototypes -Wno-pointer-to-int-cast -Wstrict-prototypes -Wempty-body -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -Wno-unused-const-variable -O2 -march=native -pipe -fomit-frame-pointer -finline-functions -fsched-pressure -ftree-loop-distribution -fno-pic -no-pie -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -Werror=format-security -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=return-type -Werror=vla -Wformat -fdiagnostics-color=auto -Wno-maybe-uninitialized  -MMD -MF libavcodec/aacps_fixed.d -MT libavcodec/aacps_fixed.o -c -o libavcodec/aacps_fixed.o src/libavcodec/aacps_fixed.c
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../lib32/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: error: ld returned 1 exit status
make: *** [/var/tmp/portage/media-video/ffmpeg-3.3.5/work/ffmpeg-3.3.5/library.mak:94: libavutil/libavutil.so.55] Error 1
make: *** Waiting for unfinished jobs....
echo skipping strip -wN '..@*' libswresample/x86/audio_convert.o
skipping strip -wN ..@* libswresample/x86/audio_convert.o
 * ERROR: media-video/ffmpeg-3.3.5::gentoo failed (compile phase):
 *   emake failed
 *
 * If you need support, post the output of `emerge --info '=media-video/ffmpeg-3.3.5::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=media-video/ffmpeg-3.3.5::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/media-video/ffmpeg-3.3.5/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/media-video/ffmpeg-3.3.5/temp/environment'.
 * Working directory: '/var/tmp/portage/media-video/ffmpeg-3.3.5/work/ffmpeg-3.3.5-abi_x86_32.x86'
 * S: '/var/tmp/portage/media-video/ffmpeg-3.3.5/work/ffmpeg-3.3.5'


This is the output of "emerge --info ffmpeg":

Code:
Portage 2.3.13 (python 3.5.4-final-0, default/linux/amd64/17.0/desktop/plasma, gcc-7.2.0, glibc-2.25-r9, 4.12.12-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.12.12-gentoo-x86_64-Intel-R-_Core-TM-_i5-6500_CPU_@_3.20GHz-with-gentoo-2.4.1
KiB Mem:    16371756 total,   2400060 free
KiB Swap:    2246652 total,   2246652 free
Timestamp of repository gentoo: Mon, 04 Dec 2017 17:30:02 +0000
Head commit of repository gentoo: a7a737683112e67f0add35f67433084fc2335d41
sh bash 4.3_p48-r1
ld GNU ld (Gentoo 2.29.1 p3) 2.29.1
app-shells/bash:          4.3_p48-r1::gentoo
dev-lang/perl:            5.24.3::gentoo
dev-lang/python:          2.7.14-r1::gentoo, 3.4.5::gentoo, 3.5.4-r1::gentoo
dev-util/cmake:           3.8.2::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.4.1-r2::gentoo
sys-apps/openrc:          0.34.11::gentoo
sys-apps/sandbox:         2.10-r4::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69::gentoo
sys-devel/automake:       1.15.1-r1::gentoo
sys-devel/binutils:       2.29.1-r1::gentoo
sys-devel/gcc:            6.4.0::gentoo, 7.2.0::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1::gentoo
sys-kernel/linux-headers: 4.4::gentoo (virtual/os-headers)
sys-libs/glibc:           2.25-r9::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-extra-opts:

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=native -pipe -fomit-frame-pointer -finline-functions -fsched-pressure -ftree-loop-distribution -flto=4 -ffat-lto-objects -fuse-linker-plugin -floop-interchange -floop-strip-mine -floop-block -fgraphite-identity"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -march=native -pipe -fomit-frame-pointer -finline-functions -fsched-pressure -ftree-loop-distribution -flto=4 -ffat-lto-objects -fuse-linker-plugin -floop-interchange -floop-strip-mine -floop-block -fgraphite-identity"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs candy cgroup config-protect-if-modified distlocks ebuild-locks fail-clean fixlafiles merge-sync multilib-strict news preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O2 -Wl,--as-needed -Wl,--hash-style=gnu -Wl,--sort-common -Wl,--strip-debug -O2 -march=native -pipe -fomit-frame-pointer -finline-functions -fsched-pressure -ftree-loop-distribution -flto=4 -ffat-lto-objects -fuse-linker-plugin -floop-interchange -floop-strip-mine -floop-block -fgraphite-identity"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="3dnow 3dnowext X \ a52 aac aalib acl acpi activities alsa amd64 bash-completion berkdb bluetooth branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cups cxx dbus declarative dri dts dvd dvdr emboss encode exif fam ffmpeg firefox flac fortran gdbm gif glamor gpm gtk iconv ipv6 jpeg jpeg2k kde kipi kwallet lcms ldap libnotify lzma mad mng modules mp3 mp4 mpeg mplayer multilib mysql ncurses nptl offensive ogg opengl openmp openssl pam pango pcre pdf phonon plasma png policykit ppds python qml qt3support qt5 readline sdl seccomp session socks5 spell ssl startup-notification svg symlink tcpd tiff truetype udev udisks unicode upower usb videos vorbis widgets wmf wxwidgets x264 xattr xcb xcomposite xine xinerama xml xscreensaver xv xvid zlib" ABI_X86="64 32" ALSA_CARDS="hda-intel" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" L10N="en en-US" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-0" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_5" PYTHON_TARGETS="python2_7 python3_5" RUBY_TARGETS="ruby22" USERLAND="GNU" VIDEO_CARDS="nvidia nv vesa" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

=================================================================
                        Package Settings
=================================================================

media-video/ffmpeg-3.3.5::gentoo was built with the following:
USE="X alsa bzip2 encode gpl hardcoded-tables iconv jpeg2k lzma mp3 network opengl openssl postproc sdl threads truetype vorbis x264 xcb xvid zlib (-altivec) -amr -amrenc -bluray -bs2b -cdio -celt -chromaprint -chromium -cpudetection -debug -doc -fdk -flite -fontconfig -frei0r -fribidi -gcrypt -gme -gmp -gnutls -gsm -iec61883 -ieee1394 -jack -kvazaar -ladspa -libass -libcaca -libilbc -librtmp -libsoxr -libv4l (-mipsdspr1) (-mipsdspr2) (-mipsfpu) (-mmal) -modplug -nvenc -openal -openh264 -opus -oss -pic -pulseaudio -rubberband -samba -schroedinger -snappy -sofalizer -speex -ssh -static-libs -test -theora -twolame -v4l -vaapi -vdpau -vpx -wavpack -webp -x265 -zeromq -zimg -zvbi" ABI_X86="32 (64) (-x32)" CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext sse sse2 sse3 sse4_1 sse4_2 ssse3 -3dnow -3dnowext -fma4 -xop" FFTOOLS="aviocat cws2fws ffescape ffeval ffhash fourcc2pixfmt graph2dot ismindex pktdumper qt-faststart sidxindex trasher"


Please note that ffmpeg is set up in package.env to be built with the aforementioned CFLAGS, which disallows LTO and Graphite (which I am using for almost everything else, as shown in "emerge --info" output).

So is there simply no way to successfully build media-video/ffmpeg now that I've switched to the new Profile 17? Has anyone else encountered this issue? Please help.


Last edited by causality on Fri Dec 08, 2017 12:07 am; edited 1 time in total
Back to top
View user's profile Send private message
NightMonkey
Guru
Guru


Joined: 21 Mar 2003
Posts: 356
Location: Philadelphia, PA

PostPosted: Thu Dec 07, 2017 2:14 pm    Post subject: Reply with quote

Yep, ffmpeg build seems broken on 17.0 profile for me as well (though the compiler errors out in a different location than yours). I added some info to this old, seemingly related bug: https://bugs.gentoo.org/578802
_________________
:D
Back to top
View user's profile Send private message
artbody
Guru
Guru


Joined: 15 Sep 2006
Posts: 489
Location: LB

PostPosted: Thu Dec 07, 2017 2:30 pm    Post subject: Reply with quote

i'm running a profile 17 system since yesterday
ffmpeg has compiled without issues
but not with gcc 7

Code:

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] media-video/ffmpeg-3.3.5:0/55.57.57::gentoo  USE="X alsa bzip2 encode gpl hardcoded-tables iconv mp3 network opengl postproc pulseaudio sdl theora threads truetype vorbis x264 xcb xvid zlib (-altivec) -amr -amrenc -bluray -bs2b -cdio -celt -chromaprint -chromium -cpudetection -debug -doc -fdk -flite -fontconfig -frei0r -fribidi -gcrypt -gme -gmp -gnutls -gsm -iec61883 -ieee1394 -jack -jpeg2k -kvazaar -ladspa -libass -libcaca -libilbc -librtmp -libsoxr -libv4l -lzma (-mipsdspr1) (-mipsdspr2) (-mipsfpu) (-mmal) -modplug -nvenc -openal -openh264 -openssl -opus -oss -pic -rubberband -samba -schroedinger -snappy -sofalizer -speex -ssh -static-libs {-test} -twolame -v4l -vaapi -vdpau -vpx -wavpack -webp -x265 -zeromq -zimg -zvbi" ABI_X86="(64) -32 (-x32)" CPU_FLAGS_X86="aes avx fma3 fma4 mmx mmxext sse sse2 sse3 sse4_1 sse4_2 ssse3 xop -3dnow -3dnowext -avx2" FFTOOLS="aviocat cws2fws ffescape ffeval ffhash fourcc2pixfmt graph2dot ismindex pktdumper qt-faststart sidxindex trasher" 0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB

Would you like to merge these packages? [Yes/No] no




stable is gcc 6.4
Code:
 emerge -av  sys-devel/gcc

 * IMPORTANT: 1 news items need reading for repository 'gentoo'.
 * Use eselect news read to view new items.


These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] sys-devel/gcc-6.4.0:6.4.0::gentoo  USE="cxx fortran (multilib) nls nptl openmp pch (pie) sanitize ssp vtv (-altivec) (-awt) -cilk -debug -doc (-fixed-point) (-gcj) -go -graphite (-hardened) (-jit) (-libssp) -mpx -objc -objc++ -objc-gc -pgo -regression-test -vanilla" 0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB

_________________
Never give up
WM : E16 the true enlightenment
achim
Back to top
View user's profile Send private message
causality
Apprentice
Apprentice


Joined: 03 Jun 2006
Posts: 236

PostPosted: Fri Dec 08, 2017 12:02 am    Post subject: Reply with quote

N.B. this is with the new Profile 17 so -fpic/-pie is implied for all that follows.

I went back to package.env again and set only basic CFLAGS for ffmpeg.

The line in my /etc/portage/package.env:

Code:
media-video/ffmpeg basic-cflags.conf


The contents of /etc/portage/env/basic-cflags.conf:

Code:
CFLAGS="-march=native -O2 -pipe"
CXXFLAGS="-march=native -O2 -pipe"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu -Wl,--sort-common -Wl,--strip-debug ${CFLAGS}"


I always keep at least one previous, known-working compiler around, especially if I'm upgrading to an ~arch compiler like gcc-7.2.0 currently is. So I switched back to gcc-6.4.0 and re-emerged ffmpeg. It worked!

Then, to further experiment, I switched to gcc-7.2.0 once again but kept everything else the same (basic CFLAGS).

Sure enough, that worked too!

Incidentally here is my CPU FLAGS variable (skylake i5 processor):

Code:
CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3"


... so I know these custom assembly routines are being built.

As a further experiment, I continued with gcc-7.2.0 and compiled it with the following environment:

Code:
CFLAGS="-march=native -O2 -fomit-frame-pointer -finline-functions -ftracer -fgcse-sm -fgcse-las -fipa-pta -fsched-pressure -ftree-loop-distribution -pipe"
CXXFLAGS="${CFLAGS}"
LDFLAGS="-Wl,-O2 -Wl,--as-needed -Wl,--hash-style=gnu -Wl,--sort-common -Wl,--strip-debug ${CFLAGS}"


This also worked!

So I thought I'd try it with Graphite but no LTO flags, again with gcc-7.2.0:

Code:
CFLAGS="-O2 -march=native -fomit-frame-pointer -finline-functions -fsched-pressure -ftree-loop-distribution -pipe -floop-interchange -floop-strip-mine -floop-block -fgraphite-identity"
CXXFLAGS="${CFLAGS}"
LDFLAGS="-Wl,-O2 -Wl,--as-needed -Wl,--hash-style=gnu -Wl,--sort-common -Wl,--strip-debug ${CFLAGS}"


Wouldn't you know, that worked too.

Apparently it's an LTO issue, it just doesn't look like any (typically "undefined reference to X") I've usually seen before. Maybe that's because most packages don't include so much hand-crafted assembly?

Well, with that my "emerge --emptytree @world" is done and so my update to Profile 17 is complete.

Artbody, are you using LTO at all? I would hazard a guess that you are not but I am curious.

Nightmonkey, perhaps this will work for you as well?
Back to top
View user's profile Send private message
NightMonkey
Guru
Guru


Joined: 21 Mar 2003
Posts: 356
Location: Philadelphia, PA

PostPosted: Fri Dec 08, 2017 7:14 pm    Post subject: Reply with quote

@causality - this worked for ffmpeg! Now trying it on Chromium (which also failed in the built-in ffmpeg code during build). THANKS!
_________________
:D
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum