Bug 263104 - www/nginx: nginx-full fails to link: ld: error: undefined symbol: main (HTTP_AUTH_KRB5 is ON but no GSS_API_* options is set)
Summary: www/nginx: nginx-full fails to link: ld: error: undefined symbol: main (HTTP_...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Jochen Neumeister
URL:
Keywords: needs-patch, needs-qa
Depends on:
Blocks:
 
Reported: 2022-04-06 23:05 UTC by pete
Modified: 2022-06-01 17:43 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (joneum)
koobs: merge-quarterly?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pete 2022-04-06 23:05:20 UTC
hello, i've noticed the nginx-full pkgs are not being built for a majority of platforms.  you can see the status on the freshports.org page here:
https://www.freshports.org/www/nginx-full/

is there a reason we are not building these, or is there a bug that i can help track down and fix?
Comment 1 Christian Sturm 2022-04-19 11:23:25 UTC
It appears that there are problems building the port, specifically compiling one of the modules. So it either has to be fixed or disabled.

https://lists.freebsd.org/archives/freebsd-pkg-fallout/2022-April/227683.html
Comment 2 pete 2022-05-08 14:24:31 UTC
I think I've figured out why it is failing to build, one of the modules requires HTTP_AUTH_KRB5 to be set.  I figured this out by noticing this error when building:

cc -o objs/ngx_http_auth_spnego_module.so  objs/addon/spnego-http-auth-nginx-module-c626163/ngx_http_auth_spnego_module.o  objs/ngx_http_auth_spnego_module_modules.o  -L/usr/local/lib -L /usr/
local/lib -L  -shared
ld: error: undefined symbol: main
>>> referenced by crt1_c.c:73 (/usr/src/lib/csu/amd64/crt1_c.c:73)
>>>               /usr/lib/crt1.o:(_start)

This made me realize that www/nginx/files/extra-patch-spnego-http-auth-nginx-module-config was not being applied when the port was being built causing the ld error.  but after enabling HTTP_AUTH_KRB5 and rebuilding I am able to build a package, and the spnego module is able to link:

cc -o objs/ngx_http_auth_spnego_module.so  objs/addon/spnego-http-auth-nginx-module-c626163/ngx_http_auth_spnego_module.o  objs/ngx_http_auth_spnego_module_modules.o  -L/usr/local/lib -L /usr/
local/lib -L/usr/local/lib -lkrb5 -lgssapi_krb5  -shared

I am not %100 sure how to fix this for the www/nginx-full port though, my reading of the Makefile makes it seem like it is enabled by default because it is listed in OPTIONS_DEFAULT.
Comment 3 pete 2022-05-08 17:51:51 UTC
(In reply to pete from comment #2)
Sorry there was a typo in my previous reply.  HTTP_AUTH_KRB5 *is* enabled by default, I had to manually enable GSSAPI_MIT - after setting this to enabled the port built cleanly.  I am still not sure if we should set GSSAPI_MIT to enabled as default, or if there is another piece of logic I'm missing.
Comment 4 Jochen Neumeister freebsd_committer freebsd_triage 2022-05-20 17:36:31 UTC
The port is only a slave port of www/nginx.
If www/nginx-full has an error, it comes from www/nginx.
So the error is not in www/nginx-full, but in www/nginx. 
Since www/nginx-full has not been loved for a long time, some modules are missing, which I have added to www/nginx in the course of time. I took over www/nginx-full some time ago, but haven't given it any love yet.
So now we should focus on www/nginx, because that's where the error is.
For me would now be interesting: How did the error happen with you? Did you change www/nginx-full options, or did you use the default settings?
Comment 5 Christian Sturm 2022-05-20 17:42:25 UTC
I think the main use case of the port is so people who want different options than www/nginx can install a package, rather than self compiling. Anyways, that is mine.

So the pre-built package didn't exist for a while now.

https://portsfallout.com/fallout?port=www%2Fnginx-full%24

In other words, we're talking about the default settings.
Comment 6 Jochen Neumeister freebsd_committer freebsd_triage 2022-05-20 17:47:46 UTC
https://www.freshports.org/www/nginx
https://www.freshports.org/www/nginx-full

you can check here the "Configuration Options:" and you will find that nginx-full has many more modules ON
Comment 7 Christian Sturm 2022-05-20 17:56:36 UTC
(In reply to Jochen Neumeister from comment #6)

I am not sure what you are trying to say by that.

I just clarified we are talking about default options of the packages, which is why nginx-full is in fallout, while nginx isn't.
Comment 8 Jochen Neumeister freebsd_committer freebsd_triage 2022-05-20 18:33:02 UTC
and I tried to explain that nginx-full is a slaveport of nginx, and get all the necessary information from it. Only nginx-full has more modules enabled than nginx.
Comment 9 pete 2022-05-20 20:07:27 UTC
(In reply to Jochen Neumeister from comment #8)
Hi thanks for taking a look at this, as well as the insight.

The reason I created this ticket against www/nginx-full is that I needed to ensure GSSAPI_MIT was set to enabled for that port, otherwise it would fail to build.  Once I add manually enabled that option for www/nginx-full I was able to build it and have a functional package.

The root cause of the reason that I wanted to use the nginx-full port in the first place was that it has several modules enabled I wanted to take advantage of that weren't in the default port (for example HTTP_FANCYINDEX).

For now I've configured poudriere to enable GSSAPI_MIT for www/nginx-full allowing me to use the resulting pkg on my webserver.  Hopefully it's as straight forward as I think it is and makes sense to just ensure that option is defined in OPTIONS_DEFAULT in the Makefile.
Comment 10 Kubilay Kocak freebsd_committer freebsd_triage 2022-05-21 04:12:22 UTC
Let's clear this up. Regardless of where or what port nginx-full's configuration come from...

nginx-full has by default (OPTIONS_DEFAULT)

     HTTP_AUTH_KRB5=on: 3rd party http_auth_gss module

but does not have a corresponding GSSAPI_* option enabled:

     GSSAPI_HEIMDAL=off: GSSAPI support via security/heimdal
     GSSAPI_MIT=off: GSSAPI support via security/krb5

nginx-full needs to either:

- Remove HTTP_AUTH_KRB5 from OPTIONS_DEFAULT, but this would not be consistent with -full

OR

- Add/set a default GSSAPI_* option, either via HTTP_AUTH_KRB5_*IMPLIES* or otherwise.

Right now, both the nginx-full port in its default state, and the nginx-full binary package are broken, with the latter package not being available to users.
Comment 11 pete 2022-05-29 17:09:33 UTC
Hello, just bumping this ticket.  I agree with the previous comment/synopsis from koobs, so hoping the changes we need to make are pretty minor to unbreak builds.
Comment 12 Jochen Neumeister freebsd_committer freebsd_triage 2022-06-01 17:43:29 UTC
fixed