Issue compiling nginx with pcre on ubuntu - nginx

I'm having problems building ngnix with the PCRE library on Ubuntu 12.04.1 LTS. Configuring runs OK but the make command fails. I'm fairly new to nginx and Linux in general so I'm not sure what the issue is.
Installation steps:
./configure --add-module=/home/ubuntu/mod_zip/mod_zip-master --with-http_image_filter_module --without-http_rewrite_module --with-pcre=../pcre-8.32
make
make install
Error
cd ../pcre-8.32 \
&& make libpcre.la
make[2]: Entering directory `/home/ubuntu/pcre-8.32'
CC libpcre_la-pcre_byte_order.lo
CC libpcre_la-pcre_compile.lo
CC libpcre_la-pcre_config.lo
CC libpcre_la-pcre_dfa_exec.lo
CC libpcre_la-pcre_exec.lo
CC libpcre_la-pcre_fullinfo.lo
CC libpcre_la-pcre_get.lo
CC libpcre_la-pcre_globals.lo
CC libpcre_la-pcre_jit_compile.lo
CC libpcre_la-pcre_maketables.lo
CC libpcre_la-pcre_newline.lo
CC libpcre_la-pcre_ord2utf8.lo
CC libpcre_la-pcre_refcount.lo
CC libpcre_la-pcre_string_utils.lo
CC libpcre_la-pcre_study.lo
CC libpcre_la-pcre_tables.lo
CC libpcre_la-pcre_ucd.lo
CC libpcre_la-pcre_valid_utf8.lo
CC libpcre_la-pcre_version.lo
CC libpcre_la-pcre_xclass.lo
rm -f pcre_chartables.c
ln -s ./pcre_chartables.c.dist pcre_chartables.c
CC libpcre_la-pcre_chartables.lo
CCLD libpcre.la
make[2]: Leaving directory `/home/ubuntu/pcre-8.32'
gcc -o objs/nginx \
objs/src/core/nginx.o \
objs/src/core/ngx_log.o \
objs/src/core/ngx_palloc.o \
objs/src/core/ngx_array.o \
...
...
...
objs/addon/mod_zip-master/ngx_http_zip_module.o \
objs/addon/mod_zip-master/ngx_http_zip_parsers.o \
objs/addon/mod_zip-master/ngx_http_zip_file.o \
objs/addon/mod_zip-master/ngx_http_zip_headers.o \
objs/ngx_modules.o \
-lpthread -lcrypt ../pcre-8.32/.libs/libpcre.a -lcrypto -lcrypto -lz -lgd
objs/src/core/nginx.o: In function `main':
/home/ubuntu/nginx-1.2.6/src/core/nginx.c:275: undefined reference to `ngx_regex_init'
objs/src/http/ngx_http_core_module.o: In function `ngx_http_gzip_disable':
/home/ubuntu/nginx-1.2.6/src/http/ngx_http_core_module.c:4918: undefined reference to `ngx_regex_compile'
objs/src/http/ngx_http_core_module.o: In function `ngx_http_gzip_ok':
/home/ubuntu/nginx-1.2.6/src/http/ngx_http_core_module.c:2218: undefined reference to `ngx_regex_exec_array'
objs/src/http/ngx_http_variables.o: In function `ngx_http_regex_compile':
/home/ubuntu/nginx-1.2.6/src/http/ngx_http_variables.c:2074: undefined reference to `ngx_regex_compile'
objs/src/http/modules/ngx_http_ssi_filter_module.o: In function `ngx_http_ssi_regex_match':
/home/ubuntu/nginx-1.2.6/src/http/modules/ngx_http_ssi_filter_module.c:1882: undefined reference to `ngx_regex_compile'
objs/src/http/modules/ngx_http_referer_module.o: In function `ngx_http_referer_variable':
/home/ubuntu/nginx-1.2.6/src/http/modules/ngx_http_referer_module.c:197: undefined reference to `ngx_regex_exec_array'
objs/src/http/modules/ngx_http_referer_module.o: In function `ngx_http_add_regex_referer':
/home/ubuntu/nginx-1.2.6/src/http/modules/ngx_http_referer_module.c:582: undefined reference to `ngx_regex_compile'
objs/src/http/modules/ngx_http_fastcgi_module.o: In function `ngx_http_fastcgi_split_path_info':
/home/ubuntu/nginx-1.2.6/src/http/modules/ngx_http_fastcgi_module.c:2891: undefined reference to `ngx_regex_compile'
collect2: ld returned 1 exit status
make[1]: *** [objs/nginx] Error 1
make[1]: Leaving directory `/home/ubuntu/nginx-1.2.6'
make: *** [build] Error 2
Thanks!

You specify to not use the rewrite module, which means Nginx shouldn't need pcre. But then you specify the pcre location.
I think you should just remove the --with-pcre= parameter, then it should be fine. You don't need pcre anyway if you don't use the rewrite module.

Related

Compile libgnat to a single LLVM bitcode file

How can I compile libgnat to a single LLVM bitcode file? The latest dragonegg release is very old, so I provide a dockerfile to make testing more easy. My end goal is to run Ada in LLVM IR bitcode interpreters.
Dockerfile for the latest official dragonegg release
FROM ubuntu:trusty
COPY . /usr/src/workdir
WORKDIR /usr/src/workdir
RUN apt-get update \
&& apt-get -y install build-essential gnat-4.6 libgmp-dev libmpfr-dev libmpc-dev libz-dev gcc-4.6-plugin-dev
# libz-dev for ld when compiling dragonegg 3.3
# gcc-4.6-plugin-dev needed when compiling dragonegg 3.3
RUN tar -xzf gcc-4.6.4.tar.gz \
&& cd gcc-4.6.4 \
&& mkdir build \
&& cd build \
&& CC=gcc-4.6 ../configure --disable-multilib --enable-languages=ada,c,c++ --prefix=/opt/gcc-4.6.4 \
&& make -j4 \
&& make install
RUN tar -xzf clang+llvm-3.3-amd64-Ubuntu-12.04.2.tar.gz \
&& mv clang+llvm-3.3-amd64-Ubuntu-12.04.2 /opt/llvm-3.3
ENV PATH="/opt/llvm-3.3/bin:/opt/gcc-4.6.4/bin:${PATH}"
RUN tar -xzf dragonegg-3.3.src.tar.gz \
&& mv dragonegg-3.3.src dragonegg-3.3 \
&& cd dragonegg-3.3 \
&& GCC=/opt/gcc-4.6.4/bin/gcc make \
&& cp dragonegg.so /opt/dragonegg.so
download gcc-4.6.4.tar.gz
download clang+llvm-3.3-amd64-Ubuntu-12.04.2.tar.gz
download dragonegg-3.3.src.tar.gz
hello.adb
with Ada.Text_IO;
procedure Hello is
begin
Ada.Text_IO.Put_Line("Hello world from Ada (dragonegg)!");
end Hello;
Run gcc hello.adb -S -O1 -o hello.ll -fplugin=/opt/dragonegg.so -fplugin-arg-dragonegg-emit-ir to compile the hello.adb file. When I try to build the binary with llc -filetype=obj hello.ll and gcc hello.o, I get the following error:
/usr/lib/x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
hello.o: In function `_ada_hello':
hello.ll:(.text+0xb): undefined reference to `ada__text_io__put_line__2'
collect2: ld returned 1 exit status
The error message indicates that the Ada runtime library is missing. Currently, I have no idea, how I can compile the libgnat to a single LLVM bitcode file, so I can link it with the program.
Why are you using DragonEgg? That's well and truly dead! See https://github.com/AdaCore/gnat-llvm instead.

Compiling: undefined reference "clock_gettime and memcpy" for Qt project

I try to compile Qt project with CentOS.
This question describe what I have done in detail and
I want to do with another glibc libraries /users/my/lib64/ (I can't update /lib64/) by referring to this.
This is the compile out put:
g++ ./main.o ./moc_widget.o ./widget.o \
-o ./test -Wl,--rpath=/users/my/lib64 \
-Wl,--rpath=/users/my/Qt/5.9.1/gcc_64/lib \
-Wl,--dynamic-linker=/users/my/lib64/libc.so.6 \
-Wl,--dynamic-linker=/users/my/lib64/libz.so.1 \
-L/users/my/Qt/5.9.1/gcc_64/lib -lQt5Widgets \
-lQt5Gui -lQt5Core -lGL -lpthread -lglib-2.0 -lrt -lX11 \
-I/users/my/test/2 \
-I/users/my/Qt/5.9.1/gcc_64/include \
-I/users/my/Qt/5.9.1/gcc_64/include/QtWidgets \
-I/users/my/Qt/5.9.1/gcc_64/include/QtCore \
-I/users/my/Qt/5.9.1/gcc_64/include/QtGui
.pro file :
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = test
TEMPLATE = app
DEFINES += QT_DEPRECATED_WARNINGS
CONFIG += qt
SOURCES += \
main.cpp \
widget.cpp
HEADERS += \
widget.h
FORMS += \
widget.ui
gcc version : 6.1.0
But the error:
/users/my/Qt/5.9.1/gcc_64/lib/libQt5Core.so: undefined reference to `clock_gettime#GLIBC_2.17'
/users/my/Qt/5.9.1/gcc_64/lib/libQt5Widgets.so: undefined reference to `memcpy#GLIBC_2.14'
collect2 ld returned exit 1 status
How to solve it ?
g++ ./main.o ./moc_widget.o ./widget.o \
-o ./test -Wl,--rpath=/users/my/lib64 \
-Wl,--rpath=/users/my/Qt/5.9.1/gcc_64/lib \
-Wl,--dynamic-linker=/users/my/lib64/libc.so.6 \
-Wl,--dynamic-linker=/users/my/lib64/libz.so.1 \
-L/users/my/Qt/5.9.1/gcc_64/lib -lQt5Widgets \
-lQt5Gui -lQt5Core -lGL -lpthread -lglib-2.0 -lrt -lX11 \
-I...
This command line is completely bogus (you didn't understand previous answer): there can only be one dynamic linker, and it should be /users/my/lib64/ld-linux-x86-64.so.2, and not libz.so.1. By using multiple --dynamic-linker=... flags, you are simply replacing previous (incorrect) setting with a new (also incorrect) one.
It's also bogus because specifying -I... flags on the link line without any sources is pointless.
If this command succeeded, you'd end up with an executable that would simply crash immediately, because libz.so.1 is not a dynamic linker.
Now, your link fails because you are performing the link on the wrong system. You need to link on the original system (the one where you successfully linked your binary earlier, and the one which has GLIBC 2.17 or later). And then move the linked executable to your target system.
On the original system, your link command should look something like this:
g++ main.o moc_widget.o widget.o -o test \
-Wl,-rpath=/users/my/lib64 \
-Wl,--dynamic-linker=/users/my/lib64/ld-linux-x86-64.so.2 \
-L...
The two lines I indented above should be the only change from your original successful link command.

openldap configuration on solaris 10

While installing openldap, I am getting below error and compilation stops, please advice.
cc -g -I../../../include -I../../../include -I.. -I./.. -I./../../../libraries/liblmdb -I/sites/bdb/include -c ./../../../libraries/liblmdb/mdb.c -o mdb.o
"./../../../libraries/liblmdb/mdb.c", line 4625: warning: implicit function declaration: pthread_mutexattr_setrobust
"./../../../libraries/liblmdb/mdb.c", line 4625: undefined symbol: PTHREAD_MUTEX_ROBUST
"./../../../libraries/liblmdb/mdb.c", line 10002: warning: implicit function declaration: pthread_mutex_consistent
cc: acomp failed for ./../../../libraries/liblmdb/mdb.c
Makefile:309: recipe for target 'mdb.lo' failed
gmake[3]: *** [mdb.lo] Error 1
gmake[3]: Leaving directory '/sites/openldap-2.4.44/servers/slapd/back-mdb'
Makefile:541: recipe for target '.backend' failed
gmake[2]: *** [.backend] Error 1
gmake[2]: Leaving directory '/sites/openldap-2.4.44/servers/slapd'
Makefile:291: recipe for target 'all-common' failed
gmake[1]: *** [all-common] Error 1
gmake[1]: Leaving directory '/sites/openldap-2.4.44/servers'
Makefile:312: recipe for target 'all-common' failed
gmake: *** [all-common] Error 1
[/sites/openldap-2.4.44]
I have configured bdb as below:
cd /sites/db-4.8.30/build_unix/
../dist/configure --prefix=/sites/bdb
make
make install
Installing openldap:
cd openldap-2.4.44/
./configure --prefix=/sites/openldap --enable-dynamic --enable-spasswd --enable-slapd --enable-mdb --enable-monitor
make depend
make all
I am getting above error at last step.
Below is the env
atg#lynntools01$ uname -a
SunOS lynntools01 5.10 Generic_150400-30 sun4v sparc sun4v

what is wrong with my makefile code?

I have a makefile that I needed to change around, and use it to install the program. I can;t figure out why I am getting this error:
v245-2% make install
install -m 555 audit /export/home/student/scort323/bin
sh: install: not found
*** Error code 1
make: Fatal error: Command failed for target `install'
Below is my code, can somebody please give me some advice. I am not good at makefiles so trying to find this error is hard for me until I get a better understanding:
# Make file for audit
# Location to install binary. Default is /usr/local/bin. You may
# prefer to install it in /usr/bin or /sbin
BINDIR = /export/home/student/scort323/bin
#BINDIR=/usr/bin
#BINDIR=/usr/sbin
# Location to install man page. Default is /usr/local/man. You may
# prefer to install it in /usr/man
MANDIR = /export/home/student/scort323/bin
#MANDIR = /usr/man
# Compiler to use
CC = gcc
# Linker to use
LD = gcc
# Preprocessor options
CPPFLAGS = -DGETOPTLONG
# Compile and link options
# On a.out systems you might want to add -N when linking
# RPM_OPT_FLAGS can be set by rpm tool
# ...For production code
CFLAGS = -Wall -O3 $(RPM_OPT_FLAGS)
LDFLAGS = -s
# ...For debug
#CFLAGS = -Wall -g
#LDFLAGS = -g
audit: audit.o
$(LD) $(LDFLAGS) -o audit audit.o
audit.o: audit.c
$(CC) $(CPPFLAGS) $(CFLAGS) -c audit.c
install: audit
install -m 555 audit $(BINDIR)
#/audit
install -m 444 audit.1 $(MANDIR)
#/man1/audit.1
clean:
$(RM) audit audit.o core *~ results
# check in
ci: clean
-ci -l *
dist: clean
cd .. ; tar --exclude RCS -czvf audit-0.2.tar.gz audit-0.2
There is no problem with the makefile. Check if you have install utility
$~ install --help
If you dont have then you can get it from GNU coreutils. If you have install somewhere then export its path in PATH variable
export PATH=$PATH:/path/to/install-utilit

