[cfe-dev] Clang inconsistency with gcc on Windows
Edward Diener
eldlistmailingz at tropicsoft.com
Sun May 31 11:06:08 PDT 2015
On 5/31/2015 1:48 PM, Edward Diener wrote:
I have added the compiler command lines to my original message.
> Compiling some Boost library code the latest clang has produced an
> inconsistency with gcc on Windows that is making it impossible to build
> Boost libraries successfully.
>
> The code in question, where clang is given an error:
>
>> clang-linux.compile.c++.without-pth
>> ..\..\..\bin.v2\libs\context\build\clang-linux-3.7.0\debug\threading-multi\windows\stack_traits.obj
>>
>> In file included from
>> ..\..\..\libs\context\src\windows\stack_traits.cpp:24:
>> In file included from ..\..\..\boost/thread.hpp:13:
>> In file included from ..\..\..\boost/thread/thread.hpp:12:
>> In file included from ..\..\..\boost/thread/thread_only.hpp:15:
>> In file included from ..\..\..\boost/thread/win32/thread_data.hpp:10:
>> In file included from ..\..\..\boost/thread/thread_time.hpp:10:
>> In file included from
>> ..\..\..\boost/date_time/microsec_time_clock.hpp:23:
>> ..\..\..\boost/date_time/filetime_functions.hpp:57:46: error:
>> conflicting types for 'GetSystemTimeAsFileTime'
>> __declspec(dllimport) void __stdcall
>> GetSystemTimeAsFileTime(FILETIME* lpFileTime);
>> ^
>> /mingw/include\winbase.h:1397:24: note: previous declaration is here
>> WINBASEAPI void WINAPI GetSystemTimeAsFileTime(LPFILETIME);
> ^
>
> and more of the same in many places building Boost libraries with clang.
The clang command line is:
"C:/Programming/VersionControl/bninja_installed_clang/bin/clang++.exe"
-c -x c++ -O0 -g -fno-inline -Wall -g -march=i686 -pthread -m32
-DBOOST_ALL_NO_LIB=1 -DBOOST_CHRONO_DYN_LINK=1
-DBOOST_CONTEXT_DYN_LINK=1 -DBOOST_CONTEXT_SOURCE
-DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_SYSTEM_NO_DEPRECATED
-DBOOST_THREAD_BUILD_DLL=1 -DBOOST_THREAD_USE_DLL=1 -I"..\..\.." -o
"..\..\..\bin.v2\libs\context\build\clang-linux-3.7.0\debug\threading-multi\windows\stack_traits.obj"
"..\..\..\libs\context\src\windows\stack_traits.cpp"
>
> This is with the latest clang, which I build with mingw/gcc-4.8.1 on
> Windows.
>
> With gcc-4.8.1:
>
>> gcc.compile.c++
>> ..\..\..\bin.v2\libs\context\build\gcc-mingw-4.8.1\debug\threading-multi\windows\stack_traits.o
>>
>
The gcc-4.8.1 command line is:
"g++" -ftemplate-depth-128 -O0 -fno-inline -Wall -g -march=i686
-mthreads -m32 -DBOOST_ALL_NO_LIB=1 -DBOOST_CHRONO_DYN_LINK=1
-DBOOST_CONTEXT_DYN_LINK=1 -DBOOST_CONTEXT_SOURCE
-DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_SYSTEM_NO_DEPRECATED
-DBOOST_THREAD_BUILD_DLL=1 -DBOOST_THREAD_USE_DLL=1 -I"..\..\.." -c -o
"..\..\..\bin.v2\libs\context\build\gcc-mingw-4.8.1\debug\threading-multi\windows\stack_traits.o"
"..\..\..\libs\context\src\windows\stack_traits.cpp"
> With gcc-4.9.2
>
>> gcc.compile.c++
>> ..\..\..\bin.v2\libs\context\build\gcc-mingw-4.9.2\debug\threading-multi\windows\stack_traits.o
>>
>
The gcc-4.9.2 command line is:
"g++" -ftemplate-depth-128 -O0 -fno-inline -Wall -g -march=i686
-mthreads -m32 -DBOOST_ALL_NO_LIB=1 -DBOOST_CHRONO_DYN_LINK=1
-DBOOST_CONTEXT_DYN_LINK=1 -DBOOST_CONTEXT_SOURCE
-DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_SYSTEM_NO_DEPRECATED
-DBOOST_THREAD_BUILD_DLL=1 -DBOOST_THREAD_USE_DLL=1 -I"..\..\.." -c -o
"..\..\..\bin.v2\libs\context\build\gcc-mingw-4.9.2\debug\threading-multi\windows\stack_traits.o"
"..\..\..\libs\context\src\windows\stack_traits.cpp"
> This is happening extensively in Boost code which uses the Windows API
> when compiling under Windows.
>
> I do not know what WINBASEAPI is supposed to resove to under mingw, but
> clearly it should not be different for gcc and clang under Windows and
> gcc has no problems with this.
More information about the cfe-dev
mailing list