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

make build fail due to luaclib/lfs.so #24

Closed
vm-001 opened this issue Jan 18, 2024 · 6 comments
Closed

make build fail due to luaclib/lfs.so #24

vm-001 opened this issue Jan 18, 2024 · 6 comments

Comments

@vm-001
Copy link
Contributor

vm-001 commented Jan 18, 2024

Cannot build on both Intel and Apple CPU on MacOSX

make build
cc -g -O0 -Wall -Iskynet/3rd/lua -I3rd/lua-openssl-0.8.5-0/deps/auxiliar/ -I3rd/lua-openssl-0.8.5-0/deps/lua-compat/ -I3rd/lua-openssl-0.8.5-0/deps/lua-compat/c-api/ -I3rd/lua-openssl-0.8.5-0/src/   -fPIC --shared -I3rd/luafilesystem-1_8_0/src 3rd/luafilesystem-1_8_0/src/lfs.c -o luaclib/lfs.so
ld: Undefined symbols:
  _luaL_argerror, referenced from:
      _dir_iter in lfs-c038af.o
  _luaL_checklstring, referenced from:
      _change_dir in lfs-c038af.o
      _dir_iter_factory in lfs-c038af.o
      _make_link in lfs-c038af.o
      _make_link in lfs-c038af.o
      _file_lock in lfs-c038af.o
      _make_dir in lfs-c038af.o
      _remove_dir in lfs-c038af.o
      ...
  _luaL_checkoption, referenced from:
      _lfs_g_setmode in lfs-c038af.o
  _luaL_checkudata, referenced from:
      _dir_iter in lfs-c038af.o
      _lfs_unlock_dir in lfs-c038af.o
      _check_file in lfs-c038af.o
  _luaL_checkversion_, referenced from:
      _luaopen_lfs in lfs-c038af.o
  _luaL_error, referenced from:
      _dir_iter_factory in lfs-c038af.o
      __file_info_ in lfs-c038af.o
      _check_file in lfs-c038af.o
      __file_lock in lfs-c038af.o
  _luaL_newmetatable, referenced from:
      _dir_create_meta in lfs-c038af.o
      _lock_create_meta in lfs-c038af.o
  _luaL_optinteger, referenced from:
      _file_lock in lfs-c038af.o
      _file_lock in lfs-c038af.o
      _file_utime in lfs-c038af.o
      _file_unlock in lfs-c038af.o
      _file_unlock in lfs-c038af.o
  _luaL_optnumber, referenced from:
      _file_utime in lfs-c038af.o
  _luaL_setfuncs, referenced from:
      _luaopen_lfs in lfs-c038af.o
  _lua_createtable, referenced from:
      _luaopen_lfs in lfs-c038af.o
      _dir_create_meta in lfs-c038af.o
      _lock_create_meta in lfs-c038af.o
      __file_info_ in lfs-c038af.o
  _lua_getfield, referenced from:
      _dir_iter_factory in lfs-c038af.o
      _lfs_lock_dir in lfs-c038af.o
  _lua_gettop, referenced from:
      _file_utime in lfs-c038af.o
  _lua_isstring, referenced from:
      _link_info in lfs-c038af.o
      __file_info_ in lfs-c038af.o
  _lua_newuserdatauv, referenced from:
      _dir_iter_factory in lfs-c038af.o
      _lfs_lock_dir in lfs-c038af.o
  _lua_pushboolean, referenced from:
      _change_dir in lfs-c038af.o
      _file_lock in lfs-c038af.o
      _file_unlock in lfs-c038af.o
      _pushresult in lfs-c038af.o
      _lfs_g_setmode in lfs-c038af.o
  _lua_pushcclosure, referenced from:
      _dir_create_meta in lfs-c038af.o
      _dir_create_meta in lfs-c038af.o
      _dir_create_meta in lfs-c038af.o
      _dir_create_meta in lfs-c038af.o
      _lock_create_meta in lfs-c038af.o
      _lock_create_meta in lfs-c038af.o
      _dir_iter_factory in lfs-c038af.o
      ...
  _lua_pushfstring, referenced from:
      _change_dir in lfs-c038af.o
      _file_lock in lfs-c038af.o
      _file_unlock in lfs-c038af.o
      __file_info_ in lfs-c038af.o
      _pusherror in lfs-c038af.o
  _lua_pushinteger, referenced from:
      _push_st_dev in lfs-c038af.o
      _push_st_ino in lfs-c038af.o
      _push_st_nlink in lfs-c038af.o
      _push_st_uid in lfs-c038af.o
      _push_st_gid in lfs-c038af.o
      _push_st_rdev in lfs-c038af.o
      _push_st_atime in lfs-c038af.o
      ...
  _lua_pushlstring, referenced from:
      _push_link_target in lfs-c038af.o
  _lua_pushnil, referenced from:
      _change_dir in lfs-c038af.o
      _dir_iter_factory in lfs-c038af.o
      _file_lock in lfs-c038af.o
      _file_unlock in lfs-c038af.o
      _lfs_lock_dir in lfs-c038af.o
      _lfs_lock_dir in lfs-c038af.o
      __file_info_ in lfs-c038af.o
      ...
  _lua_pushstring, referenced from:
      _push_st_mode in lfs-c038af.o
      _push_st_perm in lfs-c038af.o
      _set_info in lfs-c038af.o
      _set_info in lfs-c038af.o
      _set_info in lfs-c038af.o
      _dir_iter in lfs-c038af.o
      _get_dir in lfs-c038af.o
      ...
  _lua_pushvalue, referenced from:
      _luaopen_lfs in lfs-c038af.o
      _dir_iter_factory in lfs-c038af.o
  _lua_rawset, referenced from:
      __file_info_ in lfs-c038af.o
  _lua_setfield, referenced from:
      _dir_create_meta in lfs-c038af.o
      _dir_create_meta in lfs-c038af.o
      _dir_create_meta in lfs-c038af.o
      _dir_create_meta in lfs-c038af.o
      _dir_create_meta in lfs-c038af.o
      _lock_create_meta in lfs-c038af.o
      _lock_create_meta in lfs-c038af.o
      _lock_create_meta in lfs-c038af.o
      ...
  _lua_setglobal, referenced from:
      _luaopen_lfs in lfs-c038af.o
  _lua_setmetatable, referenced from:
      _dir_iter_factory in lfs-c038af.o
      _lfs_lock_dir in lfs-c038af.o
  _lua_settop, referenced from:
      __file_info_ in lfs-c038af.o
  _lua_toboolean, referenced from:
      _make_link in lfs-c038af.o
  _lua_tolstring, referenced from:
      _link_info in lfs-c038af.o
      __file_info_ in lfs-c038af.o
  _lua_touserdata, referenced from:
      _dir_close in lfs-c038af.o
  _lua_type, referenced from:
      _link_info in lfs-c038af.o
      __file_info_ in lfs-c038af.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [luaclib/lfs.so] Error 1
