vbatts / copr-build-bazel

copr build of bazel | https://copr.fedorainfracloud.org/coprs/vbatts/bazel/
15 stars 12 forks source link

Stripping Bazel removes the zip archive embedded into the binary #4

Closed rajha-korithrien closed 6 years ago

rajha-korithrien commented 6 years ago

I just installed the rpm via yum.

bamboo# yum install bazel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package bazel.x86_64 0:0.14.1-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================================================================================
 Package                                                  Arch                                                      Version                                                           Repository                                                       Size
============================================================================================================================================================================================================================================================
Installing:
 bazel                                                    x86_64                                                    0.14.1-2.el7                                                      vbatts-bazel                                                    519 k

Transaction Summary
============================================================================================================================================================================================================================================================
Install  1 Package

Total download size: 519 k
Installed size: 1.6 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/vbatts-bazel/packages/bazel-0.14.1-2.el7.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID eb2be214: NOKEY============================================                                    ]  0.0 B/s | 336 kB  --:--:-- ETA 
Public key for bazel-0.14.1-2.el7.x86_64.rpm is not installed
bazel-0.14.1-2.el7.x86_64.rpm                                                                                                                                                                                                        | 519 kB  00:00:00     
Retrieving key from https://copr-be.cloud.fedoraproject.org/results/vbatts/bazel/pubkey.gpg
Importing GPG key 0xEB2BE214:
 Userid     : "vbatts_bazel (None) <vbatts#bazel@copr.fedorahosted.org>"
 Fingerprint: 090f 9c8b bdb6 3200 807e 16c2 978a 4b98 eb2b e214
 From       : https://copr-be.cloud.fedoraproject.org/results/vbatts/bazel/pubkey.gpg
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : bazel-0.14.1-2.el7.x86_64                                                                                                                                                                                                                1/1 
  Verifying  : bazel-0.14.1-2.el7.x86_64                                                                                                                                                                                                                1/1 

Installed:
  bazel.x86_64 0:0.14.1-2.el7                                                                                                                                                                                                                               

Complete!

And when I run it I get the following error:

bamboo$ bazel version
file is invalid or corrupted (missing end of central directory record)
Cannot find central directory
FATAL: Failed to open Bazel as a zip file: (error: 5): Input/output error

Looking into the binary shows it has been stripped:

bamboo# file /usr/bin/bazel
/usr/bin/bazel: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=db85f7f1e15ccadf3940ad7d30f63d5042859b08, stripped

The bazel folks on GitHub have an issue that discusses this (https://github.com/bazelbuild/bazel/issues/600).

And indeed a previous version of the binary installed some months ago on a different machine works fine. It is not stripped.

rabin$ file /usr/bin/bazel
/usr/bin/bazel: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=d51383f64a82d0514996178d3c3215c66c8354dd, not stripped
rabin$ bazel version
Build label: 0.11.1- (@non-git)
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Sat Oct 3 14:53:53 +50150 (1520437791233)
Build timestamp: 1520437791233
Build timestamp as int: 1520437791233

I would suggest not stripping the binary :-) I do agree that the approach the bazel folks took to get the java part of bazel into the binary is not normal at all, and stripping it should not really matter, but there you have it.

Thanks!

nikhita commented 6 years ago

fixed by https://github.com/vbatts/copr-build-bazel/commit/c0c22e94d81bf59eb7cbc8a0bd4642c39c765fce? :)

/cc @vbatts

vbatts commented 6 years ago

Fixed now and new copr build will be done shortly!