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

Problems during compilation of Poco on Windows with MinGW and Cywgin #1071

Closed
Sujamm opened this issue Dec 9, 2015 · 21 comments
Closed

Problems during compilation of Poco on Windows with MinGW and Cywgin #1071

Sujamm opened this issue Dec 9, 2015 · 21 comments
Assignees
Labels

Comments

@Sujamm
Copy link

Sujamm commented Dec 9, 2015

Hi,

I have a project in Qt that works perfectly with Poco libs on linux, I needed to test this project on Windows, so I install Poco on Windows (Virtual Machine).

First I use Cygwin to compile it and the installation ended perfectly with no error what so ever, how ever when I try to run my project I got so errors that let me believe that something when wrong during the installation of Poco.

Here are the errors I'm getting

C:\cygwin\usr\include\Poco\FPEnvironment_WIN32.h:55: error: '_RC_DOWN' 
was not declared in this scope
   FP_ROUND_DOWNWARD_IMPL   = _RC_DOWN
C:\cygwin\usr\include\Poco\FPEnvironment_WIN32.h:56: error: '_RC_UP' 
was not declared in this scope
   FP_ROUND_UPWARD_IMPL     = _RC_UP

C:\cygwin\usr\include\Poco\FPEnvironment_WIN32.h:57: error: '_RC_NEAR' 
was not declared in this scope
    FP_ROUND_TONEAREST_IMPL  = _RC_NEAR

C:\cygwin\usr\include\Poco\FPEnvironment_WIN32.h:58: error: '_RC_CHOP' 
was not declared in this scope
   FP_ROUND_TOWARDZERO_IMPL = _RC_CHOP

C:\cygwin\usr\include\Poco\FPEnvironment_WIN32.h:-1: In static member function 'static bool 
Poco::FPEnvironmentImpl::isInfiniteImpl(float)':

C:\cygwin\usr\include\Poco\FPEnvironment_WIN32.h:97: error: '_finite' 
was not declared in this scope
  return _finite(value) == 0;
C:\cygwin\usr\include\Poco\FPEnvironment_WIN32.h:-1: In static member function 'static bool 
Poco::FPEnvironmentImpl::isInfiniteImpl(double)':

C:\cygwin\usr\include\Poco\FPEnvironment_WIN32.h:103: error: '_finite' 
was not declared in this scope
  return _finite(value) == 0;

C:\cygwin\usr\include\Poco\FPEnvironment_WIN32.h:-1: In static member function 'static bool 
Poco::FPEnvironmentImpl::isInfiniteImpl(long double)':

C:\cygwin\usr\include\Poco\FPEnvironment_WIN32.h:109: error: '_finite' 
was not declared in this scope
  return _finite(value) == 0;

C:\cygwin\usr\include\Poco\FPEnvironment_WIN32.h:-1: In static member function 'static bool 
Poco::FPEnvironmentImpl::isNaNImpl(float)':

C:\cygwin\usr\include\Poco\FPEnvironment_WIN32.h:115: error: '_isnan' 
was not declared in this scope
  return _isnan(value) != 0;

C:\cygwin\usr\include\Poco\FPEnvironment_WIN32.h:-1: In static member function 'static bool 
Poco::FPEnvironmentImpl::isNaNImpl(double)':

C:\cygwin\usr\include\Poco\FPEnvironment_WIN32.h:121: error: '_isnan' 
was not declared in this scope
    return _isnan(value) != 0;

C:\cygwin\usr\include\Poco\FPEnvironment_WIN32.h:-1: In static member function 'static bool 
Poco::FPEnvironmentImpl::isNaNImpl(long double)':

C:\cygwin\usr\include\Poco\FPEnvironment_WIN32.h:127: error: '_isnan' 
was not declared in this scope
  return _isnan(value) != 0;

I also compiled with MinGW, same-thing happened the instalation ended perfectly but when I try to run my project I got the same error.