@huahua132
Copy link
Owner

It seems that there is an error when compiling with clang. I tried to compile with clang on ubuntu, but the error did not appear. Please provide complete environment information, and then you can also try to compile with gcc.

@vm-001
Copy link
Contributor Author

vm-001 commented Jan 24, 2024

I'm using MacOS(I tested both Intel and Apple CPU, both are not working). Not sure how to solve the luaclib/lfs.so.

@huahua132
Copy link
Owner

Sorry, I don't have a macOS system and cannot attempt to solve it. If you are interested, I hope you can help me solve it. Thank you very much!

@huahua132
Copy link
Owner

6148e97
Please see if the latest modifications can solve your problem

@vm-001
Copy link
Contributor Author

vm-001 commented Jan 26, 2024

I tried, and another error came out.

make macosx
cd skynet && /Applications/Xcode.app/Contents/Developer/usr/bin/make PLAT=macosx TLS_MODULE=ltls TLS_LIB=/usr/bin/openssl TLS_INC=/usr/include/openssl
/Applications/Xcode.app/Contents/Developer/usr/bin/make macosx
/Applications/Xcode.app/Contents/Developer/usr/bin/make all PLAT=macosx SKYNET_LIBS="-lpthread -lm -ldl" SHARED="-fPIC -dynamiclib -Wl,-undefined,dynamic_lookup" EXPORT="" MALLOC_STATICLIB="" SKYNET_DEFINES="-DNOUSE_JEMALLOC"
cc -g -O2 -Wall -I3rd/lua  -o skynet skynet-src/skynet_main.c skynet-src/skynet_handle.c skynet-src/skynet_module.c skynet-src/skynet_mq.c skynet-src/skynet_server.c skynet-src/skynet_start.c skynet-src/skynet_timer.c skynet-src/skynet_error.c skynet-src/skynet_harbor.c skynet-src/skynet_env.c skynet-src/skynet_monitor.c skynet-src/skynet_socket.c skynet-src/socket_server.c skynet-src/malloc_hook.c skynet-src/skynet_daemon.c skynet-src/skynet_log.c 3rd/lua/liblua.a -Iskynet-src -I3rd/jemalloc/include/jemalloc   -lpthread -lm -ldl -DNOUSE_JEMALLOC
cc -g -O2 -Wall -I3rd/lua  -fPIC -dynamiclib -Wl,-undefined,dynamic_lookup service-src/service_snlua.c -o cservice/snlua.so -Iskynet-src
cc -g -O2 -Wall -I3rd/lua  -fPIC -dynamiclib -Wl,-undefined,dynamic_lookup service-src/service_logger.c -o cservice/logger.so -Iskynet-src
cc -g -O2 -Wall -I3rd/lua  -fPIC -dynamiclib -Wl,-undefined,dynamic_lookup service-src/service_gate.c -o cservice/gate.so -Iskynet-src
cc -g -O2 -Wall -I3rd/lua  -fPIC -dynamiclib -Wl,-undefined,dynamic_lookup service-src/service_harbor.c -o cservice/harbor.so -Iskynet-src
cc -g -O2 -Wall -I3rd/lua  -fPIC -dynamiclib -Wl,-undefined,dynamic_lookup lualib-src/lua-skynet.c lualib-src/lua-seri.c lualib-src/lua-socket.c lualib-src/lua-mongo.c lualib-src/lua-netpack.c lualib-src/lua-memory.c lualib-src/lua-multicast.c lualib-src/lua-cluster.c lualib-src/lua-crypt.c lualib-src/lsha1.c lualib-src/lua-sharedata.c lualib-src/lua-stm.c lualib-src/lua-debugchannel.c lualib-src/lua-datasheet.c lualib-src/lua-sharetable.c -o luaclib/skynet.so -Iskynet-src -Iservice-src -Ilualib-src
cc -g -O2 -Wall -I3rd/lua  -fPIC -dynamiclib -Wl,-undefined,dynamic_lookup lualib-src/lua-clientsocket.c lualib-src/lua-crypt.c lualib-src/lsha1.c -o luaclib/client.so -lpthread
cc -g -O2 -Wall -I3rd/lua  -fPIC -dynamiclib -Wl,-undefined,dynamic_lookup -Iskynet-src lualib-src/lua-bson.c -o luaclib/bson.so
cc -g -O2 -Wall -I3rd/lua  -fPIC -dynamiclib -Wl,-undefined,dynamic_lookup -I3rd/lua-md5 3rd/lua-md5/md5.c 3rd/lua-md5/md5lib.c 3rd/lua-md5/compat-5.2.c -o luaclib/md5.so 
cc -g -O2 -Wall -I3rd/lua  -fPIC -dynamiclib -Wl,-undefined,dynamic_lookup -Ilualib-src/sproto lualib-src/sproto/sproto.c lualib-src/sproto/lsproto.c -o luaclib/sproto.so 
cc -g -O2 -Wall -I3rd/lua  -fPIC -dynamiclib -Wl,-undefined,dynamic_lookup -I3rd/lpeg 3rd/lpeg/lpcap.c 3rd/lpeg/lpcode.c 3rd/lpeg/lpprint.c 3rd/lpeg/lptree.c 3rd/lpeg/lpvm.c 3rd/lpeg/lpcset.c -o luaclib/lpeg.so 
cc -g -O2 -Wall -I3rd/lua  -fPIC -dynamiclib -Wl,-undefined,dynamic_lookup -Iskynet-src -L/usr/bin/openssl -I/usr/include/openssl lualib-src/ltls.c -o luaclib/ltls.so -lssl
lualib-src/ltls.c:5:10: fatal error: 'openssl/err.h' file not found
#include <openssl/err.h>
         ^~~~~~~~~~~~~~~
1 error generated.
make[3]: *** [luaclib/ltls.so] Error 1
make[2]: *** [macosx] Error 2
make[1]: *** [default] Error 2
make: *** [skynet/skynet] Error 2

@huahua132
Copy link
Owner

Please install the OpenSSL library for the Mac system
This is how the Ubuntu system is installed

apt-get install openssl
apt-get install libssl-dev

@vm-001 vm-001 closed this as completed Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants