aw-server-rust icon indicating copy to clipboard operation
aw-server-rust copied to clipboard

Calling compile-android.sh from other directory fails

Open ErikBjare opened this issue 3 years ago • 3 comments

When trying to run cd aw-server-rust && ./compile-android.sh from the aw-android repo it fails when trying to build openssl-sys, but if I run ./compile-android.sh directly from the aw-android folder it succeeds. Wtf?

I've tried various different ways to compile it from the aw-android repo (like wrapping it in a Makefile target), but it just doesn't work...

  make[2]: Leaving directory '/tank/erb/Programming/activitywatch/other/aw-android/aw-server-rust/target/aarch64-linux-android/debug/build/openssl-sys-fb953f526b7e64b1/out/openssl-build/build/src'
  running "make" "install_dev"
  make[2]: Entering directory '/tank/erb/Programming/activitywatch/other/aw-android/aw-server-rust/target/aarch64-linux-android/debug/build/openssl-sys-fb953f526b7e64b1/out/openssl-build/build/src'
  Detected changed: Configure config Configurations/common0.tmpl Configurations/unix-Makefile.tmpl Configurations/common.tmpl build.info crypto/build.info ssl/build.info engines/build.info apps/build.info util/build.info tools/build.info crypto/objects/build.info crypto/md4/build.info crypto/md5/build.info crypto/sha/build.info crypto/mdc2/build.info crypto/hmac/build.info crypto/ripemd/build.info crypto/whrlpool/build.info crypto/poly1305/build.info crypto/blake2/build.info crypto/siphash/build.info crypto/sm3/build.info crypto/des/build.info crypto/aes/build.info crypto/rc2/build.info crypto/rc4/build.info crypto/aria/build.info crypto/bf/build.info crypto/cast/build.info crypto/sm4/build.info crypto/chacha/build.info crypto/modes/build.info crypto/bn/build.info crypto/ec/build.info crypto/rsa/build.info crypto/dsa/build.info crypto/dh/build.info crypto/sm2/build.info crypto/dso/build.info crypto/engine/build.info crypto/buffer/build.info crypto/bio/build.info crypto/stack/build.info crypto/lhash/build.info crypto/rand/build.info crypto/err/build.info crypto/evp/build.info crypto/asn1/build.info crypto/pem/build.info crypto/x509/build.info crypto/x509v3/build.info crypto/conf/build.info crypto/txt_db/build.info crypto/pkcs7/build.info crypto/pkcs12/build.info crypto/ocsp/build.info crypto/ui/build.info crypto/cms/build.info crypto/ts/build.info crypto/srp/build.info crypto/cmac/build.info crypto/ct/build.info crypto/async/build.info crypto/kdf/build.info crypto/store/build.info Configurations/00-base-templates.conf Configurations/10-main.conf
  /usr/bin/perl configdata.pm -r
  Configuring OpenSSL version 1.1.1i (0x1010109fL) for linux-aarch64
  Using os-specific seed configuration
  Creating configdata.pm
  Creating Makefile
  **********************************************************************
  ***                                                                ***
  ***   OpenSSL has been successfully configured                     ***
  ***                                                                ***
  ***   If you encounter a problem while building, please open an    ***
  ***   issue on GitHub <https://github.com/openssl/openssl/issues>  ***
  ***   and include the output from the following command:           ***
  ***                                                                ***
  ***       perl configdata.pm --dump                                ***
  ***                                                                ***
  ***   (If you are new to OpenSSL, you might want to consult the    ***
  ***   'Troubleshooting' section in the INSTALL file first)         ***
  ***                                                                ***
  **********************************************************************
  **************************************************
  ***                                            ***
  ***   Please run the same make command again   ***
  ***                                            ***
  **************************************************
  make[2]: Leaving directory '/tank/erb/Programming/activitywatch/other/aw-android/aw-server-rust/target/aarch64-linux-android/debug/build/openssl-sys-fb953f526b7e64b1/out/openssl-build/build/src'
  --- stderr
  ar: creating libcrypto.a
  ar: creating libssl.a
  make[2]: *** [Makefile:648: configdata.pm] Error 1
  thread 'main' panicked at '
  Error installing OpenSSL:
      Command: "make" "install_dev"
      Exit status: exit code: 2
      ', /home/erb/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-src-111.13.0+1.1.1i/src/lib.rs:415:13
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
make[1]: *** [Makefile:27: android] Error 101
make[1]: Leaving directory '/tank/erb/Programming/activitywatch/other/aw-android/aw-server-rust'
make: *** [Makefile:56: aw-server-rust/target/armv7-linux-androideabi/release/libaw_server.so] Error 2

ErikBjare avatar Feb 21 '21 13:02 ErikBjare

I went into the build folder manually and ran the command with the correct PATH, and it worked... (maybe because of the "Please run the same make command again" message?)

env PATH="/home/erb/Programming/activitywatch/other/aw-android/aw-server-rust/NDK/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH" make install_dev

I'm absolutely clueless why this happens... It's like make -C dir and cd dir doesn't really change the working directory somehow?

ErikBjare avatar Feb 21 '21 14:02 ErikBjare

I'm tempted to work around this by uploading artifacts from aw-server-rust CI (https://github.com/ActivityWatch/aw-server-rust/pull/214) and then downloading them in aw-android CI using something like https://github.com/dawidd6/action-download-artifact (would require completing migration to GitHub Actions).

Currently, aw-server-rust binaries are build in debug mode in CI. Perhaps switch to release mode for the master branch and aw-android CI can pick them up from there?

ErikBjare avatar Feb 22 '21 11:02 ErikBjare

Seems very strange to always have to point out a remote binary for aw-server, wouldn't that be quite annoying if you had to test changes in aw-server-rust with it?

johan-bjareholt avatar Feb 22 '21 17:02 johan-bjareholt