Skip to content

Cannot build with nginx-1.11.2 #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cbj4074 opened this issue Jul 9, 2016 · 16 comments
Closed

Cannot build with nginx-1.11.2 #79

cbj4074 opened this issue Jul 9, 2016 · 16 comments

Comments

@cbj4074
Copy link

cbj4074 commented Jul 9, 2016

This error is back again as of nginx-1.11.2:

../nginx-upload-module-2.2/ngx_http_upload_module.c:14:17: fatal error: md5.h: No such file or directory
compilation terminated.
objs/Makefile:1196: recipe for target 'objs/addon/nginx-upload-module-2.2/ngx_http_upload_module.o' failed
make[1]: *** [objs/addon/nginx-upload-module-2.2/ngx_http_upload_module.o] Error 1
make[1]: Leaving directory '/root/nginx-build/nginx-1.11.2'
Makefile:8: recipe for target 'build' failed
make: *** [build] Error 2

Curiously, the exact same configure options that fail with nginx-1.11.2 "work fine" with nginx-1.10.1, in the sense that the build process seems to succeed, but then I get "unknown directive upload_progress".

I've gone back through some of the stable builds that I've used in the past, and this plugin still compiles and works with nginx-1.8.1. So, it seems something in nginx has changed and needs to be updated in the plugin.

Thanks!

@igreenfield
Copy link

@cbj4074 Did you find solution?

@cbj4074
Copy link
Author

cbj4074 commented Jul 11, 2016

