Build failure with --enable-lto (default on 2.7.8)

Started by claudio laurita, May 29, 2021, 04:05:35 PM

Previous topic - Next topic

claudio laurita

I'm trying to build (as usual since 2.6) on a 32 bit Debian.
With current avidemux_2.7.8.tar.gz and the usual command
./bootStrap.bash --rebuild --deb --prefix=/usr/local/build fails with the following log:
LD      libswscale/libADM6swscale.so.5
src/libswscale/x86/rgb2rgb_template.c: In function 'rgb24toyv12_mmx':
src/libswscale/x86/rgb2rgb_template.c:1665:9: error: 'asm' operand has impossible constraints
 1665 |         __asm__ volatile(
      |         ^
lto-wrapper: fatal error: /usr/bin/cc returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
/usr/src/avidemux_2.7.8/buildCore/ffmpeg/source/ffbuild/library.mak:102: set di istruzioni per l'obiettivo "libswscale/libADM6swscale.so.5" non riuscito
make[3]: *** [libswscale/libADM6swscale.so.5] Errore 1
make[3]: *** Attesa per i processi non terminati....
src/libavcodec/cabac_functions.h: In function 'get_cabac_noinline':
src/libavcodec/x86/cabac.h:192:5: error: 'asm' operand has impossible constraints
  192 |     __asm__ volatile(
      |     ^
lto-wrapper: fatal error: /usr/bin/cc returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
/usr/src/avidemux_2.7.8/buildCore/ffmpeg/source/ffbuild/library.mak:102: set di istruzioni per l'obiettivo "libavcodec/libADM6avcodec.so.58" non riuscito
make[3]: *** [libavcodec/libADM6avcodec.so.58] Errore 1

I noticed that in cmake/admFFmpegBuild_native.cmake have been added the lines
if (NOT APPLE)^M
    xadd(--enable-lto)^M
endif (NOT APPLE)^M

Removing those lines (therefore removing --enable-lto) the build succeeds.
This is the output of bootStrap.bash:
CMAKE Version : 3.18.4
Cmake version >=2.8.7 doesnt need fakeroot
Build configuration :
******************* :
Build type :
Release build
    Core will be built
    Qt5 will be built
    Cli will be built
    Plugins will be built
**BootStrapping avidemux **
Top dir : /usr/src/avidemux_2.7.8
Fake installation directory=/usr/src/avidemux_2.7.8/install
Cleaning packages
** CORE **
Building buildCore from ../avidemux_core with EXTRA=<>, DEBUG=<>
-- The C compiler identification is GNU 10.2.1
-- The CXX compiler identification is GNU 10.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done

#########################################
Configure for avidemux core libs Started
#########################################

-- [BUILD] EXTRA Cflags:
-- [BUILD] EXTRA CXXflags:
-- [BUILD] EXTRA LDflags:
-- [BUILD] Compiler /usr/bin/c++
-- [BUILD] Linker   /usr/bin/ld
-- Top Source dir is /usr/src/avidemux_2.7.8/avidemux_core/..

-- Checking Compiler support
-- *************************
-- Checking if compiler supports x86 32-bit - Yes
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Searching 16 bit integer - Using unsigned short
-- Check if the system is big endian - little endian

-- CMAKE_INSTALL_PREFIX: /usr/local
-- AVIDEMUX_INSTALL_DIR: /usr/local
-- FAKEROOT                   : /usr/src/avidemux_2.7.8/install/
-- AVIDEMUX_BIN_DIR           : /usr/local/bin
-- AVIDEMUX_LIB_DIR           : /usr/local/lib
-- AVIDEMUX_INCLUDE_DIR       : /usr/local/include
-- AVIDEMUX_SEARCH_INCLUDE_DIR: /usr/src/avidemux_2.7.8/install//usr/local/include
-- AVIDEMUX_SEARCH_LIB_DIR    : /usr/src/avidemux_2.7.8/install//usr/local/lib

-- Checking for SCM
-- ****************
-- Dont know what SCM is used

-- Checking for pkg-config
-- ***********************
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29")
-- Found pkg-config

-- Checking for pthreads
-- *********************
-- Found pthreads

-- Checking for zlib
-- *****************
-- Found ZLIB: /usr/lib/i386-linux-gnu/libz.so (found version "1.2.11")
-- Found zlib

-- Checking for gettext
-- ********************
-- Found libintl.h
-- Cound not find intl library
-- Could not find Gettext
-- libintl not required for gettext support

-- Checking for SDL>=2 (only for windows)
-- **************************************
Disabled per request

-- Checking for XVideo
-- *******************
-- Found X11/extensions/Xvlib.h
-- Found Xv library
-- Found XvShmPutImage in /usr/lib/i386-linux-gnu/libXv.so
-- Found X11/extensions/XShm.h
-- Found Xext library
-- Found XShmAttach in /usr/lib/i386-linux-gnu/libXext.so
-- Found XVideo
-- Found Xext

-- Checking for execinfo
-- *********************
-- Found execinfo.h
-- Found c library
-- Found backtrace_symbols in /usr/lib/i386-linux-gnu/libc.so
-- Found execinfo
-- execinfo not required

-- Checking for NVENC
-- *****************
-- Checking for module 'ffnvcodec'
--   No package 'ffnvcodec' found
-- FFNVENC not found, you can get it from here https://github.com/FFmpeg/nv-codec-headers

-- Checking system headers
-- ***********************
-- Looking for gettimeofday
-- Looking for gettimeofday - found
-- Looking for include file inttypes.h
-- Looking for include file inttypes.h - found

-- Bonanza
-- Checking for YASM
-- *****************
-- Found as /usr/bin/yasm

-- Checking for ftello
-- ********************
-- ftello present

-- Checking for sqlite
-- *******************
-- Checking for Sqlite3
-- ********************
-- Checking for module 'sqlite3'
--   Found sqlite3, version 3.34.1
-- Found Sqlite3

-- Found SQLite

-- Checking for VDPAU
-- *******************
-- Found vdpau/vdpau.h
-- Found VDPAU

-- Checking for LIBVA
-- *******************
-- Found va/va.h
-- Checking it is the right version...
--     yes
-- Checking for HEVC decoder, result of OUTPUT_IS_OK_LIBVA_HEVC_DEC is  TRUE
-- HEVC decoder is supported
-- Checking for VP9 decoder, result of OUTPUT_IS_OK_LIBVA_VP9_DEC is  TRUE
-- VP9 decoder is supported
-- Checking for DUMMY decoder, result of OUTPUT_IS_OK_LIBVA_DUMMY_DEC is  FALSE
-- DUMMY decoder is not supported
-- LibVA cflags=<-DLIBVA_HEVC_DEC;-DLIBVA_VP9_DEC>
-- Found LIBVA

-- ADM_coreConfig.h generated

-- Using native unix setup
-- Checking for patch
-- ******************
-- Found patch

-- Could not find x265.h
-- Could not find x265_config.h
-- Creating /usr/src/avidemux_2.7.8/buildCore/ffmpeg
-- Checking for tar
-- ****************
-- Found tar

-- Unpacking ffmpeg from /usr/src/avidemux_2.7.8/avidemux_core/../avidemux_core/ffmpeg_package/ffmpeg-4.2.4.tar.bz2 to /usr/src/avidemux_2.7.8/buildCore/ffmpeg
-- -- Mine, Applying patch <libavcodec_ac3_h.patch> --
patching file libavcodec/ac3tab.h
-- -- Mine, Applying patch <libavcodec_ff_spsinfo.h.patch> --
patching file libavcodec/ff_spsinfo.h
-- -- Mine, Applying patch <libavcodec_golomb.h.patch> --
patching file libavcodec/golomb.h
-- -- Mine, Applying patch <libavcodec_h264_parser.c.patch> --
patching file libavcodec/h264_parser.c
-- -- Mine, Applying patch <libavcodec_hevc_parser.c.patch> --
patching file libavcodec/hevc_parser.c
-- -- Mine, Applying patch <libavcodec_internal_h_msvc.patch> --
patching file libavcodec/internal.h
-- -- Mine, Applying patch <libavcodec_libavcodec.v.patch> --
patching file libavcodec/libavcodec.v
-- -- Mine, Applying patch <libavcodec_mathops.h.patch> --
patching file libavcodec/mathops.h
-- -- Mine, Applying patch <libavcodec_mpegvideo_enc.c.patch> --
patching file libavcodec/mpegvideo_enc.c
-- -- Mine, Applying patch <libavcodec_nvenc.c.patch> --
patching file libavcodec/nvenc.c
Hunk #1 succeeded at 1883 (offset 23 lines).
-- -- Mine, Applying patch <libavcodec_nvenc.patch> --
patching file libavcodec/nvenc.c
Hunk #2 succeeded at 1261 (offset 18 lines).
Hunk #3 succeeded at 1276 (offset 18 lines).
Hunk #4 succeeded at 1542 (offset 18 lines).
Hunk #5 succeeded at 1594 (offset 18 lines).
-- -- Mine, Applying patch <libavformat_file.c.patch> --
patching file libavformat/file.c
-- -- Mine, Applying patch <libavformat_isom.c.patch> --
patching file libavformat/isom.c
-- -- Mine, Applying patch <libavformat_libavformat.v.patch> --
patching file libavformat/libavformat.v
-- -- Mine, Applying patch <libavformat_matroskaenc.c.patch> --
patching file libavformat/matroskaenc.c
Hunk #1 succeeded at 630 (offset 3 lines).
Hunk #2 succeeded at 656 (offset 3 lines).
Hunk #3 succeeded at 1241 (offset 3 lines).
-- -- Mine, Applying patch <libavformat_matroskaenc_vp9.c.patch> --
patching file libavformat/matroskaenc.c
Hunk #1 succeeded at 2811 (offset 28 lines).
-- -- Mine, Applying patch <libavformat_mpegtsenc.c.patch> --
patching file libavformat/mpegtsenc.c
-- -- Mine, Applying patch <libavutil_avassert_h.patch> --
patching file libavutil/avassert.h
-- -- Mine, Applying patch <libavutil_avutil.h.patch> --
patching file libavutil/avutil.h
-- -- Mine, Applying patch <libavutil_file_open.c.patch> --
patching file libavutil/file_open.c
-- -- Mine, Applying patch <libavutil_libavutil.v.patch> --
patching file libavutil/libavutil.v
-- -- Mine, Applying patch <libavutil_log_c.patch> --
patching file libavutil/log.c
-- -- Mine, Applying patch <libavutil_timer.h.patch> --
patching file libavutil/timer.h
-- -- Mine, Applying patch <libpostproc_libpostproc.v.patch> --
patching file libpostproc/libpostproc.v
-- -- Mine, Applying patch <libswscale_libswscale.v.patch> --
patching file libswscale/libswscale.v


-- Patching Linux common.mak
patching file ffbuild/common.mak
Hunk #1 succeeded at 117 (offset -1 lines).
-- Checking for Bourne shell
-- *************************
-- Found Bourne shell

-- Checking for GNU Make
-- *********************
-- Found GNU Make

-- Configuring FFmpeg
-- Configuring done, processing
-- AVFORMAT : 58, Major :
-- AVCODEC  : 58, Major :
-- AVUTIL   : 56, Major :
-- POSTPRC  : 55, Major :
-- SWSCALE  : 5, Major :

-- AVFORMAT : 58, Major :
-- AVCODEC  : 58, Major :
-- AVUTIL   : 56, Major :
-- POSTPRC  : 55, Major :
-- SWSCALE  : 5, Major :

-- Patching Linux config.mak
patching file ffbuild/config.mak
Hunk #1 succeeded at 121 (offset 2 lines).
-- YASMIFY :
--     /usr/src/avidemux_2.7.8/avidemux_core/ADM_core/src/cpuid.asm ==> /usr/src/avidemux_2.7.8/buildCore/ADM_core/src/cpuid.obj
--     /usr/src/avidemux_2.7.8/avidemux_core/ADM_core/src/adm_emms.asm ==> /usr/src/avidemux_2.7.8/buildCore/ADM_core/src/adm_emms.obj
-- ASM files : /usr/src/avidemux_2.7.8/buildCore/ADM_core/src/cpuid.obj;/usr/src/avidemux_2.7.8/buildCore/ADM_core/src/adm_emms.obj
-- List of asm files /usr/src/avidemux_2.7.8/buildCore/ADM_core/src/cpuid.obj;/usr/src/avidemux_2.7.8/buildCore/ADM_core/src/adm_emms.obj
-- YASMIFY :
--     /usr/src/avidemux_2.7.8/avidemux_core/ADM_coreImage/src/ADM_imageUtils_asm.asm ==> /usr/src/avidemux_2.7.8/buildCore/ADM_coreImage/src/ADM_imageUtils_asm.obj
-- ASM files : /usr/src/avidemux_2.7.8/buildCore/ADM_coreImage/src/ADM_imageUtils_asm.obj

**************************
***  Optional Library  ***
***      Summary       ***
**************************
*** Video Encoder      ***
    NVENC          No
*** Miscellaneous      ***
    gettext        Yes
    SDL            No
    XVideo         Yes
    VDPAU          Yes
    LIBVA          Yes
**************************
***   Release Build    ***
**************************

-- Packager=deb, valid choices= {deb,rpm,tgz,none}

-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_EDIT_COMMAND
    ENABLE_QT5


-- Build files have been written to: /usr/src/avidemux_2.7.8/buildCore
*
Please tell me if I could send other information.

Regards
Claudio

eumagga0x2a

Thank you for the info, could you please test whether the same applies to the latest git master?

claudio laurita

sorry for the delay
the error is very similar:
LD      libswscale/libADM6swscale.so.5
src/libswscale/x86/swscale_template.c: In function 'yuv2bgr24_X_ar_mmx':
src/libswscale/x86/swscale_template.c:623:5: error: 'asm' operand has impossible constraints
  623 |     YSCALEYUV2PACKEDX_ACCURATE
      |     ^
lto-wrapper: fatal error: /usr/bin/cc returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
/tmp/avidemux2/buildCore/ffmpeg/source/ffbuild/library.mak:102: set di istruzioni per l'obiettivo "libswscale/libADM6swscale.so.5" non riuscito
make[3]: *** [libswscale/libADM6swscale.so.5] Errore 1
make[3]: *** Attesa per i processi non terminati....
src/libavcodec/cabac_functions.h: In function 'get_cabac_noinline':
src/libavcodec/x86/cabac.h:194:5: error: 'asm' operand has impossible constraints
  194 |     __asm__ volatile(
      |     ^
lto-wrapper: fatal error: /usr/bin/cc returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
/tmp/avidemux2/buildCore/ffmpeg/source/ffbuild/library.mak:102: set di istruzioni per l'obiettivo "libavcodec/libADM6avcodec.so.58" non riuscito
make[3]: *** [libavcodec/libADM6avcodec.so.58] Errore 1

The problem arises when ffmpeg is built with lto enabled.
It seems to me that nothing changed on that side, from tag version to current HEAD.
Claudio

eumagga0x2a

Thank you for testing. Do I understand it right, that the same change which fixes the build for the 2.7.8 release works for the git master?

claudio laurita

Yes
It seems to me that the commit 99797e2d7f688cdac9185d5a626fe80cdbedc1a5 should be revised in some way.
At least, with my configuration it has negative collateral effects.
Maybe, to enable lto on ffmpeg, some modifications have to be made to the inline asm part of ffmpeg. At least with current gcc, I feel.
Claudio

eumagga0x2a

I've disabled LTO on x86 32-bit. LTO is default on 64-bit Fedora (Avidemux won't compile if it is not enabled for FFmpeg) and AFAIK doesn't cause issues on x86_64 Debian.