Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libsForQt5.quazip: fix darwin build #61355

Merged
merged 4 commits into from
May 19, 2019
Merged

libsForQt5.quazip: fix darwin build #61355

merged 4 commits into from
May 19, 2019

Conversation

ryan4729
Copy link
Contributor

@ryan4729 ryan4729 commented May 12, 2019

Motivation for this change

This fixes the build for libsForQt5.quazip and keepassxc on darwin

  • Patched quazip qmake file to skip building tests since there was a build error on darwin and they weren't run or included in the output anyway
  • Patched quazip qmake file to add explicit zlib dependency. I'm not sure why it wasn't being picked up before. zlib is a transitive dependency through Qt5Core
  • Added fixDarwinDylibNames hook to set the quazip dylib install name to an absolute path
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@ryan4729 ryan4729 changed the title quazip: fix darwin build libsForQt5.quazip: fix darwin build May 12, 2019
@ofborg ofborg bot added 6.topic: darwin Running or building packages on Darwin 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 10.rebuild-linux: 1-10 labels May 12, 2019
@infinisil
Copy link
Member

Patched quazip qmake file to skip building tests since there was a build error on darwin and they weren't run or included in the output anyway

For future reference, what are the build errors? And is there any upstream issues for these darwin problems?

@ryan4729
Copy link
Contributor Author

The build error fixed by adding -lz:

clang++ -stdlib=libc++ -single_module -dynamiclib -compatibility_version        1.0 -current_version    1.0.0 -install_name     libquazip.1.dylib -o libquazip.1.0.0.dylib .obj/qioapi.o .obj/JlCompress.o .obj/quaadler32.o .obj/quacrc32.o .obj/quagzipfile.o .obj/quaziodevice.o .obj/quazip.o .obj/quazipdir.o .obj/quazipfile.o .obj/quazipfileinfo.o .obj/quazipnewinfo.o .obj/unzip.o .obj/zip.o .obj/moc_quagzipfile.o .obj/moc_quaziodevice.o .obj/moc_quazipfile.o  -lQt5Core -framework DiskArbitration -framework IOKit
Undefined symbols for architecture x86_64:
  "_adler32", referenced from:
      QuaAdler32::QuaAdler32() in quaadler32.o
      QuaAdler32::QuaAdler32() in quaadler32.o
      QuaAdler32::calculate(QByteArray const&) in quaadler32.o
      QuaAdler32::reset() in quaadler32.o
      QuaAdler32::update(QByteArray const&) in quaadler32.o
  "_crc32", referenced from:
      QuaCrc32::QuaCrc32() in quacrc32.o
      QuaCrc32::QuaCrc32() in quacrc32.o
      QuaCrc32::calculate(QByteArray const&) in quacrc32.o
      QuaCrc32::reset() in quacrc32.o
      QuaCrc32::update(QByteArray const&) in quacrc32.o
      _unzReadCurrentFile in unzip.o
      _zipWriteInFileInZip in zip.o
      ...
  "_deflate", referenced from:
      QuaZIODevice::writeData(char const*, long long) in quaziodevice.o
      QuaZIODevice::flush() in quaziodevice.o
      _zipWriteInFileInZip in zip.o
      _zipCloseFileInZipRaw64 in zip.o
  "_deflateEnd", referenced from:
      QuaZIODevice::close() in quaziodevice.o
      _zipCloseFileInZipRaw64 in zip.o
  "_deflateInit2_", referenced from:
      _zipOpenNewFileInZip4_64 in zip.o
  "_deflateInit_", referenced from:
      QuaZIODevice::open(QFlags<QIODevice::OpenModeFlag>) in quaziodevice.o
  "_get_crc_table", referenced from:
      _unzOpenCurrentFile3 in unzip.o
      _zipOpenNewFileInZip4_64 in zip.o
  "_gzclose", referenced from:
      QuaGzipFile::close() in quagzipfile.o
  "_gzdopen", referenced from:
      QuaGzipFilePrivate::open(int, char const*) in quagzipfile.o
      bool QuaGzipFilePrivate::open<int>(int, QFlags<QIODevice::OpenModeFlag>, QString&) in quagzipfile.o
  "_gzflush", referenced from:
      QuaGzipFile::flush() in quagzipfile.o
  "_gzopen", referenced from:
      QuaGzipFilePrivate::open(QString const&, char const*) in quagzipfile.o
  "_gzread", referenced from:
      QuaGzipFile::readData(char*, long long) in quagzipfile.o
  "_gzwrite", referenced from:
      QuaGzipFile::writeData(char const*, long long) in quagzipfile.o
  "_inflate", referenced from:
      QuaZIODevice::readData(char*, long long) in quaziodevice.o
      _unzReadCurrentFile in unzip.o
  "_inflateEnd", referenced from:
      QuaZIODevice::close() in quaziodevice.o
      _unzClose in unzip.o
      _unzCloseCurrentFile in unzip.o
      _unzOpenCurrentFile3 in unzip.o
  "_inflateInit2_", referenced from:
      _unzOpenCurrentFile3 in unzip.o
  "_inflateInit_", referenced from:
      QuaZIODevice::open(QFlags<QIODevice::OpenModeFlag>) in quaziodevice.o