Problem compiling nginx on Solaris 10

My setup as below
# export PATH=/usr/sbin:/usr/bin:/usr/local/bin:/usr/sfw/bin:/usr/ccs/bin
# ./configure --prefix=/usr/local/nginx --user=webservd --group=webservd --with-http_stub_status_module --with-openssl=/usr/local/ssl/bin/openssl --with-debug --with-pcre=/usr/local/bin
and i get error code as such when i execute make
# make
make -f objs/Makefile
make[1]: Entering directory `/export/home/myhome/nginx-0.7.63'
cd /usr/local/bin \
&& if [ -f Makefile ]; then make distclean; fi \
&& CC="gcc" CFLAGS="-O2 -fomit-frame-pointer -pipe " \
./configure --disable-shared
/bin/sh: ./configure: not found
make[1]: *** [/usr/local/bin/Makefile] Error 1
make[1]: Leaving directory `/export/home/myhome/nginx-0.7.63'
make: *** [build] Error 2
any idea how to fix it?
That initial cd to /usr/local/bin looks very strange; are you building it in the global /usr tree?
It looks as if it's cd:ing to the wrong directory, for some reason. Look in the referenced Makefile (objs/Makefile) and try to figure out why.
UPDATE: It seems the problem is that it's trying to build the PCRE library. If you have it pre-built, that seems like an odd decision. This blog post suggests using the --with-cc-opt="-I /usr/include/pcre" option to point out to the configure script where you have headers for PCRE, might be worth trying.

Resources