51Degrees / Device-Detection

THE Fastest and most Accurate device detection for C / PHP / Perl / Python and Node.js - professionally maintained device data
https://51degrees.com/device-detection
Other
112 stars 46 forks source link

dynamic module for nginx 1.10.3 #31

Closed HappyStoic closed 5 years ago

HappyStoic commented 5 years ago

Good afternoon, I'm dealing with problems while making dynamic module for Nginx [version 1.10.3]. Your readme says

51Degrees dynamic module can be used in Nginx version 1.9.11 or later. It is important to check you have '--with-compat' available within your configure arguments.

Dynamic modules were indeed introduced in nginx 1.9.11 but --with-compat option is available from version 1.11.5. Using make module trie VERSION=1.10.3 or make install trie VERSION=1.10.3 I get

if [ -d "51Degrees_module/src" ]; then \ rm -rf 51Degrees_module/src; \ fi if [ -d "build" ]; then \ rm -rf build; \ fi if [ -f "nginx" ]; then \ rm -f nginx; \ fi if [ -f "vendor/nginx-1.10.3/Makefile" ]; then \ cd /home/martinrepa/Stažené/Device-Detection-3.2.18.5/nginx/vendor/nginx-1.10.3 && make clean; \ fi if [ -d "tests/nginx-tests" ]; then \ rm -r tests/nginx-tests; \ fi; mkdir -p 51Degrees_module/src/trie if [ -d "51Degrees_module/src/pattern" ]; then \ mkdir -p 51Degrees_module/src/cityhash && \ cp ../src/cityhash/* 51Degrees_module/src/cityhash/ ; \ fi exit cp module_conf/trie_config 51Degrees_module/config cp ../src/trie/51Degrees.c 51Degrees_module/src/trie/ cp ../src/trie/51Degrees.h 51Degrees_module/src/trie/ if [ ! -d "vendor/nginx-1.10.3" ]; then make get-source; fi cd /home/martinrepa/Stažené/Device-Detection-3.2.18.5/nginx/vendor/nginx-1.10.3 && \ ./configure \ --prefix=/home/martinrepa/Stažené/Device-Detection-3.2.18.5/nginx/build \ --with-ld-opt="-lm" \ --add-dynamic-module=/home/martinrepa/Stažené/Device-Detection-3.2.18.5/nginx/51Degrees_module \ --with-compat \ --with-cc-opt="-DFIFTYONEDEGREES_TRIE -DFIFTYONEDEGREES_NO_THREADING" \ --with-debug \ --sbin-path=/home/martinrepa/Stažené/Device-Detection-3.2.18.5/nginx \ --conf-path="nginx.conf" ./configure: error: invalid option "--with-compat"

Am I missing something or shall I get the dynamic module for my nginx in a different way (I cannot use different nginx version)? Thanks for your response.

JoshGrew51D commented 5 years ago

Afternoon,

In order to build this as a dynamic module for that version you would need to ensure the configure arguments in your current Nginx are identical to the ones we use in the Makefile when compiling the module. This mismatch would normally be covered by using --with-compat but as you mentioned, it isn't available.

If you edit the Makefile you will see them under the configure section.

An alternative method would be to compile it as a static module using...

make install pattern STATIC_BUILD=1

This would provide you with a build of Nginx with 51Degrees available to use. I understand this may not be a feasible option for you but it's worth mentioning.

Let me know how you get on and we will definitely look at making the documentation a bit clearer around those older versions.

HappyStoic commented 5 years ago

Yea, that was the problem, thanks for your quick answer. I was a little bit confused about this --with-compat option. Closing the issue and have a nice day