ld: symbol(s) not found for architecture x86_64
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [Makefile:205: libquazip.1.0.0.dylib] Error 1
make[1]: Leaving directory '/private/var/folders/xl/ks0r96tj0cz7d3n33fq5m_qr0000gn/T/nix-build-quazip-0.7.6.drv-0/source/quazip'
make: *** [Makefile:46: sub-quazip-make_first] Error 2
builder for '/nix/store/byjpxqxxjyjxqcaqvbr74hyk6pm62arg-quazip-0.7.6.drv' failed with exit code 2
error: build of '/nix/store/byjpxqxxjyjxqcaqvbr74hyk6pm62arg-quazip-0.7.6.drv' failed

The build error fixed by not building tests:

make[1]: Leaving directory '/private/var/folders/xl/ks0r96tj0cz7d3n33fq5m_qr0000gn/T/nix-build-quazip-0.7.6.drv-0/source/quazip'
cd qztest/ && ( test -e Makefile || /nix/store/49vnbwyn2q6hzd73rj113cwyf64gawd1-qtbase-5.11.3-dev/bin/qmake -o Makefile /private/var/folders/xl/ks0r96tj0cz7d3n33fq5m_qr0000gn/T/nix-build-quazip-0.7.6.drv-0/source/qztest/qztest.pro PREFIX=/nix/store/3r4idprrswjpb13ff8w07jxp7094p0xf-quazip-0.7.6 NIX_OUTPUT_OUT=/nix/store/3r4idprrswjpb13ff8w07jxp7094p0xf-quazip-0.7.6 NIX_OUTPUT_DEV=/nix/store/3r4idprrswjpb13ff8w07jxp7094p0xf-quazip-0.7.6 NIX_OUTPUT_BIN=/nix/store/3r4idprrswjpb13ff8w07jxp7094p0xf-quazip-0.7.6 NIX_OUTPUT_DOC=/nix/store/3r4idprrswjpb13ff8w07jxp7094p0xf-quazip-0.7.6/share/doc/qt-5.11 NIX_OUTPUT_QML=/nix/store/3r4idprrswjpb13ff8w07jxp7094p0xf-quazip-0.7.6/lib/qt-5.11/qml NIX_OUTPUT_PLUGIN=/nix/store/3r4idprrswjpb13ff8w07jxp7094p0xf-quazip-0.7.6/lib/qt-5.11/plugins ) && make -f Makefile
Project WARNING: CONFIG+=qtestlib is deprecated. Use QT+=testlib instead.
make[1]: Entering directory '/private/var/folders/xl/ks0r96tj0cz7d3n33fq5m_qr0000gn/T/nix-build-quazip-0.7.6.drv-0/source/qztest'
The platform SDK has been changed from version  to version 10.14.
This requires a fresh build. Please wipe the build directory completely,
including any .qmake.stash and .qmake.cache files generated by qmake.
/nix/store/49vnbwyn2q6hzd73rj113cwyf64gawd1-qtbase-5.11.3-dev/mkspecs/features/mac/sdk.mk:11: *** ^.  Stop.
make[1]: Leaving directory '/private/var/folders/xl/ks0r96tj0cz7d3n33fq5m_qr0000gn/T/nix-build-quazip-0.7.6.drv-0/source/qztest'
make: *** [Makefile:71: sub-qztest-make_first] Error 2
builder for '/nix/store/hmcq2xbcawiir4x0w0a8n4hfl2pnh3zy-quazip-0.7.6.drv' failed with exit code 2
error: build of '/nix/store/hmcq2xbcawiir4x0w0a8n4hfl2pnh3zy-quazip-0.7.6.drv' failed

@ryan4729
Copy link
Contributor Author

There are no upstream issues that I know of. I noticed that Homebrew also adds the extra -lz flag.

@ryan4729
Copy link
Contributor Author

Replaced the patch with some qmakeFlags

@infinisil
Copy link
Member

@GrahamcOfBorg build libsForQt5.quazip

@c0bw3b
Copy link
Contributor

c0bw3b commented May 19, 2019

@GrahamcOfBorg build libsForQt5.quazip

@c0bw3b c0bw3b merged commit 0bedafd into NixOS:master May 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: darwin Running or building packages on Darwin 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants