Binaryen: Build fails under Cygwin / Windows 10 x64

Created on 15 Mar 2016  Â·  9Comments  Â·  Source: WebAssembly/binaryen

Hi,

I'm not quite sure if building via Cygwin is supported at all so it may be that this _problem_ is not a problem at all.

I checked out the latest sources and did python update.py which returned following results:

$ python update.py
Updating git submodules
Entering 'test/emscripten'
Entering 'test/spec'
Entering 'test/waterfall'
Updating from the waterfall, current revision 3943

Downloading `/cygdrive/d/src/webassembly/binaryen/test/wasm-torture-s-3846.tbz2`

Then I continued with cmake .

$ cmake .
-- The CXX compiler identification is GNU 4.9.3
CMake Warning at /usr/share/cmake-3.3.2/Modules/Platform/CYGWIN.cmake:15 (message):
  CMake no longer defines WIN32 on Cygwin!

  (1) If you are just trying to build this project, ignore this warning or
  quiet it by setting CMAKE_LEGACY_CYGWIN_WIN32=0 in your environment or in
  the CMake cache.  If later configuration or build errors occur then this
  project may have been written under the assumption that Cygwin is WIN32.
  In that case, set CMAKE_LEGACY_CYGWIN_WIN32=1 instead.

  (2) If you are developing this project, add the line

    set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required

  at the top of your top-level CMakeLists.txt file or set the minimum
  required version of CMake to 2.8.4 or higher.  Then teach your project to
  build on Cygwin without WIN32.
Call Stack (most recent call first):
  /usr/share/cmake-3.3.2/Modules/CMakeSystemSpecificInformation.cmake:36 (include)
  CMakeLists.txt:1 (PROJECT)


-- Check for working CXX compiler: /usr/bin/c++.exe
-- Check for working CXX compiler: /usr/bin/c++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- No build type selected, default to Release
-- Building with -std=c++11
-- Building with -msse2
-- Building with -mfpmath=sse
-- Building with -Wall
-- Building with -Werror
-- Building with -Wextra
-- Building with -Wno-unused-parameter
-- Building with -fno-omit-frame-pointer
-- Building with -O2
-- Configuring done
-- Generating done
-- Build files have been written to: /cygdrive/d/src/webassembly/binaryen

Well, it looked convincing so I hoped the final make will succeed as well.

