From 98d9798158ee5e569dad4fcc4424153c39b8ee6b Mon Sep 17 00:00:00 2001 From: Eugen Zalinescu Date: Fri, 24 Jun 2022 14:36:50 +0200 Subject: [PATCH 1/3] change files' mode (not executable) --- Makefile | 0 README.md | 0 src/lua.c | 0 3 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 Makefile mode change 100755 => 100644 README.md mode change 100755 => 100644 src/lua.c diff --git a/Makefile b/Makefile old mode 100755 new mode 100644 diff --git a/README.md b/README.md old mode 100755 new mode 100644 diff --git a/src/lua.c b/src/lua.c old mode 100755 new mode 100644 From e9298157d63027144a185e90fdc081f7c5dc7200 Mon Sep 17 00:00:00 2001 From: Eugen Zalinescu Date: Fri, 24 Jun 2022 14:38:45 +0200 Subject: [PATCH 2/3] generate position-independent code This is to avoid getting the following error: ``` /usr/bin/ld: lua.o: warning: relocation against `sqlite3_api' in read-only section `.text' /usr/bin/ld: lua.o: relocation R_X86_64_PC32 against symbol `sqlite3_api' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: bad value ``` --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 8551cf2..5ef7d8e 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ lua.so: lua.o @[ "`uname -s`" == "Darwin" ] && mv lua.so lua.dylib || : lua.o: src/lua.c - cc -c $(LUA_CFLAGS) $(SQLITE_FLAGS) -O3 src/lua.c - + cc -fPIC -c $(LUA_CFLAGS) $(SQLITE_FLAGS) -O3 src/lua.c + clean: rm lua.o From 388e03c7e7cd2f0c4fd79fe18d341bafdb9e209e Mon Sep 17 00:00:00 2001 From: Eugen Zalinescu Date: Fri, 24 Jun 2022 14:39:39 +0200 Subject: [PATCH 3/3] avoid shell error on Ubuntu this line gives: ``` /bin/sh: 1: [: Linux: unexpected operator ``` --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5ef7d8e..26bcdf9 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ all: lua.so lua.so: lua.o cc -shared -o lua.so lua.o $(LUA_LIB) - @[ "`uname -s`" == "Darwin" ] && mv lua.so lua.dylib || : + # @[ "`uname -s`" == "Darwin" ] && mv lua.so lua.dylib || : lua.o: src/lua.c cc -fPIC -c $(LUA_CFLAGS) $(SQLITE_FLAGS) -O3 src/lua.c