Hello! On Sun, Apr 07, 2019 at 10:41:22PM +0300, Igor Sysoev wrote:
> > On 7 Apr 2019, at 22:16, Anton Kiryushkin <sw...@fotofor.biz> wrote: > > > > Я взял код из лога и попробовал его собрать ровно так, как написано. > > Строка моего configure следующая: > > ./configure --prefix=/usr --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_realip_module > > --with-http_stub_status_module --with-http_ssl_module > > --with-http_sub_module --with-sha1=/usr/include/openssl > > --with-md5=/usr/include/openssl --add-module=/usr/src/naxsi/naxsi_src > > --with-debug --with-http_v2_module --with-cc-opt="-static -static-libgcc" > > --with-ld-opt="-static -lm" --with-cpu-opt=generic > > --with-openssl=./openssl-1.0.2r --with-stream --with-stream_ssl_module > > --user=www-data --with-http_image_filter_module > > > > Что-то тут уже устаревшее, но это не очень важно. > > Выпадает ошибка: > > checking for GD library ... not found > > checking for GD library in /usr/local/ ... not found > > checking for GD library in /usr/pkg/ ... not found > > checking for GD library in /opt/local/ ... not found > > > > Окей. Берем код автотеста: > > > > #include <sys/types.h> > > #include <unistd.h> > > #include <gd.h> > > > > int main(void) { > > gdImagePtr img = gdImageCreateFromGifPtr(1, NULL); > > (void) img; > > return 0; > > } > > > > Собираем: > > cc -static -static-libgcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -I > > /usr/pkg/include -o objs/autotest objs/autotest.c -static -lm > > -L/usr/pkg/lib -lgd (строчка из того же лога). > > Не собирается. > > Однако, если подвинуть -lm в конец: > > cc -static -static-libgcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -I > > /usr/pkg/include -o objs/autotest objs/autotest.c -static -L/usr/pkg/lib > > -lgd -lm > > > > Все соберется. > > > > Вопрос, как передвинуть на уровне сборки? > > Штатно не двигается. > Можно добавить в auto/lib/libgd/conf: > > - ngx_feature_libs="-L/usr/pkg/lib -lgd" > + ngx_feature_libs="-L/usr/pkg/lib -lgd -lm" > > В динамической libgd.so зависимость от libm.so записана, > а в статической такой возможности нет. Штатно аналогичный результат можно, если очень хочется, получить так: ./configure --with-http_image_filter_module \ --with-ld-opt="-L/usr/pkg/lib -static -lgd -lm" Хотя вот лично я бы - не рекомендовал, особенно под Linux'ом. Там warning'и при статической линковке - не просто так, и игнорирование их ведёт к вопросам "у меня всё сломалось, что вы поменяли в nginx'е" вполне очевидным образом. Тем более, что у современного GD зависимостей - устанешь перечислять, -lm - это только верхушка айсберга. Скажем, чтобы собраться статически со штатным пакетом GD на FreeBSD мне потребовалась какая-то такая простыня: ./auto/configure --with-http_image_filter_module \ --with-ld-opt="-L/usr/local/lib -static -lgd -lm \ -lpng -lm -lz -lfontconfig -lfreetype -ljpeg \ -ltiff -lwebp -lexpat -lbz2" -- Maxim Dounin http://mdounin.ru/ _______________________________________________ nginx-ru mailing list nginx-ru@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-ru