Re: Build fails with LTO due to ODR violations

RadosÅ‚aw Korzeniewski <[email protected]> Sun, 27 Oct 2024 15:48:54 +0100
Newsgroups gmane.comp.sysutils.backup.bacula.devel
Message-ID <CAF_EmoAycX37jZMeKR63vuWKCJ6yOdWVzLEaeTxvCVgFKs9x3g@mail.gmail.com>
--===============7376494223696272728==
Content-Type: multipart/alternative; boundary="0000000000002183da0625767422"

--0000000000002183da0625767422
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi,

pt., 25 pa=C5=BA 2024 o 13:35 Thomas Beierlein <[email protected]> napisa=
=C5=82(a):

> Hello,
>
> building bacula-15.0.2 here on Gentoo with
> '-Werror=3Dlto-type-mismatch -Werror=3Dstrict-aliasing -Werror=3Dodr -flt=
o'
> failes with the following error:
>
> +++
> Linking bacula-fd ...
> /var/tmp/portage/app-backup/bacula-15.0.2/work/bacula-15.0.2/libtool
> --silent --tag=3DCXX --mode=3Dlink /usr/bin/x86_64-pc-linux-gnu-g++  -Wl,=
-O1
> -Wl,--as-needed -Wl,--hash-style=3Dgnu -Werror=3Dlto-type-mismatch
> -Werror=3Dstrict-aliasing -Werror=3Dodr -flto -L../lib -L../findlib -o
> bacula-fd filed.o authenticate.o backup.o crypto.o win_efs.o estimate.o
> fdcollect.o fd_plugins.o accurate.o bacgpfs.o filed_conf.o runres_conf.o
> heartbeat.o hello.o job.o fd_snapshot.o restore.o status.o verify.o
> verify_vol.o fdcallsdir.o suspend.o org_filed_dedup.o bacl.o bacl_linux.o
> bxattr.o bxattr_linux.o \
>    -lacl              -lz -lbacfind -lbaccfg -lbac -lm \
>   -rpath /usr/lib64   -lssl -lcrypto -lpthread  -lcap  -llzo2 -lzstd
> ../jcr.h:203:7: error: type 'struct JCR' violates the C++ One Definition
> Rule [-Werror=3Dodr]
>   203 | class JCR {
>       |       ^
> ../jcr.h:203:7: note: a different type is defined in another translation
> unit
>   203 | class JCR {
>       |       ^
> ../jcr.h:472:11: note: the first difference of corresponding definitions
> is field 'sd_calls_client_bsock'
>   472 |    BSOCK *sd_calls_client_bsock;      /* Socket used by
> SDCallsClient feature */
>       |           ^
> ../jcr.h:203:7: note: a type with different number of fields is defined i=
n
> another translation unit
>   203 | class JCR {
>       |       ^
> lto1: some warnings being treated as errors
> lto-wrapper: fatal error: /usr/bin/x86_64-pc-linux-gnu-g++ returned 1 exi=
t
> status
> compilation terminated.
> /usr/lib/gcc/x86_64-pc-linux-gnu/15/../../../../x86_64-pc-linux-gnu/bin/l=
d:
> error: lto-wrapper failed
> +++
>
> Looks like the optional extensions of JCR are clashing with the JCR
> definition
> without extensions.
>

JCR is handcrafted differently for every component (#ifdef DIRECTOR_DAEMON,
#ifdef FILE_DAEMON, #ifdef STORAGE_DAEMON) having a common part at the
beginning of the struct.
Looks like file daemon compilation is not separated enough from other
component builds.


>
> See https://bugs.gentoo.org/940695 for original bug and
> https://940695.bugs.gentoo.org/attachment.cgi?id=3D904745 for full build
> log.
>
>
Any chance you can report this bug at: https://gitlab.bacula.org/ ?

best regards
--=20
Rados=C5=82aw Korzeniewski
[email protected]

--0000000000002183da0625767422
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">Hi,<br></div><br><div class=3D"gmail_quot=
e"><div dir=3D"ltr" class=3D"gmail_attr">pt., 25 pa=C5=BA 2024 o 13:35=C2=
=A0Thomas Beierlein &lt;<a href=3D"mailto:[email protected]">tomjbe@gentoo.=
org</a>&gt; napisa=C5=82(a):<br></div><blockquote class=3D"gmail_quote" sty=
le=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);paddi=
ng-left:1ex">Hello,<br>
<br>
building bacula-15.0.2 here on Gentoo with <br>
&#39;-Werror=3Dlto-type-mismatch -Werror=3Dstrict-aliasing -Werror=3Dodr -f=
lto&#39; <br>
failes with the following error:<br>
<br>
+++<br>
Linking bacula-fd ...<br>
/var/tmp/portage/app-backup/bacula-15.0.2/work/bacula-15.0.2/libtool --sile=
nt --tag=3DCXX --mode=3Dlink /usr/bin/x86_64-pc-linux-gnu-g++=C2=A0 -Wl,-O1=
 -Wl,--as-needed -Wl,--hash-style=3Dgnu -Werror=3Dlto-type-mismatch -Werror=
=3Dstrict-aliasing -Werror=3Dodr -flto -L../lib -L../findlib -o bacula-fd f=
iled.o authenticate.o backup.o crypto.o win_efs.o estimate.o fdcollect.o fd=
_plugins.o accurate.o bacgpfs.o filed_conf.o runres_conf.o heartbeat.o hell=
o.o job.o fd_snapshot.o restore.o status.o verify.o verify_vol.o fdcallsdir=
.o suspend.o org_filed_dedup.o bacl.o bacl_linux.o bxattr.o bxattr_linux.o =
\<br>
=C2=A0 =C2=A0-lacl=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 -lz -lba=
cfind -lbaccfg -lbac -lm \<br>
=C2=A0 -rpath /usr/lib64=C2=A0 =C2=A0-lssl -lcrypto -lpthread=C2=A0 -lcap=
=C2=A0 -llzo2 -lzstd<br>
../jcr.h:203:7: error: type &#39;struct JCR&#39; violates the C++ One Defin=
ition Rule [-Werror=3Dodr]<br>
=C2=A0 203 | class JCR {<br>
=C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A0 =C2=A0 =C2=A0^<br>
../jcr.h:203:7: note: a different type is defined in another translation un=
it<br>
=C2=A0 203 | class JCR {<br>
=C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A0 =C2=A0 =C2=A0^<br>
../jcr.h:472:11: note: the first difference of corresponding definitions is=
 field &#39;sd_calls_client_bsock&#39;<br>
=C2=A0 472 |=C2=A0 =C2=A0 BSOCK *sd_calls_client_bsock;=C2=A0 =C2=A0 =C2=A0=
 /* Socket used by SDCallsClient feature */<br>
=C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0^<br>
../jcr.h:203:7: note: a type with different number of fields is defined in =
another translation unit<br>
=C2=A0 203 | class JCR {<br>
=C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A0 =C2=A0 =C2=A0^<br>
lto1: some warnings being treated as errors<br>
lto-wrapper: fatal error: /usr/bin/x86_64-pc-linux-gnu-g++ returned 1 exit =
status<br>
compilation terminated.<br>
/usr/lib/gcc/x86_64-pc-linux-gnu/15/../../../../x86_64-pc-linux-gnu/bin/ld:=
 error: lto-wrapper failed<br>
+++<br>
<br>
Looks like the optional extensions of JCR are clashing with the JCR definit=
ion<br>
without extensions.<br></blockquote><div><br></div><div>JCR is handcrafted =
differently for every component (<code><span class=3D"gmail-hljs-meta"><spa=
n class=3D"gmail-hljs-meta">#</span><span class=3D"gmail-hljs-keyword">ifde=
f</span><span class=3D"gmail-hljs-meta"> DIRECTOR_DAEMON</span></span><span=
 class=3D"gmail-">, </span></code><code><span class=3D"gmail-hljs-meta"><sp=
an class=3D"gmail-hljs-meta">#</span><span class=3D"gmail-hljs-keyword">ifd=
ef</span><span class=3D"gmail-hljs-meta"> FILE_DAEMON</span></span><span cl=
ass=3D"gmail-">, </span></code><code><span class=3D"gmail-hljs-meta"><span =
class=3D"gmail-hljs-meta">#</span><span class=3D"gmail-hljs-keyword">ifdef<=
/span><span class=3D"gmail-hljs-meta"> STORAGE_DAEMON</span></span><span cl=
ass=3D"gmail-"></span></code>) having a common part at the beginning of the=
 struct.<br></div><div>Looks like file daemon compilation is not separated =
enough from other component builds.<br></div><div>=C2=A0</div><blockquote c=
lass=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px soli=
d rgb(204,204,204);padding-left:1ex">
<br>
See <a href=3D"https://bugs.gentoo.org/940695" rel=3D"noreferrer" target=3D=
"_blank">https://bugs.gentoo.org/940695</a> for original bug and<br>
<a href=3D"https://940695.bugs.gentoo.org/attachment.cgi?id=3D904745" rel=
=3D"noreferrer" target=3D"_blank">https://940695.bugs.gentoo.org/attachment=
.cgi?id=3D904745</a> for full build log.<br>
<br></blockquote><div><br></div><div>Any chance you can report this bug at:=
 <a href=3D"https://gitlab.bacula.org/">https://gitlab.bacula.org/</a> ?<br=
></div><div>=C2=A0</div><div>best regards</div></div><span class=3D"gmail_s=
ignature_prefix">-- </span><br><div dir=3D"ltr" class=3D"gmail_signature">R=
ados=C5=82aw Korzeniewski<br><a href=3D"mailto:[email protected]" t=
arget=3D"_blank">[email protected]</a></div></div>

--0000000000002183da0625767422--


--===============7376494223696272728==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============7376494223696272728==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Bacula-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-devel

--===============7376494223696272728==--