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

libmpack: fix darwin build #31759

Merged
merged 3 commits into from Nov 29, 2017
Merged

libmpack: fix darwin build #31759

merged 3 commits into from Nov 29, 2017

Conversation

LnL7
Copy link
Member

@LnL7 LnL7 commented Nov 16, 2017

On darwin we need the correct prefix during the buildPhase, otherwise
the dynamic libraries have an incorrect install_name.

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@LnL7 LnL7 added the 6.topic: darwin Running or building packages on Darwin label Nov 16, 2017
@LnL7
Copy link
Member Author

LnL7 commented Nov 16, 2017

@GrahamcOfBorg build libmpack luaPackages.mpack

Copy link

@GrahamcOfBorg GrahamcOfBorg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failure for system: x86_64-darwin

      _lmpack_unpacker_new in lmpack-2d54d3.o
      _lmpack_packer_new in lmpack-2d54d3.o
      _lmpack_session_new in lmpack-2d54d3.o
      ...
ld: symbol(s) not found for architecture x86_64
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:117: mpack.so] Error 1
error: build of '/nix/store/yas2ybwc4d6k7dqqlyw12za2mzaxqj5z-lua5.2-lua-mpack-1.0.7_ef025224a799066b818120fb1f30a308543a6e99.drv' failed on ‘mac1’
builder for '/nix/store/yas2ybwc4d6k7dqqlyw12za2mzaxqj5z-lua5.2-lua-mpack-1.0.7_ef025224a799066b818120fb1f30a308543a6e99.drv' failed with exit code 2
error: build of ‘/nix/store/yas2ybwc4d6k7dqqlyw12za2mzaxqj5z-lua5.2-lua-mpack-1.0.7_ef025224a799066b818120fb1f30a308543a6e99.drv’ failed

Copy link

@GrahamcOfBorg GrahamcOfBorg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Success for system: x86_64-linux

mkdir -p "$out/lib/lua/5.2"
install -Dm755 mpack.so "$out/lib/lua/5.2/mpack.so"
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/1ly149a8iy8i7zb4jb7malpp027i315r-lua5.2-lua-mpack-1.0.7_ef025224a799066b818120fb1f30a308543a6e99
shrinking /nix/store/1ly149a8iy8i7zb4jb7malpp027i315r-lua5.2-lua-mpack-1.0.7_ef025224a799066b818120fb1f30a308543a6e99/lib/lua/5.2/mpack.so
stripping (with flags -S) in /nix/store/1ly149a8iy8i7zb4jb7malpp027i315r-lua5.2-lua-mpack-1.0.7_ef025224a799066b818120fb1f30a308543a6e99/lib 
patching script interpreter paths in /nix/store/1ly149a8iy8i7zb4jb7malpp027i315r-lua5.2-lua-mpack-1.0.7_ef025224a799066b818120fb1f30a308543a6e99
checking for references to /tmp/nix-build-lua5.2-lua-mpack-1.0.7_ef025224a799066b818120fb1f30a308543a6e99.drv-0 in /nix/store/1ly149a8iy8i7zb4jb7malpp027i315r-lua5.2-lua-mpack-1.0.7_ef025224a799066b818120fb1f30a308543a6e99...
/nix/store/hf7smfj41jjb0sbzvp7ryjc0avw8dmas-libmpack-1.0.5
/nix/store/1ly149a8iy8i7zb4jb7malpp027i315r-lua5.2-lua-mpack-1.0.7_ef025224a799066b818120fb1f30a308543a6e99

@LnL7
Copy link
Member Author

LnL7 commented Nov 20, 2017

@GrahamcOfBorg build libmpack luaPackages.mpack

Copy link

@GrahamcOfBorg GrahamcOfBorg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Success for system: x86_64-darwin

installing
install flags: install PREFIX=\$\(out\) LUA_LIBDIR=\$\(out\)/lib/lua/5.2 LUA_INC=-I/nix/store/qfvnm0phz11skqzr1kp4kl92567bqrah-lua-5.2.3/include CFLAGS=-llua USE_SYSTEM_LUA=yes USE_SYSTEM_MPACK=yes MPACK_LUA_VERSION=5.2.3 LUA_CMOD_INSTALLDIR=\$\$out/lib/lua/5.2
clang -shared -llua -I/usr/include/lua5.2  lmpack.c -o mpack.so  -L/nix/store/j6sv33zmbxl143wh7a6jral3527vgiz0-libmpack-1.0.5/lib -lmpack
mkdir -p "$out/lib/lua/5.2"
install -Dm755 mpack.so "$out/lib/lua/5.2/mpack.so"
post-installation fixup
stripping (with flags -S) in /nix/store/0kivf60rd3jdv20b2lj32vw1nd1j1lfn-lua5.2-lua-mpack-1.0.7_ef025224a799066b818120fb1f30a308543a6e99/lib
patching script interpreter paths in /nix/store/0kivf60rd3jdv20b2lj32vw1nd1j1lfn-lua5.2-lua-mpack-1.0.7_ef025224a799066b818120fb1f30a308543a6e99
/nix/store/j6sv33zmbxl143wh7a6jral3527vgiz0-libmpack-1.0.5
/nix/store/0kivf60rd3jdv20b2lj32vw1nd1j1lfn-lua5.2-lua-mpack-1.0.7_ef025224a799066b818120fb1f30a308543a6e99

