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

151d75b breaks mingw builds on Windows #464

Closed
jonforums opened this issue Sep 11, 2012 · 3 comments
Closed

151d75b breaks mingw builds on Windows #464

jonforums opened this issue Sep 11, 2012 · 3 comments

Comments

@jonforums
Copy link
Contributor

It appears that the fix for #459 to solve a Win 7 SDK build warning breaks the CMake/MSYS/MinGW build on my Win7 32bit system.

Note that no MinGW compiler defines _MSC_VER. Was the original _MVC_VER a typo and replacing with _MSC_VER suppress the warning? Double check cl predefined macros


C:\Users\Jon\Documents\RubyDev\mruby-git\build>git log -1 --oneline
2dbd6fa Merge pull request #462 from bovi/test-for-460

C:\Users\Jon\Documents\RubyDev\mruby-git\build>cmake -G "MSYS Makefiles" .. && make all test
...
[ 77%] Building C object src/CMakeFiles/mruby_object.dir/time.c.obj
c:/Users/Jon/Documents/RubyDev/mruby-git/src/time.c: In function 'mrb_time_update_datetime':
c:/Users/Jon/Documents/RubyDev/mruby-git/src/time.c:139:5: error: implicit declaration of
function 'gmtime_s' [-Werror=implicit-function-declaration]
c:/Users/Jon/Documents/RubyDev/mruby-git/src/time.c:142:5: error: implicit declaration of
function 'localtime_s' [-Werror=implicit-function-declaration]
cc1.exe: some warnings being treated as errors

make[2]: *** [src/CMakeFiles/mruby_object.dir/time.c.obj] Error 1
make[1]: *** [src/CMakeFiles/mruby_object.dir/all] Error 2
make: *** [all] Error 2

I'm swamped with work and will not have time to look into this for awhile, but there should be other ways to suppress warnings for cl and friends. For example, I originally supressed MSVC warning via CMake here

Please revert 151d75b and investigate using _MSC_VER or the CMake alternative.

For those of you building/testing mruby on Windows, I request that you ensure any patches work with for both MSVC and MinGW (I test with multiple MinGW versions and Win7 SDK cmd line tools).

If you don't have a MSYS/MinGW toolchain, download one of DevKit flavors I maintain at TheCodeShop. It's as simple as running the devkitvars.bat (or devkitvars.ps1) scripts which bring sh, make, gcc and friends onto your PATH. And then it's just a cd build && cmake -G "MSYS Makefiles" .. && make all test away to ensure your patch works with a MinGW toolchain.

@jonforums
Copy link
Contributor Author

Fixing the typo from _MVC_VER to _MSC_VER appears to fix the issue on my Win7 32bit system in the following build configurations:

  • mingw 4.6.2 + msys makefiles
  • mingw-w64 4.7.1 + ninja build files
  • win7 sdk + nmake makefiles

@shancat does using _MSC_VER also work for you?

@ghost ghost mentioned this issue Sep 11, 2012
@ghost
Copy link

ghost commented Sep 11, 2012

My fault sorry. I don't have MinGW and I can't install it as I live in a
outlying area and all I get is 2GB of Dodo mobile broadband. I'm testing your
suggesting fix now. I was wondering why _MVC_VER didn't work in that one place
but worked every where else (I assumed).

Works with Windows 7 SDK + NMake makefiles with me.
I'll try and be more carefull with MinGW next time.

Does #465 fix it for you?

@matz matz closed this as completed in 4df4dc9 Sep 11, 2012
matz added a commit that referenced this issue Sep 11, 2012
@jonforums
Copy link
Contributor Author

@shancat it's fixed in the same environments I previously mentioned; thank you.

FWIW, it can be tricky to get code working correctly with both MSVC and the different flavors (mingw.org and mingw-w64) of MinGW due mainly to header differences. Here's hoping you can cajole a friend to download all my DevKit flavors and burn you a CD/DVD 😸

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