Scanning dependencies of target support
[  2%] Building CXX object CMakeFiles/support.dir/src/support/bits.cpp.o
[  4%] Building CXX object CMakeFiles/support.dir/src/support/colors.cpp.o
[  6%] Building CXX object CMakeFiles/support.dir/src/support/command-line.cpp.o
In file included from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h: In static member function ‘static wasm::Name wasm::Name::fromInt(size_t)’:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:83:28: error: ‘to_string’ is not a member of ‘std’
     return cashew::IString(std::to_string(i).c_str(), false);
                            ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h: In static member function ‘static void wasm::Literal::printFloat(std::ostream&, float)’:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:236:16: error: ‘isnan’ was not declared in this scope
     if (isnan(f)) {
                ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:236:16: note: suggested alternative:
In file included from /cygdrive/d/src/webassembly/binaryen/src/wasm.h:47:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/include/c++/cmath:632:5: note:   ‘std::isnan’
     isnan(_Tp __x)
     ^
In file included from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h: In static member function ‘static void wasm::Literal::printDouble(std::ostream&, double)’:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:252:16: error: ‘isnan’ was not declared in this scope
     if (isnan(d)) {
                ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:252:16: note: suggested alternative:
In file included from /cygdrive/d/src/webassembly/binaryen/src/wasm.h:47:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/include/c++/cmath:632:5: note:   ‘std::isnan’
     isnan(_Tp __x)
     ^
In file included from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h: In member function ‘wasm::Literal wasm::Literal::trunc() const’:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:382:42: error: ‘trunc’ is not a member of ‘std’
       case WasmType::f32: return Literal(std::trunc(getf32()));
                                          ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:382:42: note: suggested alternative:
In file included from /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/include/c++/cmath:44:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/wasm.h:47,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/usr/include/math.h:285:15: note:   ‘trunc’
 extern double trunc _PARAMS((double));
               ^
In file included from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:383:42: error: ‘trunc’ is not a member of ‘std’
       case WasmType::f64: return Literal(std::trunc(getf64()));
                                          ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:383:42: note: suggested alternative:
In file included from /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/include/c++/cmath:44:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/wasm.h:47,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/usr/include/math.h:285:15: note:   ‘trunc’
 extern double trunc _PARAMS((double));
               ^
In file included from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h: In member function ‘wasm::Literal wasm::Literal::nearbyint() const’:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:389:42: error: ‘nearbyint’ is not a member of ‘std’
       case WasmType::f32: return Literal(std::nearbyint(getf32()));
                                          ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:389:42: note: suggested alternative:
In file included from /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/include/c++/cmath:44:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/wasm.h:47,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/usr/include/math.h:279:15: note:   ‘nearbyint’
 extern double nearbyint _PARAMS((double));
               ^
In file included from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:390:42: error: ‘nearbyint’ is not a member of ‘std’
       case WasmType::f64: return Literal(std::nearbyint(getf64()));
                                          ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:390:42: note: suggested alternative:
In file included from /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/include/c++/cmath:44:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/wasm.h:47,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/usr/include/math.h:279:15: note:   ‘nearbyint’
 extern double nearbyint _PARAMS((double));
               ^
In file included from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h: In member function ‘wasm::Literal wasm::Literal::min(const wasm::Literal&) const’:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:631:28: error: ‘isnan’ was not declared in this scope
         bool lnan = isnan(l), rnan = isnan(r);
                            ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:631:28: note: suggested alternative:
In file included from /cygdrive/d/src/webassembly/binaryen/src/wasm.h:47:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/include/c++/cmath:632:5: note:   ‘std::isnan’
     isnan(_Tp __x)
     ^
In file included from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:632:41: error: ‘rnan’ was not declared in this scope
         if (!isnan(result) && !lnan && !rnan) return Literal(result);
                                         ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:633:23: error: ‘rnan’ was not declared in this scope
         if (!lnan && !rnan) return Literal((int32_t)0x7fc00000).castToF32();
                       ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:640:28: error: ‘isnan’ was not declared in this scope
         bool lnan = isnan(l), rnan = isnan(r);
                            ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:640:28: note: suggested alternative:
In file included from /cygdrive/d/src/webassembly/binaryen/src/wasm.h:47:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/include/c++/cmath:632:5: note:   ‘std::isnan’
     isnan(_Tp __x)
     ^
In file included from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:641:41: error: ‘rnan’ was not declared in this scope
         if (!isnan(result) && !lnan && !rnan) return Literal(result);
                                         ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:642:23: error: ‘rnan’ was not declared in this scope
         if (!lnan && !rnan) return Literal((int64_t)0x7ff8000000000000LL).castToF64();
                       ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h: In member function ‘wasm::Literal wasm::Literal::max(const wasm::Literal&) const’:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:654:28: error: ‘isnan’ was not declared in this scope
         bool lnan = isnan(l), rnan = isnan(r);
                            ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:654:28: note: suggested alternative:
In file included from /cygdrive/d/src/webassembly/binaryen/src/wasm.h:47:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/include/c++/cmath:632:5: note:   ‘std::isnan’
     isnan(_Tp __x)
     ^
In file included from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:655:41: error: ‘rnan’ was not declared in this scope
         if (!isnan(result) && !lnan && !rnan) return Literal(result);
                                         ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:656:23: error: ‘rnan’ was not declared in this scope
         if (!lnan && !rnan) return Literal((int32_t)0x7fc00000).castToF32();
                       ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:663:28: error: ‘isnan’ was not declared in this scope
         bool lnan = isnan(l), rnan = isnan(r);
                            ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:663:28: note: suggested alternative:
In file included from /cygdrive/d/src/webassembly/binaryen/src/wasm.h:47:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/include/c++/cmath:632:5: note:   ‘std::isnan’
     isnan(_Tp __x)
     ^
In file included from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:664:41: error: ‘rnan’ was not declared in this scope
         if (!isnan(result) && !lnan && !rnan) return Literal(result);
                                         ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:665:23: error: ‘rnan’ was not declared in this scope
         if (!lnan && !rnan) return Literal((int64_t)0x7ff8000000000000LL).castToF64();
                       ^
/cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp: In lambda function:
/cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:46:39: error: ‘stoi’ is not a member of ‘std’
         o->debug = arguments.size() ? std::stoi(arguments) : 1;
                                       ^
CMakeFiles/support.dir/build.make:110: recipe for target 'CMakeFiles/support.dir/src/support/command-line.cpp.o' failed
make[2]: *** [CMakeFiles/support.dir/src/support/command-line.cpp.o] Error 1
CMakeFiles/Makefile2:178: recipe for target 'CMakeFiles/support.dir/all' failed
make[1]: *** [CMakeFiles/support.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

It failed. This is sad but I hope that there's a way to compile it under Cygwin/Windows. Of course I could easily switch to a *nix but just for the sake of learning I tried it under Windows.

Maybe I'm missing some important includes because the very first message complains about some methods not being found in namespace 'std'?

Kind regards,

Most helpful comment

Hi @kripken,

As promised, I wrote a small tutorial on building under Windows with CMake & VS2015.

I hope it'll be of some value to others with similar problems.

https://github.com/brakmic/brakmic/blob/master/webassembly/COMPILING_WIN32.md

Kind regards and many thanks :+1:

All 9 comments

Perhaps your c++ standard library isn't recent enough? Binaryen uses some c++11 features in both the language and the standard library.

Or, perhaps we need to set c++11 support explicitly for msvc? In the cmake file it looks like we do -std=c++11 for non-windows.

Hi @kripken,

I updated Cygwin and GCC to v.5.3.0 but still get the same error:

$ make
[  2%] Building CXX object CMakeFiles/support.dir/src/support/command-line.cpp.o
In file included from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h: In static member function ‘static void wasm::Literal::printFloat(std::ostream&, float)’:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:236:16: error: ‘isnan’ was not declared in this scope
     if (isnan(f)) {
                ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:236:16: note: suggested alternative:
In file included from /cygdrive/d/src/webassembly/binaryen/src/wasm.h:47:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/usr/lib/gcc/x86_64-pc-cygwin/5.3.0/include/c++/cmath:641:5: note:   ‘std::isnan’
     isnan(_Tp __x)
     ^
In file included from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h: In static member function ‘static void wasm::Literal::printDouble(std::ostream&, double)’:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:252:16: error: ‘isnan’ was not declared in this scope
     if (isnan(d)) {
                ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:252:16: note: suggested alternative:
In file included from /cygdrive/d/src/webassembly/binaryen/src/wasm.h:47:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/usr/lib/gcc/x86_64-pc-cygwin/5.3.0/include/c++/cmath:641:5: note:   ‘std::isnan’
     isnan(_Tp __x)
     ^
In file included from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h: In member function ‘wasm::Literal wasm::Literal::trunc() const’:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:382:42: error: ‘trunc’ is not a member of ‘std’
       case WasmType::f32: return Literal(std::trunc(getf32()));
                                          ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:382:42: note: suggested alternative:
In file included from /usr/lib/gcc/x86_64-pc-cygwin/5.3.0/include/c++/cmath:44:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/wasm.h:47,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/usr/include/math.h:285:15: note:   ‘trunc’
 extern double trunc _PARAMS((double));
               ^
In file included from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:383:42: error: ‘trunc’ is not a member of ‘std’
       case WasmType::f64: return Literal(std::trunc(getf64()));
                                          ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:383:42: note: suggested alternative:
In file included from /usr/lib/gcc/x86_64-pc-cygwin/5.3.0/include/c++/cmath:44:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/wasm.h:47,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/usr/include/math.h:285:15: note:   ‘trunc’
 extern double trunc _PARAMS((double));
               ^
In file included from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h: In member function ‘wasm::Literal wasm::Literal::nearbyint() const’:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:389:42: error: ‘nearbyint’ is not a member of ‘std’
       case WasmType::f32: return Literal(std::nearbyint(getf32()));
                                          ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:389:42: note: suggested alternative:
In file included from /usr/lib/gcc/x86_64-pc-cygwin/5.3.0/include/c++/cmath:44:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/wasm.h:47,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/usr/include/math.h:279:15: note:   ‘nearbyint’
 extern double nearbyint _PARAMS((double));
               ^
In file included from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:390:42: error: ‘nearbyint’ is not a member of ‘std’
       case WasmType::f64: return Literal(std::nearbyint(getf64()));
                                          ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:390:42: note: suggested alternative:
In file included from /usr/lib/gcc/x86_64-pc-cygwin/5.3.0/include/c++/cmath:44:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/wasm.h:47,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/usr/include/math.h:279:15: note:   ‘nearbyint’
 extern double nearbyint _PARAMS((double));
               ^
In file included from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h: In member function ‘wasm::Literal wasm::Literal::min(const wasm::Literal&) const’:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:631:28: error: ‘isnan’ was not declared in this scope
         bool lnan = isnan(l), rnan = isnan(r);
                            ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:631:28: note: suggested alternative:
In file included from /cygdrive/d/src/webassembly/binaryen/src/wasm.h:47:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/usr/lib/gcc/x86_64-pc-cygwin/5.3.0/include/c++/cmath:641:5: note:   ‘std::isnan’
     isnan(_Tp __x)
     ^
In file included from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:632:41: error: ‘rnan’ was not declared in this scope
         if (!isnan(result) && !lnan && !rnan) return Literal(result);
                                         ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:633:23: error: ‘rnan’ was not declared in this scope
         if (!lnan && !rnan) return Literal((int32_t)0x7fc00000).castToF32();
                       ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:640:28: error: ‘isnan’ was not declared in this scope
         bool lnan = isnan(l), rnan = isnan(r);
                            ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:640:28: note: suggested alternative:
In file included from /cygdrive/d/src/webassembly/binaryen/src/wasm.h:47:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/usr/lib/gcc/x86_64-pc-cygwin/5.3.0/include/c++/cmath:641:5: note:   ‘std::isnan’
     isnan(_Tp __x)
     ^
In file included from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:641:41: error: ‘rnan’ was not declared in this scope
         if (!isnan(result) && !lnan && !rnan) return Literal(result);
                                         ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:642:23: error: ‘rnan’ was not declared in this scope
         if (!lnan && !rnan) return Literal((int64_t)0x7ff8000000000000LL).castToF64();
                       ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h: In member function ‘wasm::Literal wasm::Literal::max(const wasm::Literal&) const’:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:654:28: error: ‘isnan’ was not declared in this scope
         bool lnan = isnan(l), rnan = isnan(r);
                            ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:654:28: note: suggested alternative:
In file included from /cygdrive/d/src/webassembly/binaryen/src/wasm.h:47:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/usr/lib/gcc/x86_64-pc-cygwin/5.3.0/include/c++/cmath:641:5: note:   ‘std::isnan’
     isnan(_Tp __x)
     ^
In file included from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:655:41: error: ‘rnan’ was not declared in this scope
         if (!isnan(result) && !lnan && !rnan) return Literal(result);
                                         ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:656:23: error: ‘rnan’ was not declared in this scope
         if (!lnan && !rnan) return Literal((int32_t)0x7fc00000).castToF32();
                       ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:663:28: error: ‘isnan’ was not declared in this scope
         bool lnan = isnan(l), rnan = isnan(r);
                            ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:663:28: note: suggested alternative:
In file included from /cygdrive/d/src/webassembly/binaryen/src/wasm.h:47:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/usr/lib/gcc/x86_64-pc-cygwin/5.3.0/include/c++/cmath:641:5: note:   ‘std::isnan’
     isnan(_Tp __x)
     ^
In file included from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.h:30:0,
                 from /cygdrive/d/src/webassembly/binaryen/src/support/command-line.cpp:17:
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:664:41: error: ‘rnan’ was not declared in this scope
         if (!isnan(result) && !lnan && !rnan) return Literal(result);
                                         ^
/cygdrive/d/src/webassembly/binaryen/src/wasm.h:665:23: error: ‘rnan’ was not declared in this scope
         if (!lnan && !rnan) return Literal((int64_t)0x7ff8000000000000LL).castToF64();
                       ^
CMakeFiles/support.dir/build.make:110: recipe for target 'CMakeFiles/support.dir/src/support/command-line.cpp.o' failed
make[2]: *** [CMakeFiles/support.dir/src/support/command-line.cpp.o] Error 1
CMakeFiles/Makefile2:178: recipe for target 'CMakeFiles/support.dir/all' failed
make[1]: *** [CMakeFiles/support.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

Here's my new GCC.

$ c++ -v
Using built-in specs.
COLLECT_GCC=c++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/5.3.0/lto-wrapper.exe
Target: x86_64-pc-cygwin
Configured with: /cygdrive/i/szsz/tmpp/gcc/gcc-5.3.0-3.x86_64/src/gcc-5.3.0/configure --srcdir=/cygdrive/i/szsz/tmpp/gcc/gcc-5.3.0-3.x86_64/src/gcc-5.3.0 --prefix=/usr --exec-prefix=/usr --localstatedir=/var --sysconfdir=/etc --docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C --build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin --without-libiconv-prefix --without-libintl-prefix --libexecdir=/usr/lib --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --enable-bootstrap --enable-__cxa_atexit --with-dwarf2 --with-tune=generic --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --enable-libcilkrts --enable-libgomp --enable-libitm --enable-libquadmath --enable-libquadmath-support --enable-libssp --enable-libada --enable-libgcj-sublibs --disable-java-awt --disable-symvers --with-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id --with-default-libstdcxx-abi=gcc4-compatible
Thread model: posix
gcc version 5.3.0 (GCC)

Maybe it would compile with MSVC toolchain? With a little help from CMake?

Hi again,

After my failure with Cygwin I tried it with CMake under Windows.
I used the CMake-GUI and defined the needed stuff (src folder, compiler version etc.). Generated the whole proj/sln files.

Now, it compiles under VS 2015. :smiley:

vs_binaryen

I'm not sure how many are using VS2015 to compile all this but if there's any interest I could write a small tutorial. Just to help others save their time (and prevent them from trying it with Cygwin under Windows :sweat_smile: )

Regards,

Hi @kripken,

As promised, I wrote a small tutorial on building under Windows with CMake & VS2015.

I hope it'll be of some value to others with similar problems.

https://github.com/brakmic/brakmic/blob/master/webassembly/COMPILING_WIN32.md

Kind regards and many thanks :+1:

Great!

Do you want to open a PR that adds a link to your tutorial, in the main readme? I think adding it there would make it easy for people to find.

Hi,

I'll open a new PR regarding the tutorial.

Regards,

Oddly, I'm getting this exact same build error on Arch Linux

Also fails in Ubuntu 16.04 64-bit, using g++ (Ubuntu 5.3.1-13ubuntu3) 5.3.1 20160330
The build is with -std=gnu++11

This is a namespace issue. isnan() and others exist in namespace std, so they're not seen by default. My workaround to get it to build was adding using namespace std; near the start of ~/.emscripten_ports/binaryen/binaryen-version_1/src/wasm.h, just before the namespace wasm { line. But, some people think that sort of thing is a bad idea: https://stackoverflow.com/questions/1452721/why-is-using-namespace-std-in-c-considered-bad-practice

So I guess the right solution is adding the std:: prefix where necessary?

@dreamlayers

Not a Ubuntu user but it could be related to this issue: https://github.com/WebAssembly/binaryen/pull/260

Was this page helpful?
0 / 5 - 0 ratings

Related issues

z2oh picture z2oh  Â·  4Comments

wycats picture wycats  Â·  14Comments

Becavalier picture Becavalier  Â·  4Comments

aheejin picture aheejin  Â·  3Comments

MaxGraey picture MaxGraey  Â·  7Comments