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

lib9: build failure on mingw32 #9472

Closed
mattn opened this issue Dec 30, 2014 · 10 comments
Closed

lib9: build failure on mingw32 #9472

mattn opened this issue Dec 30, 2014 · 10 comments

Comments

@mattn
Copy link
Member

mattn commented Dec 30, 2014

##### Building C bootstrap tool.
cmd/dist

##### Building compilers and Go bootstrap tool.
In file included from C:\Users\mattn\dev\go\src\lib9\_exits.c:29:0:
C:\Users\mattn\dev\go\include/libc.h:313:8: error: redefinition of 'struct timespec'
 struct timespec {
        ^
In file included from c:\mingw\include\unistd.h:95:0,
                 from C:\Users\mattn\dev\go\include/u.h:62,
                 from C:\Users\mattn\dev\go\src\lib9\_exits.c:28:
c:\mingw\include\parts\time.h:65:8: note: originally defined here
 struct timespec
        ^
In file included from C:\Users\mattn\dev\go\src\lib9\_exits.c:29:0:
C:\Users\mattn\dev\go\include/libc.h:321:12: error: conflicting types for 'nanosleep'
 extern int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
            ^
In file included from C:\Users\mattn\dev\go\include/u.h:62:0,
                 from C:\Users\mattn\dev\go\src\lib9\_exits.c:28:
c:\mingw\include\unistd.h:109:5: note: previous definition of 'nanosleep' was here
 int nanosleep( const struct timespec *period, struct timespec *residual )
     ^
In file included from C:\Users\mattn\dev\go\src\lib9\_p9dir.c:30:0:
C:\Users\mattn\dev\go\include/libc.h:313:8: error: redefinition of 'struct timespec'
 struct timespec {
        ^
In file included from c:\mingw\include\unistd.h:95:0,
                 from C:\Users\mattn\dev\go\include/u.h:62,
                 from C:\Users\mattn\dev\go\src\lib9\_p9dir.c:28:
c:\mingw\include\parts\time.h:65:8: note: originally defined here
 struct timespec
        ^
In file included from C:\Users\mattn\dev\go\src\lib9\_p9dir.c:30:0:
C:\Users\mattn\dev\go\include/libc.h:321:12: error: conflicting types for 'nanosleep'
 extern int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
            ^
In file included from C:\Users\mattn\dev\go\include/u.h:62:0,
                 from C:\Users\mattn\dev\go\src\lib9\_p9dir.c:28:
c:\mingw\include\unistd.h:109:5: note: previous definition of 'nanosleep' was here
 int nanosleep( const struct timespec *period, struct timespec *residual )
     ^
In file included from C:\Users\mattn\dev\go\src\lib9\atoi.c:29:0:
C:\Users\mattn\dev\go\include/libc.h:313:8: error: redefinition of 'struct timespec'
 struct timespec {
        ^
In file included from c:\mingw\include\unistd.h:95:0,
                 from C:\Users\mattn\dev\go\include/u.h:62,
                 from C:\Users\mattn\dev\go\src\lib9\atoi.c:28:
c:\mingw\include\parts\time.h:65:8: note: originally defined here
 struct timespec
        ^
In file included from C:\Users\mattn\dev\go\src\lib9\atoi.c:29:0:
C:\Users\mattn\dev\go\include/libc.h:321:12: error: conflicting types for 'nanosleep'
 extern int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
            ^
In file included from C:\Users\mattn\dev\go\include/u.h:62:0,
                 from C:\Users\mattn\dev\go\src\lib9\atoi.c:28:
c:\mingw\include\unistd.h:109:5: note: previous definition of 'nanosleep' was here
 int nanosleep( const struct timespec *period, struct timespec *residual )
     ^
In file included from C:\Users\mattn\dev\go\src\lib9\cleanname.c:30:0:
C:\Users\mattn\dev\go\include/libc.h:313:8: error: redefinition of 'struct timespec'
 struct timespec {
        ^
In file included from c:\mingw\include\unistd.h:95:0,
                 from C:\Users\mattn\dev\go\include/u.h:62,
                 from C:\Users\mattn\dev\go\src\lib9\cleanname.c:29:
c:\mingw\include\parts\time.h:65:8: note: originally defined here
 struct timespec
        ^
In file included from C:\Users\mattn\dev\go\src\lib9\cleanname.c:30:0:
C:\Users\mattn\dev\go\include/libc.h:321:12: error: conflicting types for 'nanosleep'
 extern int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
            ^
In file included from C:\Users\mattn\dev\go\include/u.h:62:0,
                 from C:\Users\mattn\dev\go\src\lib9\cleanname.c:29:
c:\mingw\include\unistd.h:109:5: note: previous definition of 'nanosleep' was here
 int nanosleep( const struct timespec *period, struct timespec *residual )
     ^
lib9
go tool dist: FAILED: gcc -Wall -Wstrict-prototypes -Wextra -Wunused -Wno-sign-compare -Wno-missing-braces -Wno-parentheses -Wno-unknown-pragmas -Wno-switch -Wno-comment -Wno-missing-field-initializers -Werror -fno-common -ggdb -pipe -Wuninitialized -O2 -fmessage-length=0 -c -m32 -I C:\Users\mattn\dev\go\include -DPLAN9PORT -I C:\Users\mattn\dev\go\src\lib9 -o C:\Users\mattn\AppData\Local\Temp\go7AEA.tmp\_exits.o C:\Users\mattn\dev\go\src\lib9\_exits.c
go tool dist: FAILED: gcc -Wall -Wstrict-prototypes -Wextra -Wunused -Wno-sign-compare -Wno-missing-braces -Wno-parentheses -Wno-unknown-pragmas -Wno-switch -Wno-comment -Wno-missing-field-initializers -Werror -fno-common -ggdb -pipe -Wuninitialized -O2 -fmessage-length=0 -c -m32 -I C:\Users\mattn\dev\go\include -DPLAN9PORT -I C:\Users\mattn\dev\go\src\lib9 -o C:\Users\mattn\AppData\Local\Temp\go7AEA.tmp\_p9dir.o C:\Users\mattn\dev\go\src\lib9\_p9dir.c
go tool dist: FAILED: gcc -Wall -Wstrict-prototypes -Wextra -Wunused -Wno-sign-compare -Wno-missing-braces -Wno-parentheses -Wno-unknown-pragmas -Wno-switch -Wno-comment -Wno-missing-field-initializers -Werror -fno-common -ggdb -pipe -Wuninitialized -O2 -fmessage-length=0 -c -m32 -I C:\Users\mattn\dev\go\include -DPLAN9PORT -I C:\Users\mattn\dev\go\src\lib9 -o C:\Users\mattn\AppData\Local\Temp\go7AEA.tmp\atoi.o C:\Users\mattn\dev\go\src\lib9\atoi.c
go tool dist: FAILED: gcc -Wall -Wstrict-prototypes -Wextra -Wunused -Wno-sign-compare -Wno-missing-braces -Wno-parentheses -Wno-unknown-pragmas -Wno-switch -Wno-comment -Wno-missing-field-initializers -Werror -fno-common -ggdb -pipe -Wuninitialized -O2 -fmessage-length=0 -c -m32 -I C:\Users\mattn\dev\go\include -DPLAN9PORT -I C:\Users\mattn\dev\go\src\lib9 -o C:\Users\mattn\AppData\Local\Temp\go7AEA.tmp\cleanname.o C:\Users\mattn\dev\go\src\lib9\cleanname.c
@mattn
Copy link
Member Author

mattn commented Dec 30, 2014

@ianlancetaylor
Copy link
Contributor

Which version of Go are you building?

@alexbrainman
Copy link
Member

I would like to try and reproduce your error. How can I do that?

Alex

@mikioh mikioh changed the title Build failure on mingw32 lib9: build failure on mingw32 Dec 31, 2014
@mattn
Copy link
Member Author

mattn commented Dec 31, 2014

git HEAD. latest of mingw32 on 32bit

On 12/31/14, Ian Lance Taylor notifications@github.com wrote:

Which version of Go are you building?


Reply to this email directly or view it on GitHub:
#9472 (comment)

  • Yasuhiro Matsumoto

@alexbrainman
Copy link
Member

Everything builds properly here. I use

C:\go\root\src>gcc --version
gcc (GCC) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

@mattn
Copy link
Member Author

mattn commented Dec 31, 2014

I got build error on windows vista.

gcc (GCC) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

@alexbrainman
Copy link
Member

I do not know what your problem is. We need to understand what is happening here before we can decide what to do next.

@mattn
Copy link
Member Author

mattn commented Dec 31, 2014

I can't build lib9 because struct timespec is redefined in libc.h

On 12/31/14, alexbrainman notifications@github.com wrote:

I do not know what your problem is. We need to understand what is happening
here before we can decide what to do next.


Reply to this email directly or view it on GitHub:
#9472 (comment)

  • Yasuhiro Matsumoto

@mattn
Copy link
Member Author

mattn commented Dec 31, 2014

above is log with make.bat

On 12/31/14, Yasuhiro MATSUMOTO mattn.jp@gmail.com wrote:

I can't build libc9 because struct timeval is redefined in libc.h

On 12/31/14, alexbrainman notifications@github.com wrote:

I do not know what your problem is. We need to understand what is
happening
here before we can decide what to do next.


Reply to this email directly or view it on GitHub:
#9472 (comment)

  • Yasuhiro Matsumoto

  • Yasuhiro Matsumoto

@mattn
Copy link
Member Author

mattn commented Dec 31, 2014

Try this:

foo.c (This has includes and ifdef(s) similar to _p9dir.c and libc.h)

#include <unistd.h>

#ifdef _WIN32
#if !defined(_WIN64) && !defined(__MINGW64_VERSION_MAJOR)
struct timespec {
    int tv_sec;
    long tv_nsec;
};
#endif
#endif
gcc -Wall -Wstrict-prototypes -Wextra -Wunused -Wno-sign-compare -Wno-missing-braces -Wno-parentheses -Wno-unknown-pragmas -Wno-switch -Wno-comment -Wno-missing-field-initializers -Werror -fno-common -ggdb -pipe -Wuninitialized -O2 -fmessage-length=0 -c -m32 -I C:\Users\mattn\dev\go\include -DPLAN9PORT -I C:\Users\mattn\dev\go\src\lib9 foo.c 
foo.c:5:8: error: redefinition of 'struct timespec'
 struct timespec {
        ^
In file included from c:\mingw\include\unistd.h:95:0,
                 from foo.c:1:
c:\mingw\include\parts\time.h:65:8: note: originally defined here
 struct timespec
        ^

@minux minux closed this as completed in 29c8573 Jan 2, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants