Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#94 closed defect (invalid)

1.1.14 compilation fails on Mac OS X 10.7.2

Reported by: Zygimantas Berziunas Owned by: somebody
Priority: blocker Milestone:
Component: nginx-core Version: 1.1.x
Keywords: Cc:
uname -a: Darwin core-nf01.lt.office.acme.eu 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug 9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64
nginx -V: not applicable

Description

objs/src/http/modules/ngx_http_upstream_keepalive_module.o \
objs/ngx_modules.o \
-lpcre -lssl -lcrypto -lz

Undefined symbols for architecture x86_64:

"_pcre_free_study", referenced from:

_ngx_pcre_free_studies in ngx_regex.o

ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[1]: * [objs/nginx] Error 1
make:
* [build] Error 2

1.1.13 compiles just fine.

Configuration:

./configure --conf-path=/etc/nginx/nginx.conf --prefix=/usr/local/nginx --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --sbin-path=sbin/nginx --without-http-cache --with-http_ssl_module --without-http_access_module --without-http_autoindex_module --without-http_empty_gif_module --without-http_ssi_module --without-http_auth_basic_module --without-http_browser_module --without-http_geo_module --without-http_referer_module --with-http_gzip_static_module --without-http_charset_module --without-http_fastcgi_module --without-http_geo_module --without-http_scgi_module --without-http_split_clients_module --without-http_userid_module --without-http_upstream_ip_hash_module --http-proxy-temp-path=/var/tmp/nginx/proxy_temp --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi_temp --http-client-body-temp-path=/var/tmp/nginx/client_body_temp --http-log-path=/var/log/nginx/access.log --without-http_proxy_module --with-debug

Change History (11)

comment:1 by Maxim Dounin, 12 years ago

Compiles here without any problems. Please show "./configure" output and please provide information about PCRE library you have: which version and how do you installed it. I suspect the problem is incorrectly installed PCRE library (headers disagree with library installed?).

comment:2 by Zygimantas Berziunas, 12 years ago

Configuration output:

checking for OS

+ Darwin 11.2.0 x86_64

checking for C compiler ... found

+ using GNU C compiler
+ gcc version: 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)

checking for gcc -pipe switch ... found
checking for gcc builtin atomic operations ... found
checking for C99 variadic macros ... found
checking for gcc variadic macros ... found
checking for unistd.h ... found
checking for inttypes.h ... found
checking for limits.h ... found
checking for sys/filio.h ... found
checking for sys/param.h ... found
checking for sys/mount.h ... found
checking for sys/statvfs.h ... found
checking for crypt.h ... not found
checking for Darwin specific features

+ kqueue found

checking for kqueue's EVFILT_TIMER ... found
checking for Darwin 64-bit kqueue millisecond timeout bug ... not found
checking for sendfile() ... found
checking for atomic(3) ... found
checking for nobody group ... found
checking for poll() ... found
checking for /dev/poll ... not found
checking for crypt() ... found
checking for F_READAHEAD ... not found
checking for posix_fadvise() ... not found
checking for O_DIRECT ... not found
checking for F_NOCACHE ... found
checking for directio() ... not found
checking for statfs() ... found
checking for statvfs() ... found
checking for dlopen() ... found
checking for sched_yield() ... found
checking for SO_SETFIB ... not found
checking for SO_ACCEPTFILTER ... not found
checking for TCP_DEFER_ACCEPT ... not found
checking for TCP_KEEPIDLE, TCP_KEEPINTVL, TCP_KEEPCNT ... not found
checking for accept4() ... not found
checking for int size ... 4 bytes
checking for long size ... 8 bytes
checking for long long size ... 8 bytes
checking for void * size ... 8 bytes
checking for uint64_t ... found
checking for sig_atomic_t ... found
checking for sig_atomic_t size ... 4 bytes
checking for socklen_t ... found
checking for in_addr_t ... found
checking for in_port_t ... found
checking for rlim_t ... found
checking for uintptr_t ... uintptr_t found
checking for system endianess ... little endianess
checking for size_t size ... 8 bytes
checking for off_t size ... 8 bytes
checking for time_t size ... 8 bytes
checking for setproctitle() ... not found
checking for pread() ... found
checking for pwrite() ... found
checking for sys_nerr ... found
checking for localtime_r() ... found
checking for posix_memalign() ... found
checking for memalign() ... not found
checking for mmap(MAP_ANON|MAP_SHARED) ... found
checking for mmap("/dev/zero", MAP_SHARED) ... found but is not working
checking for System V shared memory ... found
checking for POSIX semaphores ... found but is not working
checking for POSIX semaphores in libpthread ... found but is not working
checking for POSIX semaphores in librt ... not found
checking for struct msghdr.msg_control ... found
checking for ioctl(FIONBIO) ... found
checking for struct tm.tm_gmtoff ... found
checking for struct dirent.d_namlen ... found
checking for struct dirent.d_type ... found
checking for PCRE library ... found
checking for PCRE JIT support ... found
checking for OpenSSL library ... found
checking for zlib library ... found
creating objs/Makefile

Configuration summary

+ using system PCRE library
+ using system OpenSSL library
+ md5 library is not used
+ sha1 library is not used
+ using system zlib library

nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx configuration prefix: "/etc/nginx"
nginx configuration file: "/etc/nginx/nginx.conf"
nginx pid file: "/var/run/nginx.pid"
nginx error log file: "/var/log/nginx/error.log"
nginx http access log file: "/var/log/nginx/access.log"
nginx http client request body temporary files: "/var/tmp/nginx/client_body_temp"
nginx http uwsgi temporary files: "/var/tmp/nginx/uwsgi_temp"

comment:3 by Zygimantas Berziunas, 12 years ago

PCRE:

I have installed PCRE using Macports (sudo port install pcre).

Last edited 12 years ago by Zygimantas Berziunas (previous) (diff)

comment:4 by Maxim Dounin, 12 years ago

Macports currently include PCRE 8.12, which doesn't yet have JIT support. On the other hand, pcre.h header you have in system has PCRE_CONFIG_JIT defined (note "PCRE JIT support ... found" in ./configure output).

What does

port info pcre
port contents pcre | grep pcre.h
locate /pcre.h
locate /libpcre.0.dylib

show?

What does

port contents pcre | grep pcre.h | grep -A5 'version information'
port contents pcre | grep pcre.h | grep PCRE_CONFIG_JIT
locate /pcre.h | grep -A5 'version information'
locate /pcre.h | grep PCRE_CONFIG_JIT

show?

Please make sure to (re)build location database before running the above. Alternatively you may use "find / -name 'pcre.h'" instead of "location /pcre.h", though it will take much longer.

Configure output also suggests your PCRE library headers were found in system include directories. Do you have environment redefined to include macports' directories? If yes - how exactly?

comment:5 by Maxim Dounin, 12 years ago

Err, last block should be

port contents pcre | grep pcre.h | xargs grep -A5 'version information'
port contents pcre | grep pcre.h | xargs grep PCRE_CONFIG_JIT
locate /pcre.h | xargs grep -A5 'version information'
locate /pcre.h | xargs grep PCRE_CONFIG_JIT

The "xargs" command was forgotten.

comment:6 by Zygimantas Berziunas, 12 years ago

[OUTDATED]

Block 1

port info pcre
pcre @8.12, Revision 1 (devel)
Variants: doc, universal

Description: The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl

  1. PCRE has its own native API, as well as a set of wrapper functions that correspond to the POSIX regular expression API.

Homepage: http://www.pcre.org/

Library Dependencies: libedit, zlib, bzip2
Platforms: darwin, freebsd
License: BSD
Maintainers: nomaintainer@…

port contents pcre | grep pcre.h

/opt/local/include/pcre.h

locate /pcre.h

[placeholder until locate database is not ready]

locate /pcre.h | grep PCRE_CONFIG_JIT

[placeholder until locate database is not ready]

Block 2

port contents pcre | grep pcre.h | xargs grep -A5 'version information'

/* The current PCRE version information. */

#define PCRE_MAJOR 8
#define PCRE_MINOR 12
#define PCRE_PRERELEASE
#define PCRE_DATE 2011-01-15

port contents pcre | grep pcre.h | xargs grep PCRE_CONFIG_JIT

[Nothing]

locate /pcre.h | xargs grep -A5 'version information'

[placeholder until locate database is not ready]

locate /pcre.h | xargs grep PCRE_CONFIG_JIT

[placeholder until locate database is not ready]

Last edited 12 years ago by Zygimantas Berziunas (previous) (diff)

comment:7 by Zygimantas Berziunas, 12 years ago

[OUTDATED]

I have removed Macports PCRE package, installed PCRE from source with JIT support enabled, but still no luck.

locate /pcre.h

/Developer-3.2.4/SDKs/MacOSX10.5.sdk/usr/include/php/ext/pcre/pcrelib/pcre.h
/opt/local/include/pcre.h
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_erlang/work/erlang-R14B01/erts/emulator/pcre/pcre.h
/usr/local/include/pcre.h
/usr/local/share/doc/pcre/html/pcre.html

Last edited 12 years ago by Zygimantas Berziunas (previous) (diff)

comment:8 by Zygimantas Berziunas, 12 years ago

Details after system cleanup and installation of PCRE from sources with JIT support enabled:

Configuration output:

./configure --conf-path=/etc/nginx/nginx.conf --prefix=/usr/local/nginx --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --sbin-path=sbin/nginx --without-http-cache --with-http_ssl_module --without-http_access_module --without-http_autoindex_module --without-http_empty_gif_module --without-http_ssi_module --without-http_auth_basic_module --without-http_browser_module --without-http_geo_module --without-http_referer_module --with-http_gzip_static_module --without-http_charset_module --without-http_fastcgi_module --without-http_geo_module --without-http_scgi_module --without-http_split_clients_module --without-http_userid_module --without-http_upstream_ip_hash_module --http-proxy-temp-path=/var/tmp/nginx/proxy_temp --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi_temp --http-client-body-temp-path=/var/tmp/nginx/client_body_temp --http-log-path=/var/log/nginx/access.log --without-http_proxy_module --with-debug
checking for OS

+ Darwin 11.2.0 x86_64

checking for C compiler ... found

+ using GNU C compiler
+ gcc version: 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)

checking for gcc -pipe switch ... found
checking for gcc builtin atomic operations ... found
checking for C99 variadic macros ... found
checking for gcc variadic macros ... found
checking for unistd.h ... found
checking for inttypes.h ... found
checking for limits.h ... found
checking for sys/filio.h ... found
checking for sys/param.h ... found
checking for sys/mount.h ... found
checking for sys/statvfs.h ... found
checking for crypt.h ... not found
checking for Darwin specific features

+ kqueue found

checking for kqueue's EVFILT_TIMER ... found
checking for Darwin 64-bit kqueue millisecond timeout bug ... not found
checking for sendfile() ... found
checking for atomic(3) ... found
checking for nobody group ... found
checking for poll() ... found
checking for /dev/poll ... not found
checking for crypt() ... found
checking for F_READAHEAD ... not found
checking for posix_fadvise() ... not found
checking for O_DIRECT ... not found
checking for F_NOCACHE ... found
checking for directio() ... not found
checking for statfs() ... found
checking for statvfs() ... found
checking for dlopen() ... found
checking for sched_yield() ... found
checking for SO_SETFIB ... not found
checking for SO_ACCEPTFILTER ... not found
checking for TCP_DEFER_ACCEPT ... not found
checking for TCP_KEEPIDLE, TCP_KEEPINTVL, TCP_KEEPCNT ... not found
checking for accept4() ... not found
checking for int size ... 4 bytes
checking for long size ... 8 bytes
checking for long long size ... 8 bytes
checking for void * size ... 8 bytes
checking for uint64_t ... found
checking for sig_atomic_t ... found
checking for sig_atomic_t size ... 4 bytes
checking for socklen_t ... found
checking for in_addr_t ... found
checking for in_port_t ... found
checking for rlim_t ... found
checking for uintptr_t ... uintptr_t found
checking for system endianess ... little endianess
checking for size_t size ... 8 bytes
checking for off_t size ... 8 bytes
checking for time_t size ... 8 bytes
checking for setproctitle() ... not found
checking for pread() ... found
checking for pwrite() ... found
checking for sys_nerr ... found
checking for localtime_r() ... found
checking for posix_memalign() ... found
checking for memalign() ... not found
checking for mmap(MAP_ANON|MAP_SHARED) ... found
checking for mmap("/dev/zero", MAP_SHARED) ... found but is not working
checking for System V shared memory ... found
checking for POSIX semaphores ... found but is not working
checking for POSIX semaphores in libpthread ... found but is not working
checking for POSIX semaphores in librt ... not found
checking for struct msghdr.msg_control ... found
checking for ioctl(FIONBIO) ... found
checking for struct tm.tm_gmtoff ... found
checking for struct dirent.d_namlen ... found
checking for struct dirent.d_type ... found
checking for PCRE library ... found
checking for PCRE JIT support ... found
checking for OpenSSL library ... found
checking for zlib library ... found
creating objs/Makefile