Any ideas on what could be causing this error ??

@zosrothko
Copy link
Member

@Alicech
Poco is not validated with MinGW
How did you produce and install Poco on Cygwin? Cmake or GNU Make?
What steps did you execute to build/install Poco?

@Sujamm
Copy link
Author

Sujamm commented Dec 10, 2015

When I install Cygwin it shows me a list of libs that Cygwin could install during it's installation and Poco was one of those, I simply selected Poco and click next.

And I read in a stackoverflow that Poco could compile with MinGW here it's the link I follow to install with MinGW: http://stackoverflow.com/questions/14637797/compile-poco-with-mingw-on-windows

@aleks-f
Copy link
Member

aleks-f commented Dec 10, 2015

It will compile with MinGW, people come from time to time, contribute patches and disappear. But that build is not actively maintained

@Sujamm
Copy link
Author

Sujamm commented Dec 10, 2015

ok, so what do you suggest I do ?? How can I compile Poco to make sure it works on windows ??

@aleks-f
Copy link
Member

aleks-f commented Dec 10, 2015

There are many ways, the simplest one being (1) opening each Visual Studio individual solution and building it (VS can be obtained free these days, I hear). Then, there are (2) batch and (3) PowerShell (still somewhat experimental) build scripts as well as (4) CMake support. Note that all of these build using Visual Studio on windows, currently we support it back to 2008 but that will go up to 2012 in the next release. Last but not least, it is not a bad idea to read some documentation, too ;)

@zosrothko
Copy link
Member

There are 2 targets platforms of Poco under a Window system:

either using Cygwin but the whole application using Poco will be a Linux based application running above Windows within the Cygwin container

either using VisualStudio and native Win32/x64 API and the whole application will be a WIndows aplication

The error you reported:
C:\cygwin\usr\include\Poco\FPEnvironment_WIN32.h:55: error: '_RC_DOWN'
was not declared in this scope
FP_ROUND_DOWNWARD_IMPL = _RC_DOWN

