Opened 5 weeks ago

Closed 5 weeks ago

#1993 closed defect (invalid)

--with-ld-opt fails with multiple options

Reported by: asher.strong.ai@… Owned by:
Priority: blocker Milestone:
Component: documentation Version: 1.18.x
Keywords: Cc:
uname -a: Darwin Zero.local 19.4.0 Darwin Kernel Version 19.4.0: Wed Mar 4 22:28:40 PST 2020; root:xnu-6153.101.6~15/RELEASE_X86_64 x86_64
nginx -V: configure arguments: --with-ld-opt=-lc++ --add-module=/Users/asher/Projects/mho/nginx/pro_post_handler --add-module=/Users/asher/Projects/mho/nginx/pro_sms --with-debug --with-cc-opt='-O0' --prefix=/Users/asher/Projects/Deployment/nginx/server_root

Description

I have been compiling successfully with --with-ld-opt='-lc++', now I need to add -lcurl. I also need to add a path for lcurl.

  • If I use --with-ld-opt twice, only the last one survives.
  • If I use --with-ld-opt="-lc++ -lcurl" I get -lcurl invalid.
  • If I use --with-ld-opt="-lc++,-lcurl" then configure works but the link command fails.
  • If I use --with-ld-opt="-L/path/to/curl/lib -lc++ -curl" I get -lc++ invalid.
  • If I use --with-ld-opt="-L/path/to/curl/lib,-lc++,-curl" then configure works but the link command fails.

Has no one ever linked two libraries to nginx?

I tried with 1.19, but for some reason 1.19 is trying to compile my .cpp file with cc. Probably a separate bug.

It should be noted that I attempted to seek assistance in #nginx on this matter, but mtecknology apparently utilizes the channel for satisfying his ego, and the mere suggestion that this might be a bug led to him banning me. He is giving nginx a bad name.

Change History (2)

comment:1 by asher.strong.ai@…, 5 weeks ago

Well this shouldn't be under documentation, but once it's created apparently I can't change it.

comment:2 by Maxim Dounin, 5 weeks ago

Resolution: invalid
Status: newclosed

Has no one ever linked two libraries to nginx?

The --with-ld-opt configure option is not to link libraries to nginx, but rather to specify link options. Only one --with-ld-opt option is allowed, so you have to write all needed link options as a single string. It's up to you to write it correctly if you want to link libraries.

In this particular case you are probably looking for --with-ld-opt="-lc++ -L/path/to/curl/lib -lcurl" or --with-ld-opt="-L/path/to/c++/lib -lc++ -L/path/to/curl/lib -lcurl". Note though that it might need more efforts, especially on macOS, and especially if there is more than one version of the library installed (it is known for using strange system search paths, see #94). Looking into objs/autoconf.err might help to find some additional information if a particular option is rejected by configure.

If you have more questions, consider using support options available. Note though it might be a good idea to ask questions the smart way.

Note: See TracTickets for help on using tickets.