Giter Site home page Giter Site logo

Comments (16)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
I think this is fixed, please reopen if it is not.

Original comment by valenok on 28 Jun 2009 at 10:49

  • Changed state: Fixed

from mongoose.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
When building with my own make using MinGW, mongoose.c, mongoose.h I get this 
same 
error. pid_t is defined twice.

Original comment by [email protected] on 20 Jul 2009 at 10:35

from mongoose.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
Patch is welcome :-)

Original comment by valenok on 21 Jul 2009 at 8:31

from mongoose.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
I'm not sure how correct this is, but I did get this to build.

I got this working by not using pid_t directly.  I replaced pid_t with 
'procesID' and 
then conditionally typedef'd processID in windows vs unix

// For Windows and MinGW
typedef HANDLE processID;
// for Unix
typedef pid_t processID;


spawnProcess would return a processID and kill would take a processID. sendCGI 
would 
also use processID instead of pid_t

I only tested this under minGW though, and only compiled so far. But seems like 
it 
should avoid the conflict.

Original comment by [email protected] on 21 Jul 2009 at 1:56

from mongoose.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
It looks like the pid_t issue has been partially addressed in 
"$Id: mongoose.c 327 2009-05-05 14:11:04Z valenok $"
but using Eclipse-3.4.2/CDT-5.0.2/MinGW-3.15.2 I also had to define 
"_NO_OLDNAMES" to
avoid the error (as used in sys/types.h).  This macro definition doesn't appear 
to be
in the Makefile.

Original comment by [email protected] on 27 Jul 2009 at 7:36

from mongoose.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
@guy.lancaster: I've tried to use the options -D_NO_OLDNAMES in the makefile, 
but it
gives these errors:

C:\mongoose-2.8\mongoose>mingw32-make mingw
gcc -W -Wall -mthreads -Wl,--subsystem,console -DNDEBUG -Os -DHAVE_STDINT -D_NO_
OLDNAMES mongoose.c -lws2_32 \
                -shared -Wl,--out-implib=mongoose.lib -o _mongoose.dll
mongoose.c: In function 'mg_stat':
mongoose.c:1087: warning: integer constant is too large for 'long' type
mongoose.c: In function 'send_file':
mongoose.c:2751: error: 'off_t' undeclared (first use in this function)
mongoose.c:2751: error: (Each undeclared identifier is reported only once
mongoose.c:2751: error: for each function it appears in.)
mongoose.c:2751: error: expected ')' before 'r1'
mongoose.c: In function 'send_cgi':
mongoose.c:3286: warning: implicit declaration of function 'fdopen'
mongoose.c:3286: warning: assignment makes pointer from integer without a cast
mongoose.c:3287: warning: assignment makes pointer from integer without a cast
mingw32-make: *** [mingw] Error 1


Original comment by [email protected] on 28 Jul 2009 at 11:08

from mongoose.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
I thought that defining _NO_OLDNAMES had resolved the problems so I reverted my 
other
changes last night but this morning it's back to the original problems.  

Is anyone able to build it under MinGW? If not, did it ever build?  Knowing the
history will help to understand what may be needed.  BTW, I haven't tried to 
link it
yet so there may be more issues.

I have to return to the client-side of my project for a while so there's time to
speak up if there are any suggestions before I get back to this.

Thanks.

-- Guy

Original comment by [email protected] on 28 Jul 2009 at 5:33

from mongoose.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
[deleted comment]

from mongoose.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
[deleted comment]

from mongoose.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
I've understood how to fix this!

I've searched on some forums/mailing lists (and in particular this
http://gcc.gnu.org/ml/gcc-bugs/2004-03/msg01944.html ), and it seems that when 
you
try to use "gcc -v example.c" it shows you all the paths in which it will 
search for
libraries and so on.
So I've just read that when I gave the command 'gcc -v example.c' (this is the 
code)

#include <sys/types.h>
#include <stdio.h>

typedef int pid_t;

int main()
{

    pid_t pid = 5;
    off_t p = 6;
    printf("Pid %d %d\n", pid, p);
}


It showed me some lines, and one (or more) of these were:
ignoring nonexisting directory mingw/include

So I've renamed the mingw directory; it was C:\MinGW4-4. I've renamed it to
'c:\mingw'. Then I've fixed the environment variables (PATH, since it pointed to
mingw4-4) and tried to compile the example (see here for the log
http://pastebin.com/f451ce8ca ) and then mongoose. 


C:\mongoose-2.8\mongoose>mingw32-make mingw
gcc -W -Wall -mthreads -Wl,--subsystem,console -DNDEBUG -Os -DHAVE_STDINT mongoo
se.c -lws2_32 \
                -shared -Wl,--out-implib=mongoose.lib -o _mongoose.dll
mongoose.c: In function 'mg_stat':
mongoose.c:1088: warning: integer constant is too large for 'long' type
Creating library file: mongoose.lib
gcc -W -Wall -mthreads -Wl,--subsystem,console -DNDEBUG -Os -DHAVE_STDINT mongoo
se.c main.c -lws2_32 -ladvapi32 -o mongoose.exe
mongoose.c: In function 'mg_stat':
mongoose.c:1088: warning: integer constant is too large for 'long' type

Only some warnings without using -D_NO_OLDNAMES!! :)

PS: Please note that now it says "ignoring duplicate ..." while it said 
"ignoring
nonexisting .."!

Now it works very well :)

Bye!

Original comment by [email protected] on 29 Jul 2009 at 8:29

from mongoose.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
@marcusbu

I'm not sure I understand your 'fix'.  Moving my MinGW directory or installing 
it off 
root does not sound right to me at all.

The hello example you mention does compile if pid_t is an int.  But doesn't if 
you 
use HANDLE as demonstrated below. So is this a fix or did you just get lucky?



#include <sys/types.h>
#include <stdio.h>
#include <windows.h>

typedef HANDLE pid_t;

int main()
{

       pid_t pid = 5;
       off_t p = 6;
       printf("Pid %d %d\n", pid, p);
}

Original comment by [email protected] on 29 Jul 2009 at 8:52

from mongoose.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
I've compiled mongoose without problems, as you can see. The only warning I got 
was:
"integer constant is too large for 'long' type"

It however means that "typedef HANDLE pid_t" works fine.

I think it can be a solution, since gcc checked for the 'mingw/include' where 
are
defined all the headers (sys/types.h and so on) but it couldn't find them. 
Have you tried to rename your installation path?
It should be "c:\Mingw\" and not "C:\program files\mingw" and similar.
I don't know exactly why this happens (maybe the --prefix=/mingw doesn't work on
windows?), but as you can see also here (
http://web.archive.org/web/20041026163202/http://www63.tok2.com/home/bitwalk/dow
nload.html
), it's a well established fact that you must use C:\mingw.

Bye!


Original comment by [email protected] on 30 Jul 2009 at 6:56

from mongoose.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
Does not work for me.  I moved my MinGW to c:/mingw neither builds when using 
HANDLE.

And I haven't had any issues using the MinGW in my Qt directory with anything 
else so 
I'm not sure why the c:/mingw works for you.

You could be right its a MinGW problem, but I can't build mongoose even if 
c:/mingw 
is the install i use.

BTW HANDLE for my install is defined as a void* not an integer.

Incidentally it does find the headers, that's part of the problem.  pid_t is 
defined 
twice.

Thanks for the help.

Original comment by [email protected] on 30 Jul 2009 at 1:44

from mongoose.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
I wonder *why* pid_t is defined twice? in mongoose.c, pid_t is defined under the
_WIN32 conditional, which I though is not visible under mingw.

Original comment by valenok on 30 Jul 2009 at 2:12

from mongoose.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
Yes the win32 conditional is enabled.  (In netbeans I can see the conditional 
code that 
is active.)

Also, I noticed marcusbu used gcc 4.4.  I just spent an hour setting that up. 
Still 
fails.

Original comment by [email protected] on 30 Jul 2009 at 2:51

from mongoose.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
@doug: 
you're right. I don't know why I had mongoose.c modified (I had typedef HANDLE
processID; and all the pid_t were processID). What a really boring error!

@valenok: 
when you use mingw, these macros are automatically defined:
http://pastebin.com/m762bb463

as you can see the second line says "_WIN32 1"

I've also tried to use -U_WIN32 in the makefile, but I get these errors:
http://pastebin.com/m5a1dd57b

Bye!

Original comment by [email protected] on 30 Jul 2009 at 2:58

from mongoose.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.