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

mingw64 build failing #454

Open
nivpgir opened this issue Aug 2, 2021 · 5 comments
Open

mingw64 build failing #454

nivpgir opened this issue Aug 2, 2021 · 5 comments

Comments

@nivpgir
Copy link

nivpgir commented Aug 2, 2021

I'm trying to build Io on windows with mingw64, I'm not familiar with mingw but I managed to get it installed and in the path (I think), but when running mingw32-make I get the following error:

In file included from C:\Users\Niv\Downloads\io\libs\basekit\source\CHash.c:10:0:
c:\mingw\include\stdio.h:345:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__mingw__snprintf'
 extern int __mingw_stdio_redirect__(snprintf)(char*, size_t, const char*, ...);
            ^
libs\basekit\CMakeFiles\basekit.dir\build.make:105: recipe for target 'libs/basekit/CMakeFiles/basekit.dir/source/CHash.c.obj' failed

I assumed it's a mingw64 issue and I found this SO question, and applied this patch linked from it, which got me through the error above, only to run into this error:

C:\Users\Niv\Downloads\io\libs\basekit\source\DynLib.c: In function 'dlopen':
C:\Users\Niv\Downloads\io\libs\basekit\source\DynLib.c:26:22: error: 'ERROR_SUCCESS' undeclared (first use in this function)
         SetLastError(ERROR_SUCCESS);
                      ^~~~~~~~~~~~~
C:\Users\Niv\Downloads\io\libs\basekit\source\DynLib.c:26:22: note: each undeclared identifier is reported only once for each function it appears in
C:\Users\Niv\Downloads\io\libs\basekit\source\DynLib.c: In function 'dlerror':
C:\Users\Niv\Downloads\io\libs\basekit\source\DynLib.c:39:16: error: 'ERROR_SUCCESS' undeclared (first use in this function)
     if (err == ERROR_SUCCESS)
                ^~~~~~~~~~~~~
libs\basekit\CMakeFiles\basekit.dir\build.make:165: recipe for target 'libs/basekit/CMakeFiles/basekit.dir/source/DynLib.c.obj' failed

which I can't find a solution to, so I've come here for help.

Maybe a specific version of mingw64 is required? or some other environment setting, I can see the CI builds succesfuly, so I don't know what's wrong with my setup.

It's probably worth noting that I also downloaded the build artifacts from the CI (by forking and running the CI action in my account, and taking the binary files from there), and that worked well, but then I ran in to the same compile error when installing eerie, when it tries to compile the Markdown addon, and since most of the addons don't ship binaries, it seems I need to solve it no matter what.

I appreciate any help solving this

@melted
Copy link

melted commented Aug 3, 2021

That's a bit weird, ERROR_SUCCESS should come from windows.h. And if it can find the other windows stuff I can't see why that should be left out. I haven't built with mingw, but I can try it out.

@melted
Copy link

melted commented Aug 3, 2021

I tested with the mingw toolchain from MSYS2 and it worked fine. What I did was (I already had cmake and gcc installed):

mkdir build && cd build
cmake -G "MinGW Makefiles" ..
cmake --build .

@melted
Copy link

melted commented Aug 3, 2021

I really recommend using MSYS2 https://www.msys2.org for the toolchain, as it comes with a package manager and makes for a way more reproducible setup.

@nivpgir
Copy link
Author

nivpgir commented Aug 3, 2021

Thanks! compiling with msys succeeded, however, running io or io_static just freezes the terminal.
and when I try to run the eerie setup, the "Markdown" package compilation fails (different errors this time).
these are the errors in case you can help (I modified eerie to print all the commands to see what it's running):

git submodule update
 - Resolving dependencies for Markdown
 - Installing Markdown...
 - Compiling source files...
mkdir -p _build/headers
cc -Os -g -Wall -pipe -fno-strict-aliasing -DSANE_POPEN -DIOBINDINGS   -I/mingw/include -IC:/IoLanguage/bin/eerie/env/_base/addons/Markdown/deps/w64/include -I. -DBUILDING_MARKDOWN_ADDON  -c -o _build/objs/IoMarkdown.o source/IoMarkdown.c
C:\IoLanguage\bin\eerie\env\_base\addons\Markdown
cc -Os -g -Wall -pipe -fno-strict-aliasing -DSANE_POPEN -DIOBINDINGS   -I/mingw/include -IC:/IoLanguage/bin/eerie/env/_base/addons/Markdown/deps/w64/include -I. -DBUILDING_MARKDOWN_ADDON  -c -o _build/objs/IoMarkdown.o source/IoMarkdown.c
 ! Last command exited with the following error:
 !
 ! In file included from C:/msys64/mingw64/x86_64-w64-mingw32/include/crtdefs.h:10,
                 from C:/msys64/mingw64/x86_64-w64-mingw32/include/stddef.h:7,
                 from C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/10.3.0/include/stddef.h:1,
                 from /mingw/include/string.h:53,
                 from source/IoMarkdown.c:6:
C:/msys64/mingw64/x86_64-w64-mingw32/include/corecrt.h:35:18: error: expected ';' before 'typedef'
   35 | __MINGW_EXTENSION typedef unsigned __int64 size_t;
      |                  ^~~~~~~~
      |                  ;
C:/msys64/mingw64/x86_64-w64-mingw32/include/corecrt.h:45:18: error: expected ';' before 'typedef'
   45 | __MINGW_EXTENSION typedef __int64 ssize_t;
      |                  ^~~~~~~~
      |                  ;
C:/msys64/mingw64/x86_64-w64-mingw32/include/corecrt.h:62:18: error: expected ';' before 'typedef'
   62 | __MINGW_EXTENSION typedef __int64 intptr_t;
      |                  ^~~~~~~~
      |                  ;
C:/msys64/mingw64/x86_64-w64-mingw32/include/corecrt.h:75:18: error: expected ';' before 'typedef'
   75 | __MINGW_EXTENSION typedef unsigned __int64 uintptr_t;
      |                  ^~~~~~~~
      |                  ;
C:/msys64/mingw64/x86_64-w64-mingw32/include/corecrt.h:88:18: error: expected ';' before 'typedef'
   88 | __MINGW_EXTENSION typedef __int64 ptrdiff_t;
      |                  ^~~~~~~~
      |                  ;
C:/msys64/mingw64/x86_64-w64-mingw32/include/corecrt.h:123:18: error: expected ';' before 'typedef'
  123 | __MINGW_EXTENSION typedef __int64 __time64_t;
      |                  ^~~~~~~~
      |                  ;
In file included from /mingw/include/stdio.h:94,
                 from C:/IoLanguage/bin/eerie/env/_base/addons/Markdown/deps/w64/include/mkdio.h:4,
                 from source/IoMarkdown.c:7:
/mingw/include/sys/types.h:123:21: error: conflicting types for 'ssize_t'
  123 |   typedef _ssize_t  ssize_t;
      |                     ^~~~~~~
In file included from C:/msys64/mingw64/x86_64-w64-mingw32/include/crtdefs.h:10,
                 from C:/msys64/mingw64/x86_64-w64-mingw32/include/stddef.h:7,
                 from C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/10.3.0/include/stddef.h:1,
                 from /mingw/include/string.h:53,
                 from source/IoMarkdown.c:6:
C:/msys64/mingw64/x86_64-w64-mingw32/include/corecrt.h:45:35: note: previous declaration of 'ssize_t' was here
   45 | __MINGW_EXTENSION typedef __int64 ssize_t;
      |                                   ^~~~~~~
source/IoMarkdown.c:8:10: fatal error: IoSeq.h: No such file or directory
    8 | #include "IoSeq.h"
      |          ^~~~~~~~~
compilation terminated.

however this might be a different issue that maybe I should take to Markdown.

@codecop
Copy link

codecop commented Dec 16, 2024

For error: conflicting types for 'ssize_t' under MingW I had to set -D _NO_OLDNAMES during compilation (i.e. set the define _NO_OLDNAMES) which omits the branch with the duplicate definition. Not sure it helps here.

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

3 participants