diff --git a/lualib/Makefile.clang b/lualib/Makefile.clang index f3131f2..d56a712 100644 --- a/lualib/Makefile.clang +++ b/lualib/Makefile.clang @@ -14,7 +14,7 @@ CC= clang-16 # And if __ISO_C_VISIBLE=1999 then LLONG_MAX is defined in ckb-c-stdlib # See https://github.com/nervosnetwork/ckb-c-stdlib/blob/efe1fe6b3cdda12e248e25664f5c04cbf7876265/libc/limits.h#L94 # and https://github.com/nervosnetwork/ckb-lua/blob/b71d44288e8fb085074d3af056b359b8c6c22afa/lualib/luaconf.h#L502 -CFLAGS= --target=riscv64 -march=rv64imc_zba_zbb_zbc_zbs -Ic-stdlib -I../include/ckb-c-stdlib -I../include/ckb-c-stdlib/libc -O3 -Wall -Wextra -D__ISO_C_VISIBLE=1999 -DLUA_COMPAT_5_3 -ULUA_USE_LINUX -ULUA_USE_POSIX -fno-builtin-printf -fno-builtin-memcmp -nostdinc -nostdlib $(SYSCFLAGS) $(MYCFLAGS) +CFLAGS= --target=riscv64 -march=rv64imc_zba_zbb_zbc_zbs -Ic-stdlib -I../include/ckb-c-stdlib -I../include/ckb-c-stdlib/libc -O3 -Wall -Wextra -D__ISO_C_VISIBLE=1999 -DCKB_DECLARATION_ONLY -DCKB_MALLOC_DECLARATION_ONLY -DLUA_COMPAT_5_3 -ULUA_USE_LINUX -ULUA_USE_POSIX -fno-builtin-printf -fno-builtin-memcmp -nostdinc -nostdlib $(SYSCFLAGS) $(MYCFLAGS) LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS) LIBS= -lm $(SYSLIBS) $(MYLIBS) diff --git a/lualib/c-stdlib/my_stdio.h b/lualib/c-stdlib/my_stdio.h index 7133fb0..a996e66 100644 --- a/lualib/c-stdlib/my_stdio.h +++ b/lualib/c-stdlib/my_stdio.h @@ -22,9 +22,9 @@ typedef struct FILE { uint32_t offset; } FILE; -FILE *stdin; -FILE *stdout; -FILE *stderr; +extern FILE *stdin; +extern FILE *stdout; +extern FILE *stderr; int remove(const char *__filename); diff --git a/lualib/c-stdlib/my_string.h b/lualib/c-stdlib/my_string.h index cacdd7c..ac94622 100644 --- a/lualib/c-stdlib/my_string.h +++ b/lualib/c-stdlib/my_string.h @@ -2,6 +2,7 @@ #define LUA_C_STDLIB_STRING_H_ #include +#include char *strchr (const char *, int); int strncmp(const char *_l, const char *_r, size_t n);