This repository was archived by the owner on Jun 30, 2023. It is now read-only.
Commit c912fff
authored
fix(build): make fails on macos (#55)
Fix building on osx and add install instructions for non-linux platforms.
Trying to build & install on linux leads to three errors:
1. Lua doesn't build
2. libmpack doesn't build
3. neovim/lua-client doesn't build
With this PR and libmpack/libmpack-lua#31 I'm able to build the lua client on osx.
```bash
uname -a
# Darwin hostname 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:22 PDT 2 022; root:xnu-8020.121.3~4/RELEASE_X86_64 x86_64
```
On `master`
```bash
make
# ...
# gcc -o lua lua.o liblua.a -lm -Wl,-E -ldl -lreadline -lhistory -lncurses
# ld: unknown option: -E
# clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
This error installing lua is fixed by specifying a `LUA_TARGET` of `macosx` instead of `linux`. In general, several `LUA_TARGET`s can be specified. I've added them to `README.md`. The source of truth is `make` from lua itself, e.g.
```bash
cd .deps/5.1.5/src/lua && make
# Please do
# make PLATFORM
# where PLATFORM is one of these:
# aix ansi bsd freebsd generic linux macosx mingw posix solaris
# See INSTALL for complete instructions.
```
The next issue is that `libmpack` doesn't build. See [libpack-lua#131](libmpack/libmpack-lua#31). Apply the fix locally and install via:
```bash
cd ~/src/libmpack/libmpack-lua/
~/src/neovim/lua-client/.deps/usr/bin/luarocks make
```
With `libmpack` and lua installed `make` now errors with:
```
cc -g -fPIC -Wall -Wextra -Werror -Wconversion -Wextra -Wstrict-prototypes -ped
antic -o nvim/native.o -c nvim/native.c -I/Users/hjdivad/src/neovim/lua-client/
.deps/usr/include
cc -shared -fPIC nvim/native.o -o nvim/native.so
Undefined symbols for architecture x86_64:
"_luaL_checkinteger", referenced from:
_pid_wait in native.o
"_luaL_register", referenced from:
_luaopen_nvim_native in native.o
"_lua_createtable", referenced from:
_luaopen_nvim_native in native.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
This is fixed by adding `-undefined dynamic_lookup` to `LDFLAGS` and not relying on it being the default behaviour.1 parent 6fbdaee commit c912fff
2 files changed
+17
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
15 | 31 | | |
16 | 32 | | |
17 | 33 | | |
| |||
0 commit comments