Configuration summary

+ using system PCRE library
+ using system OpenSSL library
+ md5 library is not used
+ sha1 library is not used
+ using system zlib library

nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx configuration prefix: "/etc/nginx"
nginx configuration file: "/etc/nginx/nginx.conf"
nginx pid file: "/var/run/nginx.pid"
nginx error log file: "/var/log/nginx/error.log"
nginx http access log file: "/var/log/nginx/access.log"
nginx http client request body temporary files: "/var/tmp/nginx/client_body_temp"
nginx http uwsgi temporary files: "/var/tmp/nginx/uwsgi_temp"

Make output:

[...]

objs/src/http/modules/ngx_http_upstream_keepalive_module.o \
objs/ngx_modules.o \
-lpcre -lssl -lcrypto -lz

Undefined symbols for architecture x86_64:

"_pcre_free_study", referenced from:

_ngx_pcre_free_studies in ngx_regex.o

ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[1]: * [objs/nginx] Error 1
make:
* [build] Error 2

locate /pcre.h

/usr/local/include/pcre.h
/usr/local/share/doc/pcre/html/pcre.html

locate /pcre.h | grep PCRE_CONFIG_JIT

[Nothing].

locate /pcre.h | xargs grep PCRE_CONFIG_JIT

/usr/local/include/pcre.h:#define PCRE_CONFIG_JIT 9

locate /pcre.h | xargs grep -A5 'version information'

/usr/local/include/pcre.h:/* The current PCRE version information. */
/usr/local/include/pcre.h-
/usr/local/include/pcre.h-#define PCRE_MAJOR 8
/usr/local/include/pcre.h-#define PCRE_MINOR 21
/usr/local/include/pcre.h-#define PCRE_PRERELEASE
/usr/local/include/pcre.h-#define PCRE_DATE 2011-12-12

Last edited 12 years ago by Zygimantas Berziunas (previous) (diff)

comment:9 by Maxim Dounin, 12 years ago

Resolution: invalid
Status: newclosed

The Mac OS X have /usr/lib/libpcre.0.dylib in base system and strange system search paths, so installing PCRE into /usr/local/ won't work - the pcre.h will be used from /usr/local/include, but libpcre.0.dylib will be used from /usr/lib (not /usr/local/lib).

Possible solutions are:

  1. Remove the PCRE version installed into /usr/local and reinstall one from macports. This is recommended solution.
  2. Force /usr/local/lib to be before /usr/lib in library search path with ./configure --with-ld-opt="-I /usr/local/lib". This may work, but likely you'll be facing the same problem in other places as well.
Version 0, edited 12 years ago by Maxim Dounin (next)

comment:10 by Zygimantas Berziunas, 12 years ago

Solution 1 is working. Thanks.

comment:11 by Matthew Ratzloff, 11 years ago

I encountered this problem with 1.4.0. Solution 2 works as well.

Note: See TracTickets for help on using tickets.