[Rpm-maint] [rpm-software-management/rpm] Missing build id, Generating build-id links failed (#367)

Kirill Kolyshkin notifications at github.com
Fri Dec 8 20:27:34 UTC 2017


Here is a simple reproducer for the case, on a clean fresh Fedora 27 install:

```spec
# Name this gotst.spec
Name:		gotst
Version:	1.0
Release:	1%{?dist}
Summary:	Go binary to demonstrate build-id problem

Group:		Applications
License:	GPL

BuildRequires:	golang

%description
Lalala.


%prep
%setup -Tc

cat > gotst.go << EOF
package main
import "fmt"

func main() {
	fmt.Println("Hello, world!")
}
EOF

%build
go build -v -o gotst .

%install
install -d %{buildroot}/%{_bindir}
install gotst %{buildroot}/%{_bindir}

%files
%{_bindir}/gotst

%changelog
* Fri Dec  8 2017 Kir Kolyshkin <kolyshkin at gmail.com> - 1.0-1
- created
```

Save the above file to gotst.spec and run the following:
```
dnf -y install golang rpm-build
rpmbuild -bb gotst.spec
```

The error you'll see is
`*** ERROR: No build ID note found in /root/rpmbuild/BUILDROOT/gotst-1.0-1.fc27.x86_64/usr/bin/gotst`

Can you please suggest how to use `go build` to build a binary which can be packaged for Fedora 27?

Some analysis:
* `go build` adds its own build-id into the binary, named `.note.go.build-id`.
* Fedora 27 rpm wants to have `.note.gnu.build-id` which is not created as no GNU tools are used to create the binary

Here's how I checked the resulting binary:
```
# cat > gotst.go << EOF
package main
import "fmt"

func main() {
fmt.Println("Hello, world!")
}
EOF

# go build -o gotst gotst.go

# eu-readelf -n gotst

Note section [20] '.note.go.buildid' of 56 bytes at offset 0xfc8:
  Owner          Data size  Type
  Go                    40  BUILDID
```


-- 
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/367#issuecomment-350363895
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20171208/c88b6e9b/attachment.html>


More information about the Rpm-maint mailing list