Copy link

@GrahamcOfBorg GrahamcOfBorg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Success for system: x86_64-linux

install -Dm755 mpack.so "$out/lib/lua/5.2/mpack.so"
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/85n2f4m9c9hyijw21x2k9njhg610dsgj-lua5.2-lua-mpack-1.0.7_ef025224a799066b818120fb1f30a308543a6e99
shrinking /nix/store/85n2f4m9c9hyijw21x2k9njhg610dsgj-lua5.2-lua-mpack-1.0.7_ef025224a799066b818120fb1f30a308543a6e99/lib/lua/5.2/mpack.so
stripping (with flags -S) in /nix/store/85n2f4m9c9hyijw21x2k9njhg610dsgj-lua5.2-lua-mpack-1.0.7_ef025224a799066b818120fb1f30a308543a6e99/lib 
patching script interpreter paths in /nix/store/85n2f4m9c9hyijw21x2k9njhg610dsgj-lua5.2-lua-mpack-1.0.7_ef025224a799066b818120fb1f30a308543a6e99
checking for references to /tmp/nix-build-lua5.2-lua-mpack-1.0.7_ef025224a799066b818120fb1f30a308543a6e99.drv-0 in /nix/store/85n2f4m9c9hyijw21x2k9njhg610dsgj-lua5.2-lua-mpack-1.0.7_ef025224a799066b818120fb1f30a308543a6e99...
warning: SQLite database is busy
/nix/store/hf7smfj41jjb0sbzvp7ryjc0avw8dmas-libmpack-1.0.5
/nix/store/85n2f4m9c9hyijw21x2k9njhg610dsgj-lua5.2-lua-mpack-1.0.7_ef025224a799066b818120fb1f30a308543a6e99

@pikajude
Copy link
Contributor

needs to be

(if lib.hasPrefix "luajit" lua.name then "CFLAGS=-lluajit-${lua.luaversion}" else "CFLAGS=-llua")

LnL7 and others added 3 commits November 29, 2017 02:38
On darwin we need the correct prefix during the buildPhase, otherwise
the dynamic libraries have an incorrect install_name.
Copy link
Contributor

@orivej orivej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have replaced -llua with the solution recommended here and already employed in 61c48d9.

@pikajude
Copy link
Contributor

pikajude commented Nov 29, 2017

@orivej mpack w/ luajit, and by extension neovim, are still broken as of that commit, with ld complaining that all the _lua_* symbols are not found

@LnL7
Copy link
Member Author

LnL7 commented Nov 29, 2017

@orivej Thanks!

Copy link
Member Author

@LnL7 LnL7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pikajude are you sure?

-- Installing: /nix/store/cg87wyq8rfd272dcph9z0569vx5avnvg-neovim-0.2.1/share/nvim/runtime/print/mac-roman.ps
-- Installing: /nix/store/cg87wyq8rfd272dcph9z0569vx5avnvg-neovim-0.2.1/share/nvim/runtime/print/prolog.ps
-- Installing: /nix/store/cg87wyq8rfd272dcph9z0569vx5avnvg-neovim-0.2.1/share/nvim/runtime/tutor/en/vim-01-beginner.tutor
-- Installing: /nix/store/cg87wyq8rfd272dcph9z0569vx5avnvg-neovim-0.2.1/share/nvim/runtime/tutor/tutor.tutor
post-installation fixup
gzipping man pages under /nix/store/cg87wyq8rfd272dcph9z0569vx5avnvg-neovim-0.2.1/share/man/
stripping (with flags -S) in /nix/store/cg87wyq8rfd272dcph9z0569vx5avnvg-neovim-0.2.1/bin
patching script interpreter paths in /nix/store/cg87wyq8rfd272dcph9z0569vx5avnvg-neovim-0.2.1
/nix/store/cg87wyq8rfd272dcph9z0569vx5avnvg-neovim-0.2.1/share/nvim/runtime/macros/less.sh: interpreter directive changed from "/bin/sh" to "/nix/store/i6xy9nh39wwzs048hh6fabb2fbqphvya-bash-4.4-p12/bin/sh"
/nix/store/cg87wyq8rfd272dcph9z0569vx5avnvg-neovim-0.2.1

@pikajude
Copy link
Contributor

@LnL7 what commit are you on? I just pulled and still get the ld error

@pikajude
Copy link
Contributor

False alarm, my git pull wasn't git pull-y enough

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants