matsumotory / ngx_mruby

ngx_mruby - A Fast and Memory-Efficient Web Server Extension Mechanism Using Scripting Language mruby for nginx
https://ngx.mruby.org/
988 stars 112 forks source link

Dynamic library build failing #481

Closed Zogoo closed 4 years ago

Zogoo commented 4 years ago

OS: Ubuntu 20.04 OpenSSL version: 1.1.1f C builder: gcc

I could build Nginx and install Nginx with build.sh command. But when I tried to build dynamic module for Nginx it fails with following command.

Command: env BUILD_DYNAMIC_MODULE=TRUE sh ./build.sh env BUILD_DYNAMIC_MODULE=TRUE LDFLAGS=-v sh ./build.sh

Output:

-ldl -lpthread -lcrypt -L/home/user/c-workspace/ngx_mruby/mruby/build/host/lib -L/usr/local/lib -L/home/user/c-workspace/ngx_mruby/mruby/build/host/lib -L/usr/local/lib -lmruby -lm -lcrypto -lpthread -lpthread -lrt -lpthread -lrt /home/user/c-workspace/ngx_mruby/mruby/build/host/mrbgems/mruby-redis/hiredis/lib/libhiredis.a -L -lmruby -lpcre -lz \
-Wl,-E
cc -o objs/ngx_http_mruby_module.so \
objs/addon/http/ngx_http_mruby_module.o \
objs/addon/http/ngx_http_mruby_core.o \
objs/addon/http/ngx_http_mruby_init.o \
objs/addon/http/ngx_http_mruby_request.o \
objs/addon/http/ngx_http_mruby_var.o \
objs/addon/http/ngx_http_mruby_connection.o \
objs/addon/http/ngx_http_mruby_server.o \
objs/addon/http/ngx_http_mruby_filter.o \
objs/addon/http/ngx_http_mruby_upstream.o \
objs/addon/http/ngx_http_mruby_ssl.o \
objs/addon/http/ngx_http_mruby_async.o \
objs/addon/stream/ngx_stream_mruby_module.o \
objs/addon/stream/ngx_stream_mruby_init.o \
objs/addon/stream/ngx_stream_mruby_core.o \
objs/addon/stream/ngx_stream_mruby_connection.o \
objs/addon/stream/ngx_stream_mruby_async.o \
objs/ngx_http_mruby_module_modules.o \
-L/home/user/c-workspace/ngx_mruby/mruby/build/host/lib -L/usr/local/lib -L/home/user/c-workspace/ngx_mruby/mruby/build/host/lib -L/usr/local/lib -lmruby -lm -lcrypto -lpthread -lpthread -lrt -lpthread -lrt /home/user/c-workspace/ngx_mruby/mruby/build/host/mrbgems/mruby-redis/hiredis/lib/libhiredis.a -L -lmruby \
-shared
/usr/bin/ld: /home/user/c-workspace/ngx_mruby/mruby/build/host/lib/libmruby.a(error.o): relocation R_X86_64_PC32 against symbol `stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
Zogoo commented 4 years ago

I just find out that I have to clean mruby and previous build folders. After I clean up previous build with following command I could successfully build, dynamic library. So, let me close this issue

make clean
make clobber
make clean_mruby