[libc++] Compiling with MinGW-w64

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[libc++] Compiling with MinGW-w64

Richard Pennington via cfe-dev

Hello,

I'm planing to get libc++ compiling with MinGW-w64, right now without patches it fails with:

CMake Error at projects/libcxx/CMakeLists.txt:396 (message):
  C++11 or greater is required but the compiler does not support c++11

It is caused by adding `-nodefaultlibs` flag (it passes it's own check [1]). However many following checks fail due to undefined references, results with gcc [2] and clang [3].

Hard-coding 0 for LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG allows it go finish configuration and fail during build (that's another story).

`-nodefaultlibs` appears several times in libc++ and libc++abi code and I'm not sure about cleanest way to fix/workaround it.

Any suggestions?


[1] https://github.com/llvm-mirror/libcxx/blob/master/cmake/config-ix.cmake#L27

[2] https://reviews.llvm.org/P7975

[3] https://reviews.llvm.org/P7976


Thanks,

Mateusz


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [libc++] Compiling with MinGW-w64

Richard Pennington via cfe-dev


On Fri, Mar 17, 2017 at 4:34 PM, Mateusz Mikuła via cfe-dev <[hidden email]> wrote:

Hello,

I'm planing to get libc++ compiling with MinGW-w64, right now without patches it fails with:

CMake Error at projects/libcxx/CMakeLists.txt:396 (message):
  C++11 or greater is required but the compiler does not support c++11

It is caused by adding `-nodefaultlibs` flag (it passes it's own check [1]). However many following checks fail due to undefined references, results with gcc [2] and clang [3].

CMake seems to be adding system libraries automagically. Specifically it adds  -lgcc_s -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32.
I'm guessing that these libraries are where the undefined symbols are coming from, and I suspect the correct fix is to somehow prevent CMake from adding them.



Hard-coding 0 for LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG allows it go finish configuration and fail during build (that's another story).

`-nodefaultlibs` appears several times in libc++ and libc++abi code and I'm not sure about cleanest way to fix/workaround it.

Any suggestions?


[1] https://github.com/llvm-mirror/libcxx/blob/master/cmake/config-ix.cmake#L27

[2] https://reviews.llvm.org/P7975

[3] https://reviews.llvm.org/P7976


Thanks,

Mateusz


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [libc++] Compiling with MinGW-w64

Richard Pennington via cfe-dev

 Yes, logs come from unmodified build of in-tree build of libc++.

Here is NODEFAULTLIBS check

Performing C++ SOURCE FILE Test LIBCXXABI_HAS_NODEFAULTLIBS_FLAG succeeded with the following output:
Change Dir: D:/projekty/msys2/MINGW-packages/mingw-w64-clang/src/build-i686/CMakeFiles/CMakeTmp

Run Build Command:"D:/msys64/usr/bin/make.exe" "cmTC_a0b32/fast"
/usr/bin/make -f CMakeFiles/cmTC_a0b32.dir/build.make CMakeFiles/cmTC_a0b32.dir/build
make[1]: Entering directory '/d/projekty/msys2/MINGW-packages/mingw-w64-clang/src/build-i686/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_a0b32.dir/src.cxx.obj
/D/msys64/mingw32/bin/g++.exe     -D_GNU_SOURCE -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -Werror=date-time -std=gnu++11 -DLIBCXXABI_HAS_NODEFAULTLIBS_FLAG   -nodefaultlibs -o CMakeFiles/cmTC_a0b32.dir/src.cxx.obj -c /D/projekty/msys2/MINGW-packages/mingw-w64-clang/src/build-i686/CMakeFiles/CMakeTmp/src.cxx
Linking CXX executable cmTC_a0b32.exe
/D/msys64/mingw32/bin/cmake.exe -E remove -f CMakeFiles/cmTC_a0b32.dir/objects.a
/D/msys64/mingw32/bin/ar.exe cr CMakeFiles/cmTC_a0b32.dir/objects.a "CMakeFiles/cmTC_a0b32.dir/src.cxx.obj"
/D/msys64/mingw32/bin/g++.exe  -D_GNU_SOURCE -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -Werror=date-time -std=gnu++11 -DLIBCXXABI_HAS_NODEFAULTLIBS_FLAG  -pipe -Wl,--stack,16777216  -Wl,--whole-archive CMakeFiles/cmTC_a0b32.dir/objects.a -Wl,--no-whole-archive  -o cmTC_a0b32.exe -Wl,--major-image-version,0,--minor-image-version,0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
make[1]: Leaving directory '/d/projekty/msys2/MINGW-packages/mingw-w64-clang/src/build-i686/CMakeFiles/CMakeTmp'

Source file was:
int main() { return 0; }


I'll try out of tree build soon.


------ Original Message ------
Subject: Re: [cfe-dev] [libc++] Compiling with MinGW-w64
Date: Thu, 23 Mar 2017 02:34:09 -0600
To: Mateusz Mikuła
From: Eric Fiselier
Just to verify you're not manually adding any of the following libraries, right?

-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
/Eric

On Wed, Mar 22, 2017 at 7:04 PM, Eric Fiselier <[hidden email]> wrote:


On Fri, Mar 17, 2017 at 4:34 PM, Mateusz Mikuła via cfe-dev <[hidden email]> wrote:

Hello,

I'm planing to get libc++ compiling with MinGW-w64, right now without patches it fails with:

CMake Error at projects/libcxx/CMakeLists.txt:396 (message):
  C++11 or greater is required but the compiler does not support c++11

It is caused by adding `-nodefaultlibs` flag (it passes it's own check [1]). However many following checks fail due to undefined references, results with gcc [2] and clang [3].

CMake seems to be adding system libraries automagically. Specifically it adds  -lgcc_s -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32.
I'm guessing that these libraries are where the undefined symbols are coming from, and I suspect the correct fix is to somehow prevent CMake from adding them.



Hard-coding 0 for LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG allows it go finish configuration and fail during build (that's another story).

`-nodefaultlibs` appears several times in libc++ and libc++abi code and I'm not sure about cleanest way to fix/workaround it.

Any suggestions?


[1] https://github.com/llvm-mirror/libcxx/blob/master/cmake/config-ix.cmake#L27

[2] https://reviews.llvm.org/P7975

[3] https://reviews.llvm.org/P7976


Thanks,

Mateusz


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev





_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [libc++] Compiling with MinGW-w64

Richard Pennington via cfe-dev


On Thu, Mar 23, 2017 at 4:55 AM, Mateusz Mikuła <[hidden email]> wrote:

 Yes, logs come from unmodified build of in-tree build of libc++.

Here is NODEFAULTLIBS check

Performing C++ SOURCE FILE Test LIBCXXABI_HAS_NODEFAULTLIBS_FLAG succeeded with the following output:
Change Dir: D:/projekty/msys2/MINGW-packages/mingw-w64-clang/src/build-i686/CMakeFiles/CMakeTmp

Run Build Command:"D:/msys64/usr/bin/make.exe" "cmTC_a0b32/fast"
/usr/bin/make -f CMakeFiles/cmTC_a0b32.dir/build.make CMakeFiles/cmTC_a0b32.dir/build
[1;34mmake[1]: [0m Entering directory '/d/projekty/msys2/MINGW-packages/mingw-w64-clang/src/build-i686/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_a0b32.dir/src.cxx.obj
/D/msys64/mingw32/bin/g++.exe     -D_GNU_SOURCE -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -Werror=date-time -std=gnu++11 -DLIBCXXABI_HAS_NODEFAULTLIBS_FLAG   -nodefaultlibs -o CMakeFiles/cmTC_a0b32.dir/src.cxx.obj -c /D/projekty/msys2/MINGW-packages/mingw-w64-clang/src/build-i686/CMakeFiles/CMakeTmp/src.cxx
Linking CXX executable cmTC_a0b32.exe
/D/msys64/mingw32/bin/cmake.exe -E remove -f CMakeFiles/cmTC_a0b32.dir/objects.a
/D/msys64/mingw32/bin/ar.exe cr CMakeFiles/cmTC_a0b32.dir/objects.a "CMakeFiles/cmTC_a0b32.dir/src.cxx.obj"
/D/msys64/mingw32/bin/g++.exe  -D_GNU_SOURCE -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -Werror=date-time -std=gnu++11 -DLIBCXXABI_HAS_NODEFAULTLIBS_FLAG  -pipe -Wl,--stack,16777216  -Wl,--whole-archive CMakeFiles/cmTC_a0b32.dir/objects.a -Wl,--no-whole-archive  -o cmTC_a0b32.exe -Wl,--major-image-version,0,--minor-image-version,0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
[1;34mmake[1]: [0m Leaving directory '/d/projekty/msys2/MINGW-packages/mingw-w64-clang/src/build-i686/CMakeFiles/CMakeTmp'

Source file was:
int main() { return 0; }


I'll try out of tree build soon.

I don't think that will make a difference. LLVM isn't adding these libraries AFAIK. They must be getting automatically added by CMake.
Can you check if they're getting added via "CMAKE_REQUIRED_LIBRARIES"?

I've been looking for CMake documentation about this but I can't find anything.

/Eric




------ Original Message ------
Subject: Re: [cfe-dev] [libc++] Compiling with MinGW-w64
Date: Thu, 23 Mar 2017 02:34:09 -0600
To: Mateusz Mikuła
From: Eric Fiselier
Just to verify you're not manually adding any of the following libraries, right?

-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
/Eric

On Wed, Mar 22, 2017 at 7:04 PM, Eric Fiselier <[hidden email]> wrote:


On Fri, Mar 17, 2017 at 4:34 PM, Mateusz Mikuła via cfe-dev <[hidden email]> wrote:

Hello,

I'm planing to get libc++ compiling with MinGW-w64, right now without patches it fails with:

CMake Error at projects/libcxx/CMakeLists.txt:396 (message):
  C++11 or greater is required but the compiler does not support c++11

It is caused by adding `-nodefaultlibs` flag (it passes it's own check [1]). However many following checks fail due to undefined references, results with gcc [2] and clang [3].

CMake seems to be adding system libraries automagically. Specifically it adds  -lgcc_s -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32.
I'm guessing that these libraries are where the undefined symbols are coming from, and I suspect the correct fix is to somehow prevent CMake from adding them.



Hard-coding 0 for LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG allows it go finish configuration and fail during build (that's another story).

`-nodefaultlibs` appears several times in libc++ and libc++abi code and I'm not sure about cleanest way to fix/workaround it.

Any suggestions?


[1] https://github.com/llvm-mirror/libcxx/blob/master/cmake/config-ix.cmake#L27

[2] https://reviews.llvm.org/P7975

[3] https://reviews.llvm.org/P7976


Thanks,

Mateusz


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev






_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [libc++] Compiling with MinGW-w64

Richard Pennington via cfe-dev
In PKGBUILD you can see patches for libc++ but they were developed after asking on cfe-dev.

I'll check "CMAKE_REQUIRED_LIBRARIES" when I return home.


------ Original Message ------
Subject: Re: [cfe-dev] [libc++] Compiling with MinGW-w64
Date: Thu, 23 Mar 2017 05:31:02 -0600
To: Mateusz Mikuła
From: Eric Fiselier
Also what's your exact CMake invocation?

/Eric

On Thu, Mar 23, 2017 at 5:29 AM, Eric Fiselier <[hidden email]> wrote:


On Thu, Mar 23, 2017 at 4:55 AM, Mateusz Mikuła <[hidden email]> wrote:

 Yes, logs come from unmodified build of in-tree build of libc++.

Here is NODEFAULTLIBS check

Performing C++ SOURCE FILE Test LIBCXXABI_HAS_NODEFAULTLIBS_FLAG succeeded with the following output:
Change Dir: D:/projekty/msys2/MINGW-packages/mingw-w64-clang/src/build-i686/CMakeFiles/CMakeTmp

Run Build Command:"D:/msys64/usr/bin/make.exe" "cmTC_a0b32/fast"
/usr/bin/make -f CMakeFiles/cmTC_a0b32.dir/build.make CMakeFiles/cmTC_a0b32.dir/build
[1;34mmake[1]: [0m Entering directory '/d/projekty/msys2/MINGW-packages/mingw-w64-clang/src/build-i686/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_a0b32.dir/src.cxx.obj
/D/msys64/mingw32/bin/g++.exe     -D_GNU_SOURCE -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -Werror=date-time -std=gnu++11 -DLIBCXXABI_HAS_NODEFAULTLIBS_FLAG   -nodefaultlibs -o CMakeFiles/cmTC_a0b32.dir/src.cxx.obj -c /D/projekty/msys2/MINGW-packages/mingw-w64-clang/src/build-i686/CMakeFiles/CMakeTmp/src.cxx
Linking CXX executable cmTC_a0b32.exe
/D/msys64/mingw32/bin/cmake.exe -E remove -f CMakeFiles/cmTC_a0b32.dir/objects.a
/D/msys64/mingw32/bin/ar.exe cr CMakeFiles/cmTC_a0b32.dir/objects.a "CMakeFiles/cmTC_a0b32.dir/src.cxx.obj"
/D/msys64/mingw32/bin/g++.exe  -D_GNU_SOURCE -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -Werror=date-time -std=gnu++11 -DLIBCXXABI_HAS_NODEFAULTLIBS_FLAG  -pipe -Wl,--stack,16777216  -Wl,--whole-archive CMakeFiles/cmTC_a0b32.dir/objects.a -Wl,--no-whole-archive  -o cmTC_a0b32.exe -Wl,--major-image-version,0,--minor-image-version,0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
[1;34mmake[1]: [0m Leaving directory '/d/projekty/msys2/MINGW-packages/mingw-w64-clang/src/build-i686/CMakeFiles/CMakeTmp'

Source file was:
int main() { return 0; }


I'll try out of tree build soon.

I don't think that will make a difference. LLVM isn't adding these libraries AFAIK. They must be getting automatically added by CMake.
Can you check if they're getting added via "CMAKE_REQUIRED_LIBRARIES"?

I've been looking for CMake documentation about this but I can't find anything.

/Eric




------ Original Message ------
Subject: Re: [cfe-dev] [libc++] Compiling with MinGW-w64
Date: Thu, 23 Mar 2017 02:34:09 -0600
To: Mateusz Mikuła
From: Eric Fiselier
Just to verify you're not manually adding any of the following libraries, right?

-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
/Eric

On Wed, Mar 22, 2017 at 7:04 PM, Eric Fiselier <[hidden email]> wrote:


On Fri, Mar 17, 2017 at 4:34 PM, Mateusz Mikuła via cfe-dev <[hidden email]> wrote:

Hello,

I'm planing to get libc++ compiling with MinGW-w64, right now without patches it fails with:

CMake Error at projects/libcxx/CMakeLists.txt:396 (message):
  C++11 or greater is required but the compiler does not support c++11

It is caused by adding `-nodefaultlibs` flag (it passes it's own check [1]). However many following checks fail due to undefined references, results with gcc [2] and clang [3].

CMake seems to be adding system libraries automagically. Specifically it adds  -lgcc_s -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32.
I'm guessing that these libraries are where the undefined symbols are coming from, and I suspect the correct fix is to somehow prevent CMake from adding them.



Hard-coding 0 for LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG allows it go finish configuration and fail during build (that's another story).

`-nodefaultlibs` appears several times in libc++ and libc++abi code and I'm not sure about cleanest way to fix/workaround it.

Any suggestions?


[1] https://github.com/llvm-mirror/libcxx/blob/master/cmake/config-ix.cmake#L27

[2] https://reviews.llvm.org/P7975

[3] https://reviews.llvm.org/P7976


Thanks,

Mateusz


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev








_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [libc++] Compiling with MinGW-w64

Richard Pennington via cfe-dev
In reply to this post by Richard Pennington via cfe-dev

 CMAKE_REQUIRED_LIBRARIES is empty and out-of-tree build with removed CMake flags didn't help.



------ Original Message ------
Subject: Re: [cfe-dev] [libc++] Compiling with MinGW-w64
Date: Thu, 23 Mar 2017 05:31:02 -0600
To: Mateusz Mikuła
From: Eric Fiselier
Also what's your exact CMake invocation?

/Eric

On Thu, Mar 23, 2017 at 5:29 AM, Eric Fiselier <[hidden email]> wrote:


On Thu, Mar 23, 2017 at 4:55 AM, Mateusz Mikuła <[hidden email]> wrote:

 Yes, logs come from unmodified build of in-tree build of libc++.

Here is NODEFAULTLIBS check

Performing C++ SOURCE FILE Test LIBCXXABI_HAS_NODEFAULTLIBS_FLAG succeeded with the following output:
Change Dir: D:/projekty/msys2/MINGW-packages/mingw-w64-clang/src/build-i686/CMakeFiles/CMakeTmp

Run Build Command:"D:/msys64/usr/bin/make.exe" "cmTC_a0b32/fast"
/usr/bin/make -f CMakeFiles/cmTC_a0b32.dir/build.make CMakeFiles/cmTC_a0b32.dir/build
[1;34mmake[1]: [0m Entering directory '/d/projekty/msys2/MINGW-packages/mingw-w64-clang/src/build-i686/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_a0b32.dir/src.cxx.obj
/D/msys64/mingw32/bin/g++.exe     -D_GNU_SOURCE -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -Werror=date-time -std=gnu++11 -DLIBCXXABI_HAS_NODEFAULTLIBS_FLAG   -nodefaultlibs -o CMakeFiles/cmTC_a0b32.dir/src.cxx.obj -c /D/projekty/msys2/MINGW-packages/mingw-w64-clang/src/build-i686/CMakeFiles/CMakeTmp/src.cxx
Linking CXX executable cmTC_a0b32.exe
/D/msys64/mingw32/bin/cmake.exe -E remove -f CMakeFiles/cmTC_a0b32.dir/objects.a
/D/msys64/mingw32/bin/ar.exe cr CMakeFiles/cmTC_a0b32.dir/objects.a "CMakeFiles/cmTC_a0b32.dir/src.cxx.obj"
/D/msys64/mingw32/bin/g++.exe  -D_GNU_SOURCE -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -Werror=date-time -std=gnu++11 -DLIBCXXABI_HAS_NODEFAULTLIBS_FLAG  -pipe -Wl,--stack,16777216  -Wl,--whole-archive CMakeFiles/cmTC_a0b32.dir/objects.a -Wl,--no-whole-archive  -o cmTC_a0b32.exe -Wl,--major-image-version,0,--minor-image-version,0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
[1;34mmake[1]: [0m Leaving directory '/d/projekty/msys2/MINGW-packages/mingw-w64-clang/src/build-i686/CMakeFiles/CMakeTmp'

Source file was:
int main() { return 0; }


I'll try out of tree build soon.

I don't think that will make a difference. LLVM isn't adding these libraries AFAIK. They must be getting automatically added by CMake.
Can you check if they're getting added via "CMAKE_REQUIRED_LIBRARIES"?

I've been looking for CMake documentation about this but I can't find anything.

/Eric




------ Original Message ------
Subject: Re: [cfe-dev] [libc++] Compiling with MinGW-w64
Date: Thu, 23 Mar 2017 02:34:09 -0600
To: Mateusz Mikuła
From: Eric Fiselier
Just to verify you're not manually adding any of the following libraries, right?

-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
/Eric

On Wed, Mar 22, 2017 at 7:04 PM, Eric Fiselier <[hidden email]> wrote:


On Fri, Mar 17, 2017 at 4:34 PM, Mateusz Mikuła via cfe-dev <[hidden email]> wrote:

Hello,

I'm planing to get libc++ compiling with MinGW-w64, right now without patches it fails with:

CMake Error at projects/libcxx/CMakeLists.txt:396 (message):
  C++11 or greater is required but the compiler does not support c++11

It is caused by adding `-nodefaultlibs` flag (it passes it's own check [1]). However many following checks fail due to undefined references, results with gcc [2] and clang [3].

CMake seems to be adding system libraries automagically. Specifically it adds  -lgcc_s -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32.
I'm guessing that these libraries are where the undefined symbols are coming from, and I suspect the correct fix is to somehow prevent CMake from adding them.



Hard-coding 0 for LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG allows it go finish configuration and fail during build (that's another story).

`-nodefaultlibs` appears several times in libc++ and libc++abi code and I'm not sure about cleanest way to fix/workaround it.

Any suggestions?


[1] https://github.com/llvm-mirror/libcxx/blob/master/cmake/config-ix.cmake#L27

[2] https://reviews.llvm.org/P7975

[3] https://reviews.llvm.org/P7976


Thanks,

Mateusz


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev








_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [libc++] Compiling with MinGW-w64

Richard Pennington via cfe-dev
In reply to this post by Richard Pennington via cfe-dev
I ran into this today and took a stab at fixing it:

It's probably a terrible fix, but I needed most of those mingw libraries to get basic programs linking. I could rewrite the patch using more auto-conf-y style tests, but they are slow and unreliable.

On Fri, Mar 17, 2017 at 3:34 PM, Mateusz Mikuła via cfe-dev <[hidden email]> wrote:

Hello,

I'm planing to get libc++ compiling with MinGW-w64, right now without patches it fails with:

CMake Error at projects/libcxx/CMakeLists.txt:396 (message):
  C++11 or greater is required but the compiler does not support c++11

It is caused by adding `-nodefaultlibs` flag (it passes it's own check [1]). However many following checks fail due to undefined references, results with gcc [2] and clang [3].

Hard-coding 0 for LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG allows it go finish configuration and fail during build (that's another story).

`-nodefaultlibs` appears several times in libc++ and libc++abi code and I'm not sure about cleanest way to fix/workaround it.

Any suggestions?


[1] https://github.com/llvm-mirror/libcxx/blob/master/cmake/config-ix.cmake#L27

[2] https://reviews.llvm.org/P7975

[3] https://reviews.llvm.org/P7976


Thanks,

Mateusz


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [libc++] Compiling with MinGW-w64

Richard Pennington via cfe-dev
Fantastic but looks like those libs are not linked when using libc++ with Clang: https://reviews.llvm.org/P7980

Patches I applied to 4.0.0 release sources:

libc++: Reid's patch and this big, ugly and invasive patch [1]

libc++abi: [2] which is most likely fixed by D26949 [3]

libunwind: potentially dangerous [4]


[1] https://github.com/mati865/MINGW-packages/blob/clang/mingw-w64-clang/0401-mingw-w64-hack-and-slash-fixes-for-libc.patch

[2] https://github.com/mati865/MINGW-packages/blob/clang/mingw-w64-clang/0701-fix-visibility-for-libc-abi-on-win32.patch

[3] https://github.com/llvm-mirror/libcxxabi/commit/54227aec1d6116c936afa576e2ea36ca3e94b29c

[4] https://github.com/mati865/MINGW-packages/blob/clang/mingw-w64-clang/0601-libunwind-add-support-for-mingw-w64.patch


Regards,

Mateusz


------ Original Message ------
Subject: Re: [cfe-dev] [libc++] Compiling with MinGW-w64
Date: Thu, 30 Mar 2017 17:29:24 -0700
To: Mateusz Mikuła, Eric Fiselier, Cfe-dev
From: Reid Kleckner
I ran into this today and took a stab at fixing it:

It's probably a terrible fix, but I needed most of those mingw libraries to get basic programs linking. I could rewrite the patch using more auto-conf-y style tests, but they are slow and unreliable.

On Fri, Mar 17, 2017 at 3:34 PM, Mateusz Mikuła via cfe-dev <[hidden email]> wrote:

Hello,

I'm planing to get libc++ compiling with MinGW-w64, right now without patches it fails with:

CMake Error at projects/libcxx/CMakeLists.txt:396 (message):
  C++11 or greater is required but the compiler does not support c++11

It is caused by adding `-nodefaultlibs` flag (it passes it's own check [1]). However many following checks fail due to undefined references, results with gcc [2] and clang [3].

Hard-coding 0 for LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG allows it go finish configuration and fail during build (that's another story).

`-nodefaultlibs` appears several times in libc++ and libc++abi code and I'm not sure about cleanest way to fix/workaround it.

Any suggestions?


[1] https://github.com/llvm-mirror/libcxx/blob/master/cmake/config-ix.cmake#L27

[2] https://reviews.llvm.org/P7975

[3] https://reviews.llvm.org/P7976


Thanks,

Mateusz


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev




_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [libc++] Compiling with MinGW-w64

Richard Pennington via cfe-dev

 Forgot to mention you can build static version only, shared fails with https://reviews.llvm.org/P7981




------ Original Message ------
Subject: Re: [cfe-dev] [libc++] Compiling with MinGW-w64
Date: Sat, 1 Apr 2017 00:11:37 +0200
To: Reid Kleckner, Eric Fiselier, Cfe-dev
From: Mateusz Mikuła
Fantastic but looks like those libs are not linked when using libc++ with Clang: https://reviews.llvm.org/P7980

Patches I applied to 4.0.0 release sources:

libc++: Reid's patch and this big, ugly and invasive patch [1]

libc++abi: [2] which is most likely fixed by D26949 [3]

libunwind: potentially dangerous [4]


[1] https://github.com/mati865/MINGW-packages/blob/clang/mingw-w64-clang/0401-mingw-w64-hack-and-slash-fixes-for-libc.patch

[2] https://github.com/mati865/MINGW-packages/blob/clang/mingw-w64-clang/0701-fix-visibility-for-libc-abi-on-win32.patch

[3] https://github.com/llvm-mirror/libcxxabi/commit/54227aec1d6116c936afa576e2ea36ca3e94b29c

[4] https://github.com/mati865/MINGW-packages/blob/clang/mingw-w64-clang/0601-libunwind-add-support-for-mingw-w64.patch


Regards,

Mateusz


------ Original Message ------
Subject: Re: [cfe-dev] [libc++] Compiling with MinGW-w64
Date: Thu, 30 Mar 2017 17:29:24 -0700
To: Mateusz Mikuła, Eric Fiselier, Cfe-dev
From: Reid Kleckner
I ran into this today and took a stab at fixing it:

It's probably a terrible fix, but I needed most of those mingw libraries to get basic programs linking. I could rewrite the patch using more auto-conf-y style tests, but they are slow and unreliable.

On Fri, Mar 17, 2017 at 3:34 PM, Mateusz Mikuła via cfe-dev <[hidden email]> wrote:

Hello,

I'm planing to get libc++ compiling with MinGW-w64, right now without patches it fails with:

CMake Error at projects/libcxx/CMakeLists.txt:396 (message):
  C++11 or greater is required but the compiler does not support c++11

It is caused by adding `-nodefaultlibs` flag (it passes it's own check [1]). However many following checks fail due to undefined references, results with gcc [2] and clang [3].

Hard-coding 0 for LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG allows it go finish configuration and fail during build (that's another story).

`-nodefaultlibs` appears several times in libc++ and libc++abi code and I'm not sure about cleanest way to fix/workaround it.

Any suggestions?


[1] https://github.com/llvm-mirror/libcxx/blob/master/cmake/config-ix.cmake#L27

[2] https://reviews.llvm.org/P7975

[3] https://reviews.llvm.org/P7976


Thanks,

Mateusz


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev





_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [libc++] Compiling with MinGW-w64

Richard Pennington via cfe-dev

I've updated paste https://reviews.llvm.org/P7981 since it was libunwind issue (resolved by another patch).

At the moment it fails to link libc++abi.dll, any tips what to do next?



------ Original Message ------
Subject: Re: [cfe-dev] [libc++] Compiling with MinGW-w64
Date: Sat, 1 Apr 2017 02:35:50 +0200
To: Reid Kleckner, Eric Fiselier, Cfe-dev
From: Mateusz Mikuła

 Forgot to mention you can build static version only, shared fails with https://reviews.llvm.org/P7981




------ Original Message ------
Subject: Re: [cfe-dev] [libc++] Compiling with MinGW-w64
Date: Sat, 1 Apr 2017 00:11:37 +0200
To: Reid Kleckner, Eric Fiselier, Cfe-dev
From: Mateusz Mikuła
Fantastic but looks like those libs are not linked when using libc++ with Clang: https://reviews.llvm.org/P7980

Patches I applied to 4.0.0 release sources:

libc++: Reid's patch and this big, ugly and invasive patch [1]

libc++abi: [2] which is most likely fixed by D26949 [3]

libunwind: potentially dangerous [4]


[1] https://github.com/mati865/MINGW-packages/blob/clang/mingw-w64-clang/0401-mingw-w64-hack-and-slash-fixes-for-libc.patch

[2] https://github.com/mati865/MINGW-packages/blob/clang/mingw-w64-clang/0701-fix-visibility-for-libc-abi-on-win32.patch

[3] https://github.com/llvm-mirror/libcxxabi/commit/54227aec1d6116c936afa576e2ea36ca3e94b29c

[4] https://github.com/mati865/MINGW-packages/blob/clang/mingw-w64-clang/0601-libunwind-add-support-for-mingw-w64.patch


Regards,

Mateusz


------ Original Message ------
Subject: Re: [cfe-dev] [libc++] Compiling with MinGW-w64
Date: Thu, 30 Mar 2017 17:29:24 -0700
To: Mateusz Mikuła, Eric Fiselier, Cfe-dev
From: Reid Kleckner
I ran into this today and took a stab at fixing it:

It's probably a terrible fix, but I needed most of those mingw libraries to get basic programs linking. I could rewrite the patch using more auto-conf-y style tests, but they are slow and unreliable.

On Fri, Mar 17, 2017 at 3:34 PM, Mateusz Mikuła via cfe-dev <[hidden email]> wrote:

Hello,

I'm planing to get libc++ compiling with MinGW-w64, right now without patches it fails with:

CMake Error at projects/libcxx/CMakeLists.txt:396 (message):
  C++11 or greater is required but the compiler does not support c++11

It is caused by adding `-nodefaultlibs` flag (it passes it's own check [1]). However many following checks fail due to undefined references, results with gcc [2] and clang [3].

Hard-coding 0 for LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG allows it go finish configuration and fail during build (that's another story).

`-nodefaultlibs` appears several times in libc++ and libc++abi code and I'm not sure about cleanest way to fix/workaround it.

Any suggestions?


[1] https://github.com/llvm-mirror/libcxx/blob/master/cmake/config-ix.cmake#L27

[2] https://reviews.llvm.org/P7975

[3] https://reviews.llvm.org/P7976


Thanks,

Mateusz


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev






_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [libc++] Compiling with MinGW-w64

Richard Pennington via cfe-dev
In reply to this post by Richard Pennington via cfe-dev

 Missing mingw-w64 libs case is most likely closed but there is conflict between libc++ and libc++abi function definitions. I've switched to trunk as well.

The former have '_LIBCPP_FUNC_VIS' to mark them as dllexport/dllimport but libc++abi redefines them without attributes.

Clang log: https://reviews.llvm.org/P7983

GCC log: https://reviews.llvm.org/P7982


Let's take a look at GCC-produced (Clang is still not entirely fine as seen in log; multiple definition of ...) objects containing bad_cast function as it is first undefined reference:

error:
CMakeFiles/cxxabi_shared.dir/objects.a(cxa_aux_runtime.cpp.obj):cxa_aux_runtime.cpp:(.text+0x17): undefined reference to `__imp__ZNSt8bad_castC1Ev'
CMakeFiles/cxxabi_shared.dir/objects.a(cxa_aux_runtime.cpp.obj):cxa_aux_runtime.cpp:(.text+0x1e): undefined reference to `__imp__ZNSt8bad_castD1Ev'

nm build-x86_64-w64-mingw32/projects/libcxxabi/src/CMakeFiles/cxxabi_objects.dir/cxa_aux_runtime.cpp.obj | grep bad_cast
0000000000000000 r .rdata$_ZTISt8bad_cast
0000000000000000 r .rdata$_ZTSSt8bad_cast
0000000000000000 T __cxa_bad_cast
                 U __imp__ZNSt8bad_castC1Ev
                 U __imp__ZNSt8bad_castD1Ev
0000000000000000 R _ZTISt8bad_cast
0000000000000000 R _ZTSSt8bad_cast

nm build-x86_64-w64-mingw32/projects/libcxxabi/src/CMakeFiles/cxxabi_objects.dir/stdlib_typeinfo.cpp.obj | grep bad_cast
0000000000000000 r .rdata$_ZTISt8bad_cast
0000000000000000 r .rdata$_ZTSSt8bad_cast
0000000000000000 r .rdata$_ZTVSt8bad_cast
                 U __imp__ZTVSt8bad_cast
0000000000000000 T _ZNKSt8bad_cast4whatEv
00000000000000e0 T _ZNSt8bad_castC1Ev
00000000000000e0 T _ZNSt8bad_castC2Ev
0000000000000040 T _ZNSt8bad_castD0Ev
0000000000000020 T _ZNSt8bad_castD1Ev
0000000000000020 T _ZNSt8bad_castD2Ev
0000000000000000 R _ZTISt8bad_cast
0000000000000000 R _ZTSSt8bad_cast
0000000000000000 R _ZTVSt8bad_cast

I was not able to fix it by myself so I'm asking for help again.
Should I add someone to this discussion?


Regards,

Mateusz


------ Original Message ------
Subject: Re: [cfe-dev] [libc++] Compiling with MinGW-w64
Date: Wed, 22 Mar 2017 19:04:42 -0600
To: Mateusz Mikuła, Cfe-dev
From: Eric Fiselier


On Fri, Mar 17, 2017 at 4:34 PM, Mateusz Mikuła via cfe-dev <[hidden email]> wrote:

Hello,

I'm planing to get libc++ compiling with MinGW-w64, right now without patches it fails with:

CMake Error at projects/libcxx/CMakeLists.txt:396 (message):
  C++11 or greater is required but the compiler does not support c++11

It is caused by adding `-nodefaultlibs` flag (it passes it's own check [1]). However many following checks fail due to undefined references, results with gcc [2] and clang [3].

CMake seems to be adding system libraries automagically. Specifically it adds  -lgcc_s -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32.
I'm guessing that these libraries are where the undefined symbols are coming from, and I suspect the correct fix is to somehow prevent CMake from adding them.



Hard-coding 0 for LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG allows it go finish configuration and fail during build (that's another story).

`-nodefaultlibs` appears several times in libc++ and libc++abi code and I'm not sure about cleanest way to fix/workaround it.

Any suggestions?


[1] https://github.com/llvm-mirror/libcxx/blob/master/cmake/config-ix.cmake#L27

[2] https://reviews.llvm.org/P7975

[3] https://reviews.llvm.org/P7976


Thanks,

Mateusz


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev




_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

signature.asc (836 bytes) Download Attachment
Loading...