OSVR / OSVR-Core

The core libraries, applications, and plugins of the OSVR software platform.
Apache License 2.0
330 stars 124 forks source link

Fail to compile on mingw32 gcc 7.2 #570

Closed tomm closed 7 years ago

tomm commented 7 years ago

Master branch doesn't compile on msys2/mingw32, with gcc 7.2:

[ 12%] Building CXX object src/osvr/Common/CMakeFiles/osvrCommon.dir/AliasProcessor.cpp.obj In file included from C:/build/OSVR-Core/build/src/osvr/Util/Verbosity.h:43:0, from C:\build\OSVR-Core\src\osvr\Common\AliasProcessor.cpp:32: C:/build/OSVR-Core/inc/osvr/Util/Logger.h:206:49: error: function 'const string& osvr::util::log::Logger::getName() const' definition is marked dllimport OSVR_UTIL_EXPORT std::string const &getName() const { ^~~ mingw32-make[2]: [src\osvr\Common\CMakeFiles\osvrCommon.dir\build.make:88: src/osvr/Common/CMakeFiles/osvrCommon.dir/AliasProcessor.cpp.obj] Error 1 mingw32-make[1]: [CMakeFiles\Makefile2:1729: src/osvr/Common/CMakeFiles/osvrCommon.dir/all] Error 2 mingw32-make: *** [Makefile:162: all] Error 2

rpavlik commented 7 years ago

Hmm. From just looking at the error, I'd suspect that there's an inline function there (or at least one with the definition within the class declaration) and newer gcc presumably doesn't like dllimport on such functions. (Strangely, I thought I saw, and fixed, this class of error before: maybe it just got stricter, or it was a fix not backed by CI, such as a MinGW build... I have built using this environment in the past, but it was some time ago so both the OSVR code base and msys2 environment have advanced.).

Could you try removing the OSVR_UTIL_EXPORT from that function and see if it makes it past? (There may be others in the same file that need the same fix: responding without having the source open at the moment.)

If so, that should be an easy fix then: would welcome a pull request (for this and any other like it), otherwise I'll make the change when I get a chance.

rpavlik commented 7 years ago

Ah, so I actually do have a patch for this in a local branch. I'll push it for review today.

rpavlik commented 7 years ago

If you can check and see if #574 builds for you, that would be great. (and I'll get around to upgrading my local MSYS2 install here...)