Build problem on ubuntu 18.04.1 LTS (zlib not found)

Hi all, I’m trying o build the cardano-sl from the git sources (intending to add German locale support later) and run into a build issue related to a missing zlib:

nix-shell:~/cardano-sl]$ ./scripts/build/cardano-sl.sh
Going to build: cardano-sl-networking cardano-sl-binary cardano-sl-util cardano-sl-crypto cardano-sl-core cardano-sl-db cardano-sl-chain cardano-sl-infra cardano-sl cardano-sl-node cardano-sl-client cardano-sl generator cardano-sl-auxx cardano-sl-tools cardano-sl-explorer cardano-sl-wallet cardano-sl-wallet-new
Building cardano-sl-networking

stack build --ghc-options=" -Wwarn" --test --no-haddock-deps --bench --jobs=1 --no-run-tests --no-run-benchmarks --dependencies-only cardano-sl-networking

digest-0.0.1.2: configure
Progress 0/213: digest-0.0.1.2

– While building custom Setup.hs for package digest-0.0.1.2 using:
/home/user/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_2.0.1.0_ghc-8.2.2 --builddir=.stack-work/dist/x86_64-linux/Cabal-2.0.1.0 configure --with-ghc=/home/user/.stack/programs/x86_64-linux/ghc-8.2.2/bin/ghc --with-ghc-pkg=/home/user/.stack/programs/x86_64-linux/ghc-8.2.2/bin/ghc-pkg --user --package-db=clear --package-db=global --package-db=/home/user/.stack/snapshots/x86_64-linux/lts-11.13/8.2.2/pkgdb --libdir=/home/user/.stack/snapshots/x86_64-linux/lts-11.13/8.2.2/lib --bindir=/home/user/.stack/snapshots/x86_64-linux/lts-11.13/8.2.2/bin --datadir=/home/user/.stack/snapshots/x86_64-linux/lts-11.13/8.2.2/share --libexecdir=/home/user/.stack/snapshots/x86_64-linux/lts-11.13/8.2.2/libexec --sysconfdir=/home/user/.stack/snapshots/x86_64-linux/lts-11.13/8.2.2/etc --docdir=/home/user/.stack/snapshots/x86_64-linux/lts-11.13/8.2.2/doc/digest-0.0.1.2 --htmldir=/home/user/.stack/snapshots/x86_64-linux/lts-11.13/8.2.2/doc/digest-0.0.1.2 --haddockdir=/home/user/.stack/snapshots/x86_64-linux/lts-11.13/8.2.2/doc/digest-0.0.1.2 --dependency=base=base-4.10.1.0 --dependency=bytestring=bytestring-0.10.8.2 --ghc-options " -Wwarn"
Process exited with code: ExitFailure1
Logs have been written to: /home/user/cardano-sl/.stack-work/logs/digest-0.0.1.2.log

Configuring digest-0.0.1.2…
Cabal-simple_mPHDZzAJ_2.0.1.0_ghc-8.2.2: Missing dependency on a foreign
library:

  • Missing (or bad) header file: zlib.h
  • Missing C library: z
    This problem can usually be solved by installing the system package that

Have been able to work around the zlib.h issue by appending --extra-include-dirs=/usr/include to the build command line. But the missing library issue couldn’t be resolved by --extra-lib-dirs=/usr/lib/x86_64-linux-gnu leading into:

– While building custom Setup.hs for package digest-0.0.1.2 using:
/home/user/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_2.0.1.0_ghc-8.2.2 --builddir=.stack-work/dist/x86_64-linux/Cabal-2.0.1.0 build --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
Logs have been written to: /home/user/cardano-sl/.stack-work/logs/digest-0.0.1.2.log

Configuring digest-0.0.1.2…
Preprocessing library for digest-0.0.1.2…
.stack-work/dist/x86_64-linux/Cabal-2.0.1.0/build/Data/Digest/CRC32_hsc_make: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
running .stack-work/dist/x86_64-linux/Cabal-2.0.1.0/build/Data/Digest/CRC32_hsc_make failed (exit code 127)
command was: .stack-work/dist/x86_64-linux/Cabal-2.0.1.0/build/Data/Digest/CRC32_hsc_make >.stack-work/dist/x86_64-linux/Cabal-2.0.1.0/build/Data/Digest/CRC32.hs

Libraries are installed:

[nix-shell:~/cardano-sl]$ ls -al /usr/lib/x86_64-linux-gnu/libz.*
-rw-r–r-- 1 root root 164686 23. Mai 2017 /usr/lib/x86_64-linux-gnu/libz.a
lrwxrwxrwx 1 root root 36 23. Mai 2017 /usr/lib/x86_64-linux-gnu/libz.so → /lib/x86_64-linux-gnu/libz.so.1.2.11

[nix-shell:~/cardano-sl]$ ls -al /lib/x86_64-linux-gnu/libz.so.1.2.11
-rw-r–r-- 1 root root 116960 23. Mai 2017 /lib/x86_64-linux-gnu/libz.so.1.2.11

Also --extra-lib-dirs=/lib/x86_64-linux-gnu (following the first link indrection in order to point to a directory with libz.so.1) keeps me stcuk at the initial error message (without the missing headers of course):

[nix-shell:~/cardano-sl]$ ls -al /lib/x86_64-linux-gnu/libz.*
lrwxrwxrwx 1 root root 14 23. Mai 2017 /lib/x86_64-linux-gnu/libz.so.1 → libz.so.1.2.11
-rw-r–r-- 1 root root 116960 23. Mai 2017 /lib/x86_64-linux-gnu/libz.so.1.2.11

Any ideas how to fix this? Need additional symlinks in my distribution, or a flaw in the stack build of cardano?

Best Regards