Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails with LTO #41

Open
eli-schwartz opened this issue May 5, 2024 · 0 comments
Open

Build fails with LTO #41

eli-schwartz opened this issue May 5, 2024 · 0 comments

Comments

@eli-schwartz
Copy link

I tried to build with the following *FLAGS to optimize the build: -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing

Note the -Werror=* flags are used to help detect cases where the compiler tries to optimize by assuming UB cannot exist in the source code -- if it does exist, ordinarily the code would be miscompiled, and this says to make the miscompilation a fatal error.

I got this error:

make[1]: Entering directory '/var/tmp/portage/media-plugins/x42-plugins-20220714/work/x42-plugins-20220714/meters.lv2'
x86_64-pc-linux-gnu-g++  -I. -march=native -fstack-protector-all -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing  -Wformat -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Werror=int-conversion -Werror=incompatible-pointer-types -g -msse -msse2 -mfpmath=sse -fomit-frame-pointer -O3 -fno-finite-math-only -DNDEBUG -DXTERNAL_UI -DHAVE_LV2_1_8 -fPIC -fvisibility=hidden `pkg-config --cflags lv2` -DVERSION="\"0.9.22\"" -march=native -fstack-protector-all -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing  -Wformat -Werror=format-security -DVERSION="\"0.9.22\"" `pkg-config --cflags cairo pangocairo pango` -I../robtk/ -DDISPLAY_INTERFACE -I.  `pkg-config --cflags jack lv2 pango pangocairo ` `pkg-config  --cflags liblo` -DHAVE_LIBLO -pthread -DDEFAULT_NOT_ONTOP \
  -DXTERNAL_UI -DHAVE_IDLE_IFACE \
  -DJACK_DESCRIPT="\"lv2ttl/plugins.h\"" \
  -DAPPNAME="\"meter\"" \
  -o x42/x42-meter-collection \
  ../robtk/jackwrap.c ../robtk/pugl/pugl_x11.c   \
  -DX42_MULTIPLUGIN src/meters.cc jmeters/vumeterdsp.cc jmeters/iec1ppmdsp.cc jmeters/iec2ppmdsp.cc jmeters/stcorrdsp.cc jmeters/msppmdsp.cc ebumeter/ebu_r128_proc.cc jmeters/truepeakdsp.cc jmeters/kmeterdsp.cc zita-resampler/resampler.cc zita-resampler/resampler-table.cc x42/x42-ebur128.o x42/x42-phase-correlation.o x42/x42-dr14.o x42/x42-k20rms.o x42/x42-goniometer.o x42/x42-phasewheel.o x42/x42-histogram.o x42/x42-bitmeter.o x42/x42-surmeter.o x42/x42-spectrum30.o x42/x42-stereoscope.o x42/x42-truepeakrms.o `pkg-config --cflags --libs fftw3f` -lm \
  -Wl,-O1 -Wl,--as-needed -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wl,--defsym=__gentoo_check_ldflags__=0 -lm -lX11 `pkg-config --libs  cairo pangocairo pango glu gl`  `pkg-config  --libs jack` `pkg-config  --libs liblo`
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-function-declaration’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-int’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=int-conversion’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=incompatible-pointer-types’ is not valid for C++
../robtk/jackwrap.c: In function ‘int main(int, char**)’:
../robtk/jackwrap.c:1671:30: warning: ignoring return value of ‘int system(const char*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
 1671 |                 (void)system ("xmessage -button ok -center \"Cannot connect to JACK.\nPlease start the JACK Server first.\" &");
      |                       ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-function-declaration’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-int’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=int-conversion’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=incompatible-pointer-types’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-function-declaration’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-int’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=int-conversion’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=incompatible-pointer-types’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-function-declaration’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-int’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=int-conversion’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=incompatible-pointer-types’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-function-declaration’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-int’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=int-conversion’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=incompatible-pointer-types’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-function-declaration’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-int’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=int-conversion’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=incompatible-pointer-types’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-function-declaration’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-int’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=int-conversion’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=incompatible-pointer-types’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-function-declaration’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-int’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=int-conversion’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=incompatible-pointer-types’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-function-declaration’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-int’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=int-conversion’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=incompatible-pointer-types’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-function-declaration’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-int’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=int-conversion’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=incompatible-pointer-types’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-function-declaration’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-int’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=int-conversion’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=incompatible-pointer-types’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-function-declaration’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-int’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=int-conversion’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=incompatible-pointer-types’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-function-declaration’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-int’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=int-conversion’ is not valid for C++
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=incompatible-pointer-types’ is not valid for C++
src/goniometer.h:168:3: error: type ‘struct LV2gm’ violates the C++ One Definition Rule [-Werror=odr]
  168 | } LV2gm;
      |   ^
./gui/../src/goniometer.h:168:3: note: a different type is defined in another translation unit
  168 | } LV2gm;
      |   ^
src/goniometer.h:151:20: note: the first difference of corresponding definitions is field ‘cor’
  151 |         Stcorrdsp *cor;
      |                    ^
./gui/../src/goniometer.h:151:20: note: a field of same name but different type is defined in another translation unit
  151 |         Stcorrdsp *cor;
      |                    ^
src/../jmeters/stcorrdsp.h:27:7: note: type ‘struct Stcorrdsp’ should match type ‘Stcorrdsp’
   27 | class Stcorrdsp
      |       ^
src/meters.cc:68:6: error: type ‘MtrType’ violates the C++ One Definition Rule [-Werror=odr]
   68 | enum MtrType {
      |      ^
./gui/needle.c:34:6: note: an enum with different value name is defined in another translation unit
   34 | enum MtrType {
      |      ^
src/meters.cc:69:9: note: name ‘MT_NONE’ differs from name ‘MT_BBC’ defined in another translation unit
   69 |         MT_NONE = 0,
      |         ^
./gui/needle.c:35:9: note: mismatching definition
   35 |         MT_BBC = 1,
      |         ^
lto1: some warnings being treated as errors
lto-wrapper: fatal error: x86_64-pc-linux-gnu-g++ returned 1 exit status
compilation terminated.
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make[1]: *** [../robtk/robtk.mk:125: x42/x42-meter-collection] Error 1
make[1]: Leaving directory '/var/tmp/portage/media-plugins/x42-plugins-20220714/work/x42-plugins-20220714/meters.lv2'
make: *** [Makefile:40: meters.lv2] Error 2
 * ERROR: media-plugins/x42-plugins-20220714::gentoo failed (compile phase):

Note this is built via the x42-plugins repo, but I checked this repo and the code pattern is still there.

Originally reported downstream: https://bugs.gentoo.org/860402
Full build log: build.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant