ipp-usb ftbfs with lto

Bug #1931383 reported by Matthias Klose
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Go
New
Undecided
Unassigned
golang-1.16 (Ubuntu)
New
Undecided
Unassigned
ipp-usb (Ubuntu)
New
Undecided
Unassigned

Bug Description

ipp-usb ftbfs with lto, apparently not seen on Fedora builds.

github.com/OpenPrinting/ipp-usb
# github.com/OpenPrinting/ipp-usb
../../../../tmp/go-build3834344537/b001/cgo-generated-wrappers:1:13: error: function ‘avahiClientCallback’ redeclared as variable
../../../../tmp/go-build3834344537/b001/_cgo_export.c:24:6: note: previously declared here
   24 | void avahiClientCallback(AvahiClient* client, AvahiClientState state, void* _)
      | ^
../../../../tmp/go-build3834344537/b001/cgo-generated-wrappers:4:13: error: function ‘avahiEntryGroupCallback’ redeclared as variable
../../../../tmp/go-build3834344537/b001/_cgo_export.c:46:6: note: previously declared here
   46 | void avahiEntryGroupCallback(AvahiEntryGroup* egroup, AvahiEntryGroupState state, void* _)
      | ^
../../../../tmp/go-build3834344537/b001/cgo-generated-wrappers:7:13: error: function ‘libusbHotplugCallback’ redeclared as variable
../../../../tmp/go-build3834344537/b001/_cgo_export.c:68:5: note: previously declared here
   68 | int libusbHotplugCallback(libusb_context* ctx, libusb_device* dev, libusb_hotplug_event event, void* p)
      | ^
../../../../tmp/go-build3834344537/b001/_cgo_export.c:21:13: error: variable ‘_cgoexp_73d50ba221cf_avahiClientCallback’ redeclared as function
   21 | extern void _cgoexp_73d50ba221cf_avahiClientCallback(void *);
      | ^
../../../../tmp/go-build3834344537/b001/cgo-generated-wrappers:10:5: note: previously declared here
../../../../tmp/go-build3834344537/b001/_cgo_export.c:43:13: error: variable ‘_cgoexp_73d50ba221cf_avahiEntryGroupCallback’ redeclared as function
   43 | extern void _cgoexp_73d50ba221cf_avahiEntryGroupCallback(void *);
      | ^
../../../../tmp/go-build3834344537/b001/cgo-generated-wrappers:11:5: note: previously declared here
../../../../tmp/go-build3834344537/b001/_cgo_export.c:65:13: error: variable ‘_cgoexp_73d50ba221cf_libusbHotplugCallback’ redeclared as function
   65 | extern void _cgoexp_73d50ba221cf_libusbHotplugCallback(void *);
      | ^
../../../../tmp/go-build3834344537/b001/cgo-generated-wrappers:12:5: note: previously declared here
lto1: fatal error: errors during merging of translation units
compilation terminated.
lto-wrapper: fatal error: /usr/bin/gcc returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status

Tags: lto
Matthias Klose (doko)
tags: added: lto
Revision history for this message
Matthias Klose (doko) wrote :
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

@Alexander, could you have a look what is happening here?

Revision history for this message
Alexander Pevzner (pzz) wrote :

It looks like Go compiler bug (or, more strictly, cgo bug; cgo is a tool that comes with Go compiler and allows direct calling of C functions from Go)

https://github.com/golang/go/issues/43830

The solution could be to build without LTO. In general, LTO should not make a lot of sense for Go programs.

Revision history for this message
Sebastien Bacher (seb128) wrote :

@Till, could you maybe try to get the delta Matthias added to our package in Debian?

http://launchpadlibrarian.net/530753441/ipp-usb_0.9.17-3_0.9.17-3ubuntu1.diff.gz

Debian isn't trying to build with LTO atm but it shouldn't make a difference to them and seems like turning off lto here is wanted

Revision history for this message
Matthias Klose (doko) wrote :

that delta should be dropped once golang-1.16 has the backport.

Revision history for this message
Alexander Pevzner (pzz) wrote :

It happens with golang-1.15 too (with LTO build), so I suggest to make this change permanent, and build without LTO.

I don't think LTO can do a lot of optimization for Go program.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.