Closed robinyuan1002 closed 1 week ago
I ran all the test cases of Lind, and basically none of them could compile. Mainly due to the lack of some header files, # include <linux/errno.h>, # include <linux/falloc.h>, # include <asm/socket.h>. I'll try to find and install it.
wasm-ld: error: /tmp/uds-socketselect-63ca2b.o: undefined symbol: connect wasm-ld: error: /tmp/uds-socketselect-63ca2b.o: undefined symbol: bind wasm-ld: error: /tmp/uds-socketselect-63ca2b.o: undefined symbol: accept wasm-ld: error: /home/lind-wasm/glibc/sysroot/lib/wasm32-wasi/libc.a(nanosleep.o): undefined symbol: __clock_nanosleep_time64 clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
Where is asm/socket.h included?
uds-nb-select.c, uds-serverclient.c, uds-socketselect.c
I don't see any of those declared in those programs. Are you talking about sys/socket.h?
yes, in sys/socket.h there is a header file called bit/socket.h, and in bit/socket.h there is a header file called asm/socket.h
Okay, so these are included within the libraries so its entirely a glibc issue. Thats good to know.
So for NaCl, asm/socket.h is actually an include file generated by the nacl-toolchain and is platform specific. @yzhang71 are there wasm toolchain generated include files?
No, we don't have asm/socket.h generated, but we have bit/socket.h generated, and there is condition to use asm/socket.h
#ifdef __USE_MISC
# include <bits/types/time_t.h>
# include <asm/socket.h>
#else
# define SO_DEBUG 1
# include <bits/socket-constants.h>
#endif
For the undefined symbol error, I just found out that it was due to bind.c
in glibc failing to compile and not being successfully turned into bind.o
. The error message was buried among a sea of warnings and other errors during the make process, so we did not notice it previously. I guess that's the same for connect.c and accept.c. I'll try to fix this later
No, we don't have asm/socket.h generated, but we have bit/socket.h generated, and there is condition to use asm/socket.h
#ifdef __USE_MISC # include <bits/types/time_t.h> # include <asm/socket.h> #else # define SO_DEBUG 1 # include <bits/socket-constants.h> #endif
IIRC bits/socket.h is a file in libc. What I'm saying is that asm/socket.h is not a libc file. It's a platform file.
For example on my system its located at /usr/x86_64-linux-gnux32/include/asm/socket.h
When we compile NaCl this file is generated, as opposed to the other files which are in the libc repo.
Update There is no problem with open, read and close.
Problem When I was testing read.c, I encountered a problem. The isprint() function returned false no matter how much input was entered. This seemed to be a problem, but it did not affect the test very much.
@qianxichen233 found that copying the system includes into the wasm folder ie /usr/x86_64-linux-gnux32/include/asm/socket.h
fixes the builds. We need to:
@yzhang71 Can you point me to the wasm generated headers you were talking about in the meeting?
Hi Nick, here is the header files that we are currently using: https://github.com/Lind-Project/glibc/tree/main/include
Hi Nick, I use glibc/target/include which is same with Dennis's link. I look for the header file I need based on the compile error, for example I created a directory called asm-generic and add a file called errno.base.h(Here is the link: https://github.com/torvalds/linux/blob/master/include/uapi/asm-generic/errno-base.h).
Okay that sounds good. Dennis is going to check with Zulip but we can probably use these if they dont have anything. We probably want to move these out of the glibc folder since theyre not technically libc files.
Update: There is no problem with rename(6), xstat(9), open(10), close(11), read(12), write(13), fstatfs(19), dup(24), dup2(25), getcwd(47), mkdir(131), rmdir(132), chmod(133), fchmod(134)
Track the progress on adding syscalls to Lind-Wasm