postgres-parser icon indicating copy to clipboard operation
postgres-parser copied to clipboard

Crate build fails with message: "recipe for target 'zic' failed"

Open rasouli opened this issue 4 years ago • 8 comments

Hi,

I added postgres-parser crate version 0.2.3 as dependency and it failed when cargo build was issued with the following errors:

  [stderr] Writing bitcode...
  [stderr] /usr/bin/ld: skipping incompatible ../../src/common/libpgcommon.a when searching for -lpgcommon
  [stderr] /usr/bin/ld: cannot find -lpgcommon
  [stderr] /usr/bin/ld: skipping incompatible ../../src/port/libpgport.a when searching for -lpgport
  [stderr] /usr/bin/ld: cannot find -lpgport
  [stderr] clang: error: linker command failed with exit code 1 (use -v to see invocation)
  [stderr] make[2]: *** [zic] Error 1
  [stderr] make[1]: *** [all-timezone-recurse] Error 2
  [stderr] make: *** [all-src-recurse] Error 2
  [stderr] + exit 1
  Error: Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }

I am building the crate on ubuntu 18.04.5 LTS and I have gone through installing required dependencies, but I cannot figure out what has gone wrong here. I would appreciate if you can give your thoughts on this. Please kindly find the full build log in build.log.

Thanks!

rasouli avatar Feb 23 '21 18:02 rasouli

Hi. I had the same problem on MacOS. I fixed it with adding needed llvm tools to $PATH

alex-dukhno avatar Feb 23 '21 20:02 alex-dukhno

Hi @alex-dukhno ! Can you please specify how you have modified your $PATH? as far as I can check, I can find all mentioned tools ( opt, clang, llvm-ar) on my $PATH. also can you please specify version of the tools you use as-well?

Thanks.

rasouli avatar Feb 24 '21 18:02 rasouli

I add this line to my ~/.zshrc:

export PATH="/usr/local/opt/llvm/bin:$PATH"

alex-dukhno avatar Feb 25 '21 07:02 alex-dukhno

Clang version

clang -v
clang version 11.1.0
Target: x86_64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin

LLVM-ar

llvm-ar --version                                                                                                                                                                              1 ↵
LLVM (http://llvm.org/):
  LLVM version 11.1.0
  Optimized build.
  Default target: x86_64-apple-darwin20.3.0
  Host CPU: skylake

alex-dukhno avatar Feb 25 '21 14:02 alex-dukhno

Yeah, make sure that your clang isn't the one installed by XCode in /Library/.... It's gotta be the package-provided version. Don't ask me why -- I haven't been able to figure that out.

eeeebbbbrrrr avatar Feb 25 '21 21:02 eeeebbbbrrrr

Hi @rasouli I got exactly same error as yours when trying to build my project with rust docker image.

I spent a lot of time on trying to find what is the problem. I found that it could be that zic depends on glibc. I tried to install latest glibc on Debian however it was to much hassle to work headless installation so I ended up using ubuntu:20.04 as a build image.

I could not check my theory but maybe it could help you.

Thanks

alex-dukhno avatar Mar 22 '21 12:03 alex-dukhno

Hi @alex-dukhno thanks for the tip, I had been experimenting with different versions of dependencies to build, but I had given up back then as I had to work on something else, I will re-try with ubuntu image next time.

rasouli avatar Mar 22 '21 13:03 rasouli

Hi, I had the same exact issue. I've inspected the log file and I noted that there is a build.sh: line 72: [: -l: unary operator expected error in the build log. I tried to change the -l flag to -h (in this commit) and it seems working correctly.

alekitto avatar Jun 18 '21 23:06 alekitto