Skip to content
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

nginx: fixed building as a dynamic module #1764

Conversation

defanator
Copy link
Contributor

Building passenger using the "--add-dynamic-module" configure option in nginx >= 1.9.11 leads to linking errors like the following one:

/usr/bin/ld: /home/defan/src/nginx-1.9.12/passenger-5.0.26/buildout/common/libpassenger_common/Logging.o: relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC
/home/defan/src/nginx-1.9.12/passenger-5.0.26/buildout/common/libpassenger_common/Logging.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[1]: *** [objs/ngx_http_passenger_module.so] Error 1
make[1]: Leaving directory `/home/defan/src/nginx-1.9.12'
make: *** [build] Error 2

The proposed patch adds "-fPIC" as a global EXTRA_CXXFLAGS variable that is being used later by rake.

Tested with nginx/1.9.12 + Passenger 5.0.26 on CentOS 6.7.

@FooBarWidget
Copy link
Member

Whoops, I only tested on OS X and missed that.

uqs pushed a commit to freebsd/freebsd-ports that referenced this pull request Mar 4, 2016
Patch obtained from:	phusion/passenger#1764


git-svn-id: svn+ssh://svn.freebsd.org/ports/head@410152 35697150-7ecd-e111-bb59-0022644237b5
uqs pushed a commit to freebsd/freebsd-ports that referenced this pull request Mar 4, 2016
@OnixGH
Copy link
Contributor

OnixGH commented Mar 8, 2016

There are some issues with this patch:

  • EXTRA_CXXFLAGS makes the agent itself get compiled with -fPIC, which it shouldn't be
  • If objects were already compiled (with some other flags) this will not recompile them

Suggested improvements:

  • Add rake nginx:dynamic_module_dependencies task that compiles just the .o dependencies of the nginx module with -fPIC (to another build output dir)
  • Nginx config script executes rake nginx as well as rake nginx:dynamic_module_dependencies when passenger is configured as a dynamic module
  • Nginx config script that normally links to the static .o files should link to the dynamic .o files when passenger is configured as dynamic module (generated by rake nginx:dynamic_module_dependencies)

@OnixGH
Copy link
Contributor

OnixGH commented Apr 19, 2016

@OnixGH OnixGH closed this Apr 19, 2016
svmhdvn pushed a commit to svmhdvn/freebsd-ports that referenced this pull request Jan 10, 2024
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

Successfully merging this pull request may close these issues.

None yet

3 participants