Closed sohunjug closed 1 year ago
Are you on a Mac?
Yes, 2021 M1 Pro
That is not supported currently. To build a shared object file on a Mac with cargo requires another way than what I have set up in the makefile. If you want you could create a PR to support this as I don't have a Mac to test it on.
Okay, so I have checked this issue a bit and it seems that the linking stage goes wrong. The Lua symbols are not found (might be magled)
When I get time I will try figure it out. But you could try adding #[no_mangle]
with the extern
keyword in lib.rs, like it is done here: https://stackoverflow.com/questions/61717936/undefined-reference-when-using-rust-library-in-c#61718084
Could also test change cdylib
to dylib
in Cargo.toml
This don't work either
Hi, I think i fixed it. Could you verify that #79 works?
I build success, But I get a file 'librsync_nvim.dylib*'
/Users/xxx/.local/share/nvim/site/pack/packer/start/rsync.nvim/plugin/rsync.lua :
E5113: Error while calling lua chunk: .../nvim/site/pack/packer/start/rsync.nvim/plugin/rsync.lua:2: loop or previous error loading module 'rsync'
stack traceback:
[C]: in function 'require'
.../nvim/site/pack/packer/start/rsync.nvim/plugin/rsync.lua:2: in main chunk
ls target/release
build/ deps/ examples/ incremental/ librsync_nvim.d librsync_nvim.dylib*
I cp it to .so
ls lua
deps/ rsync/ librsync_nvim.dylib* librsync_nvim.so*
Did you copy the rlib files, like it's done in the Makefile?
@mkdir -p $(PWD)/lua/deps/
cp $(PWD)/target/release/deps/*.rlib $(PWD)/lua/deps/
Also do not have both .dylib and .so file in the lua folder.
I have already copy the rlib files, and test only one file .dylib or .so , still error
I used neovim 0.9.1, I tried :lua require"rsync_nvim"
show this
I found a new error
packer.nvim: Error running config for rsync.nvim: vim/_init_packages.lua:0: dlopen(/Users/xxx/.local/share/nvim/site/pack/packer/start/rsync.nvim/lua/rsync_nvim.so, 0x0006): symbol not found in flat namespace '_lua_resetthread'
Looks like the previous error to me. Haven't had time to try to fix this yet. Just one question if you clone a new version of this and run make
do you still get the error if you open nvim? (Do it all from scratch)
After #79 this was fixed. If you check in the newly created PR #97 then you will see that it runs just fine.