Задать вопрос

Проблема при компиляции Nginx модуль?

Привет всем, ошибка при добавления модуля nginx vod module
Результат ./configure
./configure --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-debug --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl --with-mail --with-mail_ssl_module --add-module=/tmp/nginx-1.1.19/debian/modules/nginx-auth-pam --add-module=/tmp/nginx-1.1.19/debian/modules/nginx-echo --add-module=/tmp/nginx-1.1.19/debian/modules/nginx-upstream-fair --add-module=/tmp/nginx-1.1.19/debian/modules/nginx-dav-ext-module --add-module=/tmp/nginx-rtmp-module-master --add-module=/tmp/nginx-vod-module-master
checking for OS
 + Linux 3.13.0-32-generic x86_64
checking for C compiler ... 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 ... not found
checking for sys/param.h ... found
checking for sys/mount.h ... found
checking for sys/statvfs.h ... found
checking for crypt.h ... found
checking for Linux specific features
checking for epoll ... found
checking for sendfile() ... found
checking for sendfile64() ... found
checking for sys/prctl.h ... found
checking for prctl(PR_SET_DUMPABLE) ... found
checking for sched_setaffinity() ... found
checking for crypt_r() ... found
checking for sys/vfs.h ... found
checking for nobody group ... not found
checking for nogroup group ... found
checking for poll() ... found
checking for /dev/poll ... not found
checking for kqueue ... not found
checking for crypt() ... not found
checking for crypt() in libcrypt ... found
checking for F_READAHEAD ... not found
checking for posix_fadvise() ... found
checking for O_DIRECT ... found
checking for F_NOCACHE ... not found
checking for directio() ... not found
checking for statfs() ... found
checking for statvfs() ... found
checking for dlopen() ... not found
checking for dlopen() in libdl ... found
checking for sched_yield() ... found
checking for SO_SETFIB ... not found
checking for SO_ACCEPTFILTER ... not found
checking for TCP_DEFER_ACCEPT ... found
checking for TCP_KEEPIDLE, TCP_KEEPINTVL, TCP_KEEPCNT ... found
checking for TCP_INFO ... found
checking for accept4() ... 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 AF_INET6 ... found
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() ... found
checking for mmap(MAP_ANON|MAP_SHARED) ... found
checking for mmap("/dev/zero", MAP_SHARED) ... found
checking for System V shared memory ... found
checking for POSIX semaphores ... not found
checking for POSIX semaphores in libpthread ... 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 ... not found
checking for struct dirent.d_type ... found
checking for sysconf(_SC_NPROCESSORS_ONLN) ... found
checking for openat(), fstatat() ... found
configuring additional modules
adding module in /tmp/nginx-1.1.19/debian/modules/nginx-auth-pam
 + ngx_http_auth_pam_module was configured
adding module in /tmp/nginx-1.1.19/debian/modules/nginx-echo
 + ngx_http_echo_module was configured
adding module in /tmp/nginx-1.1.19/debian/modules/nginx-upstream-fair
 + ngx_http_upstream_fair_module was configured
adding module in /tmp/nginx-1.1.19/debian/modules/nginx-dav-ext-module
 + ngx_http_dav_ext_module was configured
adding module in /tmp/nginx-rtmp-module-master
 + ngx_rtmp_module was configured
adding module in /tmp/nginx-vod-module-master
checking for OpenSSL EVP library ... found
checking for clock_gettime() ... not found
checking for clock_gettime() in librt ... found
checking for libavcodec ... found
checking for libavfilter ... found
 + ngx_http_vod_module was configured
checking for PCRE library ... found
checking for PCRE JIT support ... not found
checking for OpenSSL library ... found
checking for zlib library ... found
checking for libxslt ... found
checking for libexslt ... found
checking for GD library ... found
checking for GeoIP library ... found
creating objs/Makefile

Configuration summary
  + using system PCRE library
  + using system OpenSSL library
  + md5: using OpenSSL library
  + sha1: using OpenSSL library
  + using system zlib library

  nginx path prefix: "/etc/nginx"
  nginx binary file: "/etc/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/lib/nginx/body"
  nginx http proxy temporary files: "/var/lib/nginx/proxy"
  nginx http fastcgi temporary files: "/var/lib/nginx/fastcgi"
  nginx http uwsgi temporary files: "/var/lib/nginx/uwsgi"
  nginx http scgi temporary files: "/var/lib/nginx/scgi"


