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

Under Solaris #106

Closed
hansipie opened this issue Apr 24, 2015 · 5 comments
Closed

Under Solaris #106

hansipie opened this issue Apr 24, 2015 · 5 comments

Comments

@hansipie
Copy link
Contributor

Hello all

I don't know if it is supported, but I'm try to compile civetweb on Solaris (SunOS 5.10 Generic_127128-11 64-bit amd64) using Sun Studio 11 C++ Compiler (11.0,REV=2005.10.13). This is what i get:


"civetweb.c", line 556: syntax error before or at: void
"civetweb.c", line 557: syntax error before or at: void
"civetweb.c", line 558: syntax error before or at: void
"civetweb.c", line 559: syntax error before or at: void
"civetweb.c", line 837: zero-sized struct/union
"civetweb.c", line 6344: improper member use: handler
"civetweb.c", line 6346: improper member use: connect_handler
"civetweb.c", line 6347: improper member use: ready_handler
"civetweb.c", line 6348: improper member use: data_handler
"civetweb.c", line 6349: improper member use: close_handler
"civetweb.c", line 6386: improper member use: handler
"civetweb.c", line 6388: improper member use: connect_handler
"civetweb.c", line 6389: improper member use: ready_handler
"civetweb.c", line 6390: improper member use: data_handler
"civetweb.c", line 6391: improper member use: close_handler
"civetweb.c", line 6442: improper member use: connect_handler
"civetweb.c", line 6443: improper member use: ready_handler
"civetweb.c", line 6444: improper member use: data_handler
"civetweb.c", line 6445: improper member use: close_handler
"civetweb.c", line 6447: improper member use: handler
"civetweb.c", line 6464: improper member use: connect_handler
"civetweb.c", line 6465: improper member use: ready_handler
"civetweb.c", line 6466: improper member use: data_handler
"civetweb.c", line 6467: improper member use: close_handler
"civetweb.c", line 6469: improper member use: handler
"civetweb.c", line 6484: improper member use: connect_handler
"civetweb.c", line 6485: improper member use: ready_handler
"civetweb.c", line 6486: improper member use: data_handler
"civetweb.c", line 6487: improper member use: close_handler
"civetweb.c", line 6489: improper member use: handler


I've managed to fix some of these errors :

  • "syntax error before or at: void" -> replacing "__inline" with "inline"
  • "zero-sized struct/union" -> adding a dummy integer member to the union

But for the "improper member use" errors, i can't find out how to workaround. I think it's may be linked with the "zero-sized struct/union" error. A problem with pointeurs on functions?

Any help ? Idea ?

thanks :)

@hansipie
Copy link
Contributor Author

I finally got a solution to have it compiling on Solaris: remove the union. The mechanism provided by the union on the mg_request_handler_info stucture is then disabled. Is it really needed ?

Now let's see if i've got a clean execution on Solaris .. :)

@bel2125
Copy link
Member

bel2125 commented Apr 24, 2015

I have no access to a Solaris machine, and I have never heard of the "Sun Studio C++ Compiler".
If there is some patch to make it compile, I can certainly integrate it, but as long as I can not test on my own it may be a little hard to help you directly. "Sun Studio C++ Compiler" probably does not exist for Windows or Ubuntu, but only for Solaris?

Maybe the following code will work for you:

struct mg_request_handler_info {
    char *uri;
    size_t uri_len;

    int is_websocket_handler;

    mg_request_handler handler;

    mg_websocket_connect_handler connect_handler;
    mg_websocket_ready_handler ready_handler;
    mg_websocket_data_handler data_handler;
    mg_websocket_close_handler close_handler;

    void *cbdata;
    struct mg_request_handler_info *next;
};

@hansipie
Copy link
Contributor Author

Sun Studio C++ Compiler in indeed for Solaris, and behind its make in fact.
I don't control the build system so i can't move to cmake :(

But ... now it's ok ! 👍 . I've changed 2 things in the code

  • a #ifdef around lines 556-559 to use "inline" on solaris and "__inline" in other cases
  • i've totally removed the union. I've got the same sample of code as you.

I've integrated civet (srcs+includes) to my project, and it compiles on windows, AIX, Solaris (x86, SPARC), Linux, and Mac. I will try to merge with your future modifications and check the compilation.

tks

bel2125 added a commit that referenced this issue Apr 27, 2015
This seems to be better for some compilers (see #106), and may make
the code more readable.
@bel2125
Copy link
Member

bel2125 commented Apr 27, 2015

I removed the union also in the standard code - it might cost 4/8 bytes but makes the code more readable.
Maybe a #define __inline inline in the Makefile or project file could make the code compiling without any change.

@hansipie
Copy link
Contributor Author

Thanks for the union :)

2015-04-27 21:57 GMT+02:00 bel2125 notifications@github.com:

I removed the union also in the standard code - it might cost 4/8 bytes
but makes the code more readable.
Maybe a #define __inline inline in the Makefile or project file could
make the code compiling without any change.


Reply to this email directly or view it on GitHub
#106 (comment).

... parce que schtroumpf.

hunyadi-dev pushed a commit to hunyadi-dev/civetweb that referenced this issue Dec 18, 2020
This closes civetweb#106.

Signed-off-by: Aldrin Piri <aldrin@apache.org>
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

2 participants