Closed johanneskastl closed 2 years ago
Hi @johanneskastl Thanks for the issue. At first glance I have no idea what's going on with what you reported. Can you provide step-by-step detail how you got the error? How were you building the code ?
Hi, basically I just setup a package in the openSUSE Buildservice (OBS) that does all the nitty gritty details: https://build.opensuse.org/package/show/home:ojkastl_buildservice:Branch_devel_kubic/ktop
(OBS spawns a new VM with the desired OS, installs all package dependencies and builds the package inside that VM. This guarantees a clean state every time)
The build step is just:
go build \
-mod=vendor \
-buildmode=pie \
-ldflags="-X main.Version=%{version}"
I also tried without those options but got the same error.
BTW, this build is using go1.17, but I get the same error with go1.16.
@johanneskastl I don't usually build with buildmode=pie
, so I am not familiar of its requirements. My suggestion is to remove it (or use buildmode=default), so that the build generates a native executable for the targeted OS/architecture.
Hi Vladimir, removing this options does not help, as I wrote. I still get the error when omitting this parameter.
@johanneskastl
Since I am not entirely sure how your build env is setup, I can only guess (based on error below) it is building a binary for the wrong OS/arc combination. The second line in error, readelf failed
indicates there is an ELF problem which means that the binary that was built cant run on the OS/arc combination where the package is being prepared.
[ 183s] ktop.x86_64: E: readelf-failed /usr/bin/ktop 'utf-8' codec can't decode byte 0xc2 in position 6583: invalid continuation byte
[ 183s] Executing readelf on this file failed, all checks could not be run.
I think the error is happening at this line in your rpm spec:
# Install the binary.
install -D -m 0755 %{name} "%{buildroot}/%{_bindir}/%{name}"
I am not an expert in RPM building. But I can only suggest some simple debugging steps:
GOOS=linux GOARCH=amd64 go build \
-mod=vendor \
-buildmode=pie \
-ldflags="-X main.Version=%{version}"```
Hope this helps move your effort further. Thanks for doing this.
I just did some more testing:
GOOS=linux GOARCH=amd64
) did not helpSo I asked for help on the opensuse-go mailing list. I'll let you know if there is any answer or solution.
Thanks for your help, Vladimir!
This seems to be unrelated to this exact package, I saw this also on other packages. Seems to be an error inside the actual rpmlint check.
Hence closing this issue.
Hi,
when building this package as an RPM on openSUSE, I get the following error:
Any idea how to fix that? Is this something that needs to be done inside the source code or am I missing some flags for the build command? (Sorry, golang-Newbie here...)