Bug 1915570 - ocaml-ocamlnet /usr/lib64/ocaml/netsys/libnetsys.a contains LTO stream
Summary: ocaml-ocamlnet /usr/lib64/ocaml/netsys/libnetsys.a contains LTO stream
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: ocaml-ocamlnet
Version: 33
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Jeff Law
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-01-12 23:01 UTC by Bas Hulsken
Modified: 2021-01-23 01:30 UTC (History)
2 users (show)

Fixed In Version: ocaml-ocamlnet-4.1.8-2.fc33
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-01-23 01:30:21 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Bas Hulsken 2021-01-12 23:01:48 UTC
Description of problem:

link failure due to wrong LTO version used in library

Version-Release number of selected component (if applicable):
Name        : ocaml-ocamlnet-devel
Version     : 4.1.6
Release     : 18.fc33.1


How reproducible:
Build an OCAML program

Steps to Reproduce:
1.
2.
3.

Actual results:
+ dune build --release @install
    ocamlopt bin/gdfuse.exe (exit 2)
(cd _build/default && /usr/bin/ocamlopt.opt -w -40 -w -3-27-58 -g -o bin/gdfuse.exe /usr/lib64/ocaml/unix.cmxa -I /usr/lib64/ocaml /usr/lib64/ocaml/threads/threads.cmxa -I /usr/lib64/ocaml /usr/lib64/ocaml/zarith/zarith.cmxa -I /usr/lib64/ocaml/zarith /usr/lib64/ocaml/cryptokit/cryptokit.cmxa -I /usr/lib64/ocaml/cryptokit /usr/lib64/ocaml/extlib/extLib.cmxa /usr/lib64/ocaml/bigarray.cmxa -I /usr/lib64/ocaml /usr/lib64/ocaml/netsys/netsys_oothr_mt.cmxa /usr/lib64/ocaml/netsys/netsys_oothr_mt_init.cmx /usr/lib64/ocaml/netsys/netsys.cmxa -I /usr/lib64/ocaml/netsys /usr/lib64/ocaml/str.cmxa -I /usr/lib64/ocaml /usr/lib64/ocaml/netstring/netstring.cmxa -I /usr/lib64/ocaml/netstring /usr/lib64/ocaml/curl/curl.cmxa -I /usr/lib64/ocaml/curl /usr/lib64/ocaml/easy-format/easy_format.cmxa /usr/lib64/ocaml/biniou/biniou.cmxa /usr/lib64/ocaml/yojson/yojson.cmxa /usr/lib64/ocaml/gapi-ocaml/gapi_ocaml.cmxa /usr/lib64/ocaml/com.cmxa -I /usr/lib64/ocaml /usr/lib64/ocaml/ocamlfuse/fuse.cmxa -I /usr/lib64/ocaml/ocamlfuse /usr/lib64/ocaml/sqlite3/sqlite3.cmxa -I /usr/lib64/ocaml/sqlite3 src/google_drive_ocamlfuse.cmxa bin/.gdfuse.eobjs/native/gdfuse.cmx)
lto1: fatal error: bytecode stream in file '/usr/lib64/ocaml/netsys/libnetsys.a' generated with LTO version 9.0 instead of the expected 9.2
compilation terminated.
lto-wrapper: fatal error: gcc returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
File "caml_startup", line 1:
Error: Error during linking (exit code 1)
Done: 147/151 (jobs: 1)error: Bad exit status from /var/tmp/rpm-tmp.yFAM03 (%build)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.yFAM03 (%build)


Expected results:
no linking error

Additional info:

Comment 1 Richard W.M. Jones 2021-01-13 08:49:48 UTC
The problem here is there shouldn't be an LTO stream in any file
shipped in an RPM.  I've kicked off another build to see if this
is reproducible.

Comment 2 Richard W.M. Jones 2021-01-13 09:00:06 UTC
$ eu-readelf -S /usr/lib64/ocaml/netsys/libnetsys.a | grep .gnu.lto

shows lots of stuff, and it's my understanding that it should not show
anything.  This applies to both ocaml-ocamlnet-4.1.6-18.fc33.1 and
ocaml-ocamlnet-4.1.6-18.fc34

Comment 3 Richard W.M. Jones 2021-01-13 09:09:12 UTC
Rebuilding in Rawhide did not help.

I have disabled LTO in the build for now so hopefully that gets around
the issue.  Also upgraded to 4.1.8.

Comment 4 Fedora Update System 2021-01-13 09:31:15 UTC
FEDORA-2021-33eeb46671 has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2021-33eeb46671

Comment 5 Bas Hulsken 2021-01-13 11:26:06 UTC
The problem is resolved for me with the updated packages from: https://koji.fedoraproject.org/koji/buildinfo?buildID=1668656

I can build and use google-drive-ocamlfuse again for fedora 33, thanks!

Comment 6 Richard W.M. Jones 2021-01-13 11:52:38 UTC
I'm not completely certain that the problem is really resolved, since the
.a file still has .gnu.lto_* sections.  It may be that we have only "fixed"
the LTO version incompatibility.  However I don't know how/whether to remove
the .gnu.lto sections.

Comment 7 Jeff Law 2021-01-13 17:02:04 UTC
Richard is right there should be no LTO sections/symbols in the installed .o/.a files and they should have been removed by brp-strip-lto.  I'll dig into the build logs and see what I can find.
Thanks,

Comment 8 Jeff Law 2021-01-13 17:44:33 UTC
This is because of the

%global __strip /bin/true


Which overrides the definition of "strip" used by brp-strip-lto and turns it into a NOP.


I see similar overrides in  cross-gcc, golang, nex, and supermin as well.

I think the most sensible way forward here is to not allow "strip" to be overridden for brp-strip-lto.  We're never supposed to allow LTO bytecodes in the distro, so from a policy standpoint it makes sense.  It also still allows overriding "strip" in the other brp- scripts.

Alternate approaches would be to have packages override "brp-strip" rather than "strip" which should work, but I think that's less desirable and more work.

Comment 9 Jeff Law 2021-01-13 18:35:45 UTC
I've opened a pull request to fix redhat-rpm-config to disallow overriding __strip for brp-strip-lto.

Comment 10 Fedora Update System 2021-01-14 01:36:04 UTC
FEDORA-2021-33eeb46671 has been pushed to the Fedora 33 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-33eeb46671`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-33eeb46671

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 11 Richard W.M. Jones 2021-01-14 12:03:36 UTC
(In reply to Jeff Law from comment #8)
> This is because of the
> 
> %global __strip /bin/true
> 
> 
> Which overrides the definition of "strip" used by brp-strip-lto and turns it
> into a NOP.

Ah, this is a leftover from olden times.  Back in the day when we were
(a) building OCaml bytecode packages and (b) OCaml used to append the
bytecode to the end of the binary, we had to stop "strip" from deleting
the bytecode.

However none of this is true any more so we should remove these %globals.

> I see similar overrides in  cross-gcc, golang, nex, and supermin as well.

I can only comment about ocaml-ocamlnet and supermin.  I will remove the
strip global from those now.

No idea about the other packages you mention.

Comment 13 Fedora Update System 2021-01-14 13:27:35 UTC
FEDORA-2021-6c2c191df2 has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2021-6c2c191df2

Comment 14 Fedora Update System 2021-01-15 02:15:25 UTC
FEDORA-2021-6c2c191df2 has been pushed to the Fedora 33 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-6c2c191df2`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-6c2c191df2

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 15 Fedora Update System 2021-01-23 01:30:21 UTC
FEDORA-2021-6c2c191df2 has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.