Ошибка make :
objs/addon/vod/write_buffer_queue.o \
        objs/ngx_modules.o \
        -lpthread -lcrypt -lpam -lexpat -lcrypto -lrt -lavcodec -lavutil -lavfilter -lavutil -lpcre -lssl -lcrypto -ldl -lz -lxml2 -lxslt -lexslt -lgd -lGeoIP
objs/addon/nginx-vod-module-master/ngx_http_vod_module.o: In function `ngx_http_vod_send_header':
ngx_http_vod_module.c:(.text+0x1392): undefined reference to `ngx_http_set_etag'
objs/addon/nginx-vod-module-master/ngx_http_vod_utils.o: In function `ngx_http_vod_send_response':
ngx_http_vod_utils.c:(.text+0x110): undefined reference to `ngx_http_set_etag'
objs/addon/filters/audio_filter.o: In function `audio_filter_init_source':
audio_filter.c:(.text+0x670): undefined reference to `avfilter_inout_alloc'
objs/addon/filters/audio_filter.o: In function `audio_filter_init_sink':
audio_filter.c:(.text+0x890): undefined reference to `av_int_list_length_for_size'
audio_filter.c:(.text+0x8af): undefined reference to `av_int_list_length_for_size'
audio_filter.c:(.text+0x8d2): undefined reference to `av_opt_set_bin'
audio_filter.c:(.text+0x951): undefined reference to `av_int_list_length_for_size'
audio_filter.c:(.text+0x970): undefined reference to `av_int_list_length_for_size'
audio_filter.c:(.text+0x993): undefined reference to `av_opt_set_bin'
audio_filter.c:(.text+0xa13): undefined reference to `av_int_list_length_for_size'
audio_filter.c:(.text+0xa32): undefined reference to `av_int_list_length_for_size'
audio_filter.c:(.text+0xa55): undefined reference to `av_opt_set_bin'
audio_filter.c:(.text+0xbef): undefined reference to `avfilter_inout_alloc'
objs/addon/filters/audio_filter.o: In function `audio_filter_alloc_state':
audio_filter.c:(.text+0x17c6): undefined reference to `avfilter_graph_parse_ptr'
audio_filter.c:(.text+0x18c3): undefined reference to `av_buffersink_set_frame_size'
audio_filter.c:(.text+0x18c8): undefined reference to `av_frame_alloc'
audio_filter.c:(.text+0x1929): undefined reference to `av_frame_alloc'
audio_filter.c:(.text+0x1b0c): undefined reference to `avfilter_inout_free'
audio_filter.c:(.text+0x1b18): undefined reference to `avfilter_inout_free'
objs/addon/filters/audio_filter.o: In function `audio_filter_free_state':
audio_filter.c:(.text+0x1bc7): undefined reference to `av_frame_free'
audio_filter.c:(.text+0x1bd7): undefined reference to `av_frame_free'
objs/addon/filters/audio_filter.o: In function `audio_filter_read_filter_sink':
audio_filter.c:(.text+0x2443): undefined reference to `av_buffersink_get_frame_flags'
audio_filter.c:(.text+0x2505): undefined reference to `av_frame_unref'
objs/addon/filters/audio_filter.o: In function `audio_filter_process_frame':
audio_filter.c:(.text+0x2656): undefined reference to `av_frame_unref'
audio_filter.c:(.text+0x2701): undefined reference to `av_buffersrc_add_frame_flags'
objs/addon/filters/audio_filter.o: In function `audio_filter_choose_source':
audio_filter.c:(.text+0x2785): undefined reference to `avfilter_graph_request_oldest'
audio_filter.c:(.text+0x2895): undefined reference to `av_buffersrc_get_nb_failed_requests'
collect2: выполнение ld завершилось с кодом возврата 1
make[1]: *** [objs/nginx] Ошибка 1
make[1]: Выход из каталога `/tmp/nginx-1.1.19'
make: *** [build] Ошибка 2


Все кодеки установлены, так как конфигурация успешно завершилось.
ОС : Linux ubuntu server 12.04
Nginx version: nginx/1.1.19

Может я где то допускаю ошибку? или это несовместимости версий? заранее спасибо!
  • Вопрос задан
  • 3036 просмотров
Подписаться 3 Сложный 2 комментария
Решения вопроса 1
sim3x
@sim3x
Перед установкой читаем

https://www.digitalocean.com/community/tutorials/h...
https://www.debian-administration.org/article/666/...

What is the difference between the core, full, extras and light packages for nginx?
askubuntu.com/questions/553937/what-is-the-differe...

Обновим систему
sudo apt-get update && sudo apt-get -y upgrade

Директории для пакета
rm -rf /tmp/ngx
mkdir /tmp/ngx
cd /tmp/ngx


Для создания пакета нужно установить
sudo apt-get install -y build-essential dpkg-dev

Поставим все что нужно для самого пакета
sudo apt-get build-dep -y nginx

Заберем исходники актуальной версии софта из основного репозитория
apt-get source -y nginx

Изменяем ченджлог

vim nginx-1.4.6/debian/changelog

Что-то наподобии

nginx (1.4.6.1-1ubuntu3.4) trusty; urgency=medium

* Foo: buz
- bar

-- foo \ Wed, 03 Feb 2016 09:12:00 -0500


Главное тут увеличить версию с 1.4.6 до 1.4.6.1
Хотя я не уверен, что ето на что-то влияет
Пакет собирается и без етого

Тут хранятся модули nginx
cd nginx-1.4.6/debian/modules
меинтейнер пакета добавил пак еще каких-то модулей
не знаю зачем

Берем код из мастера nginx-rtmp-module-master
curl -skL https://github.com/arut/nginx-rtmp-module/tarball/master | tar zx


для удобства переименуем
mv arut-nginx-rtmp-module-* nginx-rtmp-module

nginx-vod-module-master
скорее всего нужно будет поставить
sudo apt-get install libav-tools

curl -skL https://github.com/kaltura/nginx-vod-module/tarball/master | tar zx
mv kaltura-nginx-vod-module-* nginx-vod-module


cd /tmp/ngx/nginx-1.4.6

Редактируем конфигурацию для ./configure + make nginx

vim debian/rules

тут все просто, если прочитан линк про версии nginx для убунту

Можно добавить

--add-module=$(MODULESDIR)/nginx-vod-module \
--add-module=$(MODULESDIR)/nginx-rtmp-module \


в common_configure_flags

после

--with-http_realip_module \

или в config.status.full: config.env.full после

--add-module=$(MODULESDIR)/ngx_http_substitutions_filter_module \


перед >$@

И вообще стоит подумать, какой набор модулей нужен тебе

Теперь все готово к конфигурированию, компилированию и созданию деб-пакета

dpkg-buildpackage -us -uc -b

Пояснение
-us Do not sign the source package.
-uc Do not sign the .changes file.
-b Specifies a binary-only build, no source files are to be built and/or distributed.
Passed to dpkg-genchanges.


Устанавливаемся в той же системе, где и собирали пакет
sudo dpkg -i ../nginx-common_*
sudo dpkg -i ../nginx-full_*


если в другой (желательно в другой), то при установке будет ругань
Решается так

sudo apt-get -f install

Проверяем версии

nginx -V
nginx version: nginx/1.4.6 (Ubuntu)
built by gcc 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.1) 
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_spdy_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module --add-module=/tmp/ngx/nginx-1.4.6/debian/modules/nginx-auth-pam --add-module=/tmp/ngx/nginx-1.4.6/debian/modules/nginx-dav-ext-module --add-module=/tmp/ngx/nginx-1.4.6/debian/modules/nginx-echo --add-module=/tmp/ngx/nginx-1.4.6/debian/modules/nginx-upstream-fair --add-module=/tmp/ngx/nginx-1.4.6/debian/modules/ngx_http_substitutions_filter_module --add-module=/tmp/ngx/nginx-1.4.6/debian/modules/nginx-vod-module --add-module=/tmp/ngx/nginx-1.4.6/debian/modules/nginx-rtmp-module


Проблема с конфигом

sudo service nginx start
sudo service nginx status
* nginx is not running


cat /var/log/nginx/error.log
[emerg] 18447#0: could not build the variables_hash, you should increase either variables_hash_max_size: 512 or variables_hash_bucket_size: 64


Какой-то умник поставил туда переменную types_hash_max_size 2048; с большим значением
Решение или закоментить или добавить
variables_hash_max_size 1024;
  variables_hash_bucket_size 128;


sudo vim /etc/nginx/nginx.conf

# types_hash_max_size 2048;
# variables_hash_max_size 1024;
# variables_hash_bucket_size 128;

Проблема с обновлениями
Тк теперь в системе имеется пакет уже существующий в базовом репозитории при очередном ap-get update + upgrade он будет заменен на пакет с большим номером версии

Решение

sudo apt-mark hold nginx-full

чтоб обновить пакет повторям все с начала
sudo apt-mark unhold
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы