unbit / uwsgi

uWSGI application server container
http://projects.unbit.it/uwsgi
Other
3.45k stars 691 forks source link

unsetenv returns void on some platforms #334

Closed mistydemeo closed 11 years ago

mistydemeo commented 11 years ago

In mistydemeo/tigerbrew#98, a user reported a failure building uwsgi on Mac OS X Tiger due to the implementation of unsetenv on that platform. Unlike later versions of OS X, unsetenv returns void instead of an int; this is also true for some other Unix platforms, such as Linux in glibc prior to 2.2.2. This results in build errors in places where uwsgi is attempting to check the return value of the function, such as in https://github.com/unbit/uwsgi/blob/master/core/emperor.c#L912 -

if (unsetenv(oe)) {
florent-f commented 11 years ago

To deal with the void return value of unsetenv on my Intel Tiger platform, I commented out the following block in the emperor.c file:

if (unsetenv(oe)) {
    uwsgi_error("unsetenv()");
    free(oe);
    break;
}

But uwsgi still doesn't compile. It fails with the following error message:

cc1: warnings being treated as errors

core/sendfile.c: In function 'uwsgi_sendfile_do':

core/sendfile.c:15: warning: implicit declaration of function 'sendfile'

cc1: warnings being treated as errors

core/offload.c: In function 'u_offload_sendfile_do':

core/offload.c:350: warning: implicit declaration of function 'sendfile'
unbit commented 11 years ago

i need a bit of time to build a tiger system. It looks like sendfile has been added in 10.5:

http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man2/sendfile.2.html

it is not a big problem as we already have fallback for system not implementing it

florent-f commented 11 years ago

Good news ; ) Tell me if you need assistance

unbit commented 11 years ago

I am having lot of difficulties in building an x86 tiger system. Can you give me ssh access to one of yours ?

mistydemeo commented 11 years ago

I'm without access to my Tiger box for about a month, unfortunately.

florent-f commented 11 years ago

unbit, I've set an account for you. Let me your email and I'll send you the access' details.

unbit commented 11 years ago

roberto at unbit.it, i will be able to work on it starting from 20:00 GMT + 1

florent-f commented 11 years ago

Sent you an email. Thank you for your help

unbit commented 11 years ago

did not get it, you can try with roberto at 20tab.com or via jabber/xmpp using roberto at jabber.unbit.it

florent-f commented 11 years ago

Sorry, I made a typo mistake. New email sent to your address at unbit.it

unbit commented 11 years ago

Ok, check the latest github code. It should work on Tiger too

florent-f commented 11 years ago

I updated to the latest uwsgi version, but compilation didn't succeed: $ python uwsgiconfig.py --build ... * error linking uWSGI *

Here's the full output: https://gist.github.com/florent-f/a3e3511994218ea70cbf

Any idea ?

mistydemeo commented 11 years ago

It may be Tiger's ld being deficient again. Try installing ld64 using tigerbrew and export the following before building:

export LDFLAGS="-B$(brew --prefix)/opt/ld64/bin/"
florent-f commented 11 years ago

Thanks, it worked ! ld64 was already insalled (should have been a prerequisite of some installed package), but exporting the LDFLAGS allowed uwsgi to compile ... Awesome !