shows that you are using/compiling your application using the Cygwin distribution but targeted to a Windows platform which cannot work.
(C:\cygwin shows the Cygwin distribution of Poco, while FPEnvironment_WIN32.h shows the target compilation platform Windows, which results from defining the constants
#elif defined(_WIN32) || defined(_WIN64)
#define POCO_OS_FAMILY_WINDOWS 1

Have a look into C:\cygwin\usr\include\Poco\Platform.h

@Sujamm
Copy link
Author

Sujamm commented Dec 10, 2015

Ok, I understand the error now, and yes that's what I'm doing @zosrothko, so I'm going to try to compile with VS. Thanks

@Sujamm
Copy link
Author

Sujamm commented Dec 10, 2015

Hi, so I try to build Poco in the Command Prompt of Visual Studio.
I run this command line to build it: buildwin.cmd 100 build static_mt both x64 samples tests msbuild

But I'm getting an error with the WinTestRunner_x64_vs100.vcxproj

1>obj64\debug_static_mt\WinTestRunner.res : fatal error LNK1123: failure d
   uring conversion to COFF: file invalid or corrupt [C:\Users\admin\Downlo
   ads\poco-1.6.1\CppUnit\WinTestRunner\WinTestRunner_x64_vs100.vcxproj]
 1>Compilación del proyecto terminada "C:\Users\admin\Downloads\poco-1.6.1\
   CppUnit\WinTestRunner\WinTestRunner_x64_vs100.vcxproj" (build destinos)
   -- ERROR.

ERROR al compilar.

   "C:\Users\admin\Downloads\poco-1.6.1\CppUnit\WinTestRunner\WinTestRunner
   _x64_vs100.vcxproj" (build destino) (1) ->
   (Lib destino) ->
     obj64\debug_static_mt\WinTestRunner.res : fatal error LNK1123: failure
    during conversion to COFF: file invalid or corrupt [C:\Users\admin\Down
   loads\poco-1.6.1\CppUnit\WinTestRunner\WinTestRunner_x64_vs100.vcxproj]

Again not idea why I'm getting this error, I try removing CppUnit and CppUnit\WinTestRunner from the components file but I kept getting the same error.

@aleks-f
Copy link
Member

aleks-f commented Dec 11, 2015

Check your environment: VS2012 RC installation breaks VS2010 C++ projects

@Sujamm
Copy link
Author

Sujamm commented Dec 11, 2015

Ok I'm going to check that, one quick question, Poco could be build in Visual Studio 2015 ?? or what it's the newest version of VS that supports poco ??

@obiltschnig
Copy link
Member

2015 is fine, although all versions back to 2008 work.

@Sujamm
Copy link
Author

Sujamm commented Dec 18, 2015

I was seen which file to run in VS 2015 to compile poco, I was thinking about using the buildwin.cmd and pass the parameters, because I don't seem to find the one for VS 2015, so it will be something like this

buildwin.cmd 140 build static_mt both Win32 samples tests msbuild

it's this the correct way to do it for VS 2015 ?? Because I try to compile it in VS 2010 but it didn't work with Qt creator and c++14 when I added the libs. So I'm not sure if it was something I did in the compilation.

@zosrothko
Copy link
Member

You can also install poco-1.6.1 with the VS2013 msi installer located here
https://github.com/pocoproject/distro/releases/download/Poco-1.6.1/VS2013.Poco.1.6.1.x86.msi

@Sujamm
Copy link
Author

Sujamm commented Dec 21, 2015

No matter how I compile poco I'm still getting the same error when I try to run my qt project.

C:\poco-1.6.1\include\Poco\FPEnvironment_WIN32.h:55: 
error: '_RC_DOWN' was not declared in this scope
   FP_ROUND_DOWNWARD_IMPL   = _RC_DOWN,

C:\poco-1.6.1\include\Poco\FPEnvironment_WIN32.h:56: 
error: '_RC_UP' was not declared in this scope
   FP_ROUND_UPWARD_IMPL     = _RC_UP

C:\poco-1.6.1\include\Poco\FPEnvironment_WIN32.h:57:
 error: '_RC_NEAR'  was not declared in this scope
    FP_ROUND_TONEAREST_IMPL  = _RC_NEAR

C:\poco-1.6.1\include\Poco\FPEnvironment_WIN32.h:58: 
error: '_RC_CHOP' was not declared in this scope
   FP_ROUND_TOWARDZERO_IMPL = _RC_CHOP

C:\poco-1.6.1\include\Poco\FPEnvironment_WIN32.h:-1: 
In static member function 'static bool 
Poco::FPEnvironmentImpl::isInfiniteImpl(float)':

 C:\poco-1.6.1\include\Poco\FPEnvironment_WIN32.h97: 
error: '_finite' was not declared in this scope
   return _finite(value) == 0;

C:\poco-1.6.1\include\Poco\FPEnvironment_WIN32.h:-1: 
In static member function 'static bool 
Poco::FPEnvironmentImpl::isInfiniteImpl(double)':

C:\poco-1.6.1\include\Poco\FPEnvironment_WIN32.h:103:
error: '_finite' was not declared in this scope
  return _finite(value) == 0;

 C:\poco-1.6.1\include\Poco\FPEnvironment_WIN32.h:-1:
 In static member function 'static bool 
 Poco::FPEnvironmentImpl::isInfiniteImpl(long double)':

C:\poco-1.6.1\include\Poco\FPEnvironment_WIN32.h:109: 
error: '_finite' was not declared in this scope
  return _finite(value) == 0;

 C:\poco-1.6.1\include\Poco\FPEnvironment_WIN32.h:-1: 
 In static member function 'static bool 
 Poco::FPEnvironmentImpl::isNaNImpl(float)':

 C:\poco-1.6.1\include\Poco\FPEnvironment_WIN32.h115: 
 error: '_isnan'  was not declared in this scope
    return _isnan(value) != 0;

 C:\poco-1.6.1\include\Poco\FPEnvironment_WIN32.h:-1: 
 In static member function 'static bool 
 Poco::FPEnvironmentImpl::isNaNImpl(double)':

C:\poco-1.6.1\include\Poco\FPEnvironment_WIN32.h121: 
error: '_isnan' was not declared in this scope
    return _isnan(value) != 0;

C:\poco-1.6.1\include\Poco\FPEnvironment_WIN32.h:-1: 
In static member function 'static bool 
Poco::FPEnvironmentImpl::isNaNImpl(long double)':

C:\poco-1.6.1\include\Poco\FPEnvironment_WIN32.h:127: 
error: '_isnan' was not declared in this scope
  return _isnan(value) != 0;

I compile poco with VS2015 and got this error, then I try with the .msi that @zosrothko suggested and got the same error. It's there a problem with qt creator and poco (for windows)??

@aleks-f
Copy link
Member

aleks-f commented Dec 21, 2015

Those are all defined/declared in <float.h> and poco obviously has no problem finding them. This is probably a question for QT forum, but I'd suggest to make sure that your build environment sees C:\Program Files (x86)\Windows Kits\10\Include\10.0.10150.0\ucrt\? That's where that header is.

@Sujamm Sujamm closed this as completed Dec 24, 2015
@ongbe
Copy link

ongbe commented Dec 30, 2015

the same question

$ gcc -v
Using built-in specs.
COLLECT_GCC=F:\tc\msys2\mingw32\bin\gcc.exe
COLLECT_LTO_WRAPPER=F:/tc/msys2/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.2.0/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: ../gcc-5.2.0/configure --prefix=/mingw32 --with-local-prefix=/mingw32/local --build=i686-w64-mingw32 --host=i686-w64-mingw32 --target=i686-w64-mingw32 --with-native-system-header-dir=/mingw32/i686-w64-mingw32/include --libexecdir=/mingw32/lib --with-gxx-include-dir=/mingw32/include/c++/5.2.0 --enable-bootstrap --with-arch=i686 --with-tune=generic --enable-languages=c,lto,c++,objc,obj-c++,fortran,ada --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-version-specific-runtime-libs --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw32 --with-mpfr=/mingw32 --with-mpc=/mingw32 --with-isl=/mingw32 --with-pkgversion='Rev4, Built by MSYS2 project' --with-bugurl=http://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld --disable-sjlj-exceptions --with-dwarf2
Thread model: posix
gcc version 5.2.0 (Rev4, Built by MSYS2 project)

@DaJunkie
Copy link

I solved this issue, using this UNdefinition: -U__STRICT_ANSI__
This hurts a lot.

@zosrothko
Copy link
Member

@DaJunkie What do you mean by "This hurts a lot."?

@DaJunkie
Copy link

DaJunkie commented Jun 15, 2016

@zosrothko I do not want to do things like that. It feels wrong. It is against my sense for aesthetics. Not meant offending.

I would be lucky if you could find some better solution. iirc I did not need to do that in Poco 1.4.6p4.

And I just read this: "Written in efficient, modern, 100% ANSI/ISO Standard C++." I think this not anymore correct.

@TotteKarlsson
Copy link

I'm having the same error trying to compile Poco 1.7.4 using Borlands CLANG compiler. Any pointers how to get past this error? I tried the undef mentioned above but that did not work.

@bigfatbrowncat
Copy link

bigfatbrowncat commented Sep 29, 2016

Thank you, @DaJunkie. -U__STRICT_ANSI__ works like a charm. I have to say that the compilation works without this undefinition on old C++ standard. The problem appears after you specify -std=c++11.

It looks like the standard library became more strict after enabling C++11 standard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants