xLite icon indicating copy to clipboard operation
xLite copied to clipboard

Build fails on task :myPrebuildTask when trying to invoke rename

Open TungstenFilament opened this issue 7 years ago • 2 comments

My system: OpenSuSE 13.2, x86_64.

I get this particular error when running ./gradlew -q myPrebuildTask.

=======================================
Building on linux-x86_64 for android...
=======================================
14:15:10
Building libosmocore ...            ok  [0:16]
Building libasn1c ...            ok  [0:13]
Building libosmo-asn1-rrc ...            ok  [0:18]
Building openssl ...            ok  [2:12]
Building diag_helper ...            ok  [0:0]
Building gsm-parser ... ok  [0:0]
14:18:09
=============================================================================================
Installing files to: /home/(my username)/snoopsnitch-xlite/xLite/contrib/build-OuZUZ5MKCW/parser/ ...
=============================================================================================
rename: not enough arguments

Usage:
 rename [options] <expression> <replacement> <file>...

Options:
 -v, --verbose    explain what is being done
 -s, --symlink    act on the target of symlinks

 -h, --help     display this help and exit
 -V, --version  output version information and exit

For more details see rename(1).

FAILURE: Build failed with an exception.

* Where:
Build file '/home/error/snoopsnitch-xlite/xLite/SnoopSnitch/build.gradle' line: 13

* What went wrong:
Execution failed for task ':myPrebuildTask'.
> Process 'command 'bash'' finished with non-zero exit value 1

The problem is in contrib/compile.sh, line 299, where you invoke "rename" to get rid of the tailing version numbers on .so files.

My version of rename, from the linux-util-ng package, needs 3 arguments ([options], expression, replacement, files), whereas compile.sh only gives it two (rename -v 's/\.[0-9]$//' ${PARSER_DIR}/*.so.*) - the regexp and the file list (I'm guessing, based on this, that this project was coded on some Debian derivative where it's actually a perl script which takes different syntax.

I've written a fix which uses a more platform independent combination of ls, sed, mv and a for loop, I'll submit a pull request for that change shortly.

TungstenFilament avatar May 19 '17 16:05 TungstenFilament

A warm welcome to @TungstenFilament as the first public contributor to xLite! I just noticed your PR. Thanks a lot. It looks pretty good, but a few comments in order.

  • We may want to make the rename check availability smarter. (I was not aware of the other flavors.)
  • We're trying to keep this repo in contextual conformity for Debian based Linux's (Mint, Ubuntu), so when we refer to packages, we decided to use the names available (for what we have; Mint).
  • Using back ticks for Bash sub-processing and parsing ls is not recommended (as also mentioned in the link you gave.) Can we think of a cleaner way to do this?
  • Please don't submit PR's containing typo fixes for itself, if possible.

So I will not merge your PR, but rather include the idea in somewhat cleaner form, on the next update, unless you want make a new PR. In any way, thank you for your support.

emigenix avatar May 27 '17 21:05 emigenix

I'm not particularly well-versed in bash scripting, so it may take a little while for me to figure out a proper way to address point 3 (backticks and ls). Likewise, I have little experience with multiple flavours of Linux, so I did not know about rename being a different command until now.

The core of the matter here is that the linker is producing versioned libraries, something which caused further problems when I got the package to compile, installed it and ran it. Attempting to start recording failed, saying that it was unable to find libosmocore.so.6.0.0. Right now, I think my efforts would be better spent trying to figure out how to make it create un-versioned libraries so that the gsm-parser is linked against plain old libosmocore.so. This will both solve my "can't find library" problem and eliminate the need for renaming scripts.

TungstenFilament avatar Jun 03 '17 10:06 TungstenFilament