@igreenfield No :( Not yet.

@dup2
Copy link

dup2 commented Jul 11, 2016

A wild guess (from the nginx changelog) and not tested

 Change: now nginx always uses internal MD5 and SHA1 implementations

Maybe you could change the include to

 include "ngx_md5.h"

and the same for sha1.

@ktonini
Copy link

ktonini commented Jul 14, 2016

That got it past the initial error, but it appears that ngx_md5.h and md5.h still differ to much-

error: unknown type name ‘MD5_CTX’ MD5_CTX md5;
error: ‘MD5_DIGEST_LENGTH’ undeclared here (not in a function) u_char md5_digest[MD5_DIGEST_LENGTH * 2];

etc.

@deweydb
Copy link

deweydb commented Jul 16, 2016

Is there an alternative to this module? it seems like development is pretty much dead.

@ktonini
Copy link

ktonini commented Jul 16, 2016

Not that in the form of an nginx module, at least that I could find. But there's other solutions like this and there's another jQuery one floating around.

@Austinb
Copy link

Austinb commented Jul 18, 2016

After looking at the changeset for 1.11.2 here: https://trac.nginx.org/nginx/changeset/6603/nginx (or nginx/nginx@c60b61a) and scroll down to src/core/ngx_md5.h you can see that the definition for MD5_CTX was removed. So it is trying to find something that does not exist anymore which is why the make errors out. Also the SHA_CTX typedef was removed in the sha1.h file in the same commit.

After messing around (I have little experience in C) I deduced that the openssl libs that this module is relying on are missing because of the changes to the core of nginx removing these references (maybe a bug on nginx's part?). There are also definitions for sha265 and other higher encryption functions that nginx does not support in its core such as 'SHA256_CTX'. So changing the top section of the file and removing all of the if/then statements and including everything I got the module to compile without error. You also need to change the old references to the local files as per @dup2. Does it work the same? I have no idea. I have not had a chance to test it yet. Please test and let me know. Also I am sure the changes can be optimized so please do so.

Will put up a pull request momentarily.

For reference the top of my ngx_http_upload_module.c is now

#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>
#include <nginx.h>

#include <openssl/md5.h>
#include <ngx_md5.h>

#define  MD5Init    MD5_Init
#define  MD5Update  MD5_Update
#define  MD5Final   MD5_Final

#include <openssl/sha.h>
#include <ngx_sha1.h>

#define MULTIPART_FORM_DATA_STRING              "multipart/form-data"

To get to compile you still need to apply this patch - https://github.com/vkholodkov/nginx-upload-module/pull/77

Austinb pushed a commit to Austinb/nginx-upload-module that referenced this issue Jul 18, 2016
@cbj4074
Copy link
Author

cbj4074 commented Jul 20, 2016

@Austinb Nice! I will give this a try in the next day or two and report back. Thank you!

@tkoenig
Copy link

tkoenig commented Jul 20, 2016

@Austinb @cbj4074 you do not need to include both the openssl and ngx implementations afaik.

I tested the md5 and sha1 generation with the following adaptation:

#include <openssl/md5.h>

#define  MD5Init    MD5_Init
#define  MD5Update  MD5_Update
#define  MD5Final   MD5_Final

#include <openssl/sha.h>

I'm not sure if you need to explicitly specify an openssl library but I compiled with the --with-openssl=../openssl-1.0.2h configuration.

@Austinb
Copy link

Austinb commented Jul 21, 2016

@tkoenig Thanks for the info. I just ran a quick one without the ngx_* header files and it compiled fine. You shouldn't need to use --with-openssl unless you need to specify the location of the libraries. My configure does not include that switch.

I ran some quick upload tests a few days ago and it appears to work the same. Has anyone else tested the actual upload side in 1.11.2?

@tkoenig
Copy link

tkoenig commented Jul 21, 2016

@Austinb Thanks for the info. Uploads work fine for me with 1.11.2 and the upload module (partial & non-partial uploads).

@Austinb
Copy link

Austinb commented Jul 21, 2016

Updated pull request #80 not that it will make much difference since there a long standing patches yet to be merged in.

@WeOggy
Copy link

WeOggy commented Nov 9, 2016

no solution yet? :(

@Austinb
Copy link

Austinb commented Nov 15, 2016

@WeOggy I have a branch that has both the #77 and #80 patches in it. Not sure #77 is needed anymore as of 1.11.5.

You can pull https://github.com/Austinb/nginx-upload-module in place of the existing path but make sure you change to branch 2.2. I kept the layout the same.

As far as this repo I am not sure the author is even checking up on it anymore. Last merge was 2014 so sadly we maybe out of luck keeping this repo up to date.

cunnie referenced this issue in cloudfoundry-community/nginx-release Dec 20, 2016
- release version number tracks nginx's version
- caveat: downgrade in version number from 4 to 1.11.7 may cause
  problems
- upgrade nginx from 1.11.1 to 1.11.7
- add IPv6/gunzip/http_v2 module support
- removed nginx-upload-module-2.2
  - hasn't been updated since
    ['08](https://github.com/vkholodkov/nginx-upload-module)
  - won't [compile easily for nginx
    1.11.2+](https://github.com/vkholodkov/nginx-upload-module/issues/79)
  - was included for GoCD front-end, which has long since been
    abandoned.

fixes:
```
../nginx-upload-module-2.2/ngx_http_upload_module.c:14:17: fatal error:
md5.h: No such file or directory
 #include <md5.h>
                  ^
compilation terminated.
make[1]: ***
[objs/addon/nginx-upload-module-2.2/ngx_http_upload_module.o]
Error 1
```
@duanyong
Copy link

duanyong commented Jun 22, 2017

I have the same problem,used this https://github.com/Austinb/nginx-upload-module fixed it.

my nginx version is nginx-1.13.1.

under the configuration info:
Configuration summary

  • using threads
  • using system PCRE library
  • using system OpenSSL library
  • using system zlib library

make info:
make[1]: Leaving directory '/tmp/nginx-1.13.1'

@cbj4074
Copy link
Author

cbj4074 commented Jul 14, 2017

This appears to be fixed via https://github.com/vkholodkov/nginx-upload-module/pull/88

For the sake of thoroughness, it's necessary to build using the 2.255 tag from https://github.com/vkholodkov/nginx-upload-module/tree/2.255 . I don't believe this fix to have been merged into the 2.2 branch as yet.

THANK YOU to all involved!

@cbj4074 cbj4074 closed this as completed Jul 14, 2017
matthew-l-weber referenced this issue in matthew-l-weber/nginx-upload-module Jul 23, 2017
When building against 1.11.2+, requires additional
-lcrypto dependency. (Nginx changed crypto approach
and dependencies for openssl are no longer default)

More details found here:
https://github.com/vkholodkov/nginx-upload-module/issues/79

Resolves:
objs/addon/nginx-upload-70bee48f1811eecd255ed094ce9f0fb560c390c3/ngx_http_upload_module.o \
objs/ngx_modules.o \
-ldl -lpthread -lpthread -lpcre -lz -latomic_ops \
-Wl,-E
ngx_http_upload_module.o: In function `ngx_http_upload_flush_output_buffer':
ngx_http_upload_module.c:1625: undefined reference to `MD5_Update'
ngx_http_upload_module.c:1628: undefined reference to `SHA1_Update'
ngx_http_upload_module.c:1631: undefined reference to `SHA256_Update'
ngx_http_upload_module.c:1634: undefined reference to `SHA512_Update'

Signed-off-by: Matthew Weber <matthew.l.weber@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants