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

state of libc++ for msys's mingw #7

Open
user706 opened this issue Dec 17, 2018 · 1 comment
Open

state of libc++ for msys's mingw #7

user706 opened this issue Dec 17, 2018 · 1 comment

Comments

@user706
Copy link

user706 commented Dec 17, 2018

Hi,

I'm trying to compile a simple c++ source

#include <iostream>

int main()
{
    std::cout << "hi" << std::endl;
}

with clang++ and libc++ under msys's mingw. It requires these packages:

pacman -S --needed \
        mingw-w64-i686-clang               mingw-w64-x86_64-clang              \
        mingw-w64-i686-libc++              mingw-w64-x86_64-libc++             \
        mingw-w64-i686-libc++abi           mingw-w64-x86_64-libc++abi

Now under Linux I can issue the following compile command, which works

clang++ -std=c++14 -stdlib=libc++ hello.cpp -o hello                                    -lc++abi
#or 
clang++ -std=c++14 -stdlib=libc++ hello.cpp -o hello -nodefaultlibs    -lc++ -lc++abi -lm -lc -lgcc_s -lgcc

But under msys2, I'm always failing...
I'm now using

clang++ -stdlib=libc++ hello.cpp -o hello -nodefaultlibs -std=c++14  -lc++ -lc++abi -lm -lc -lgcc_s -lgcc -lmingw32 -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lmoldname -lmingwex -lmsvcrt -lmingw32  -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -lpthread

(taking this as clue)
but still get errors like

C:\msys64\mingw64\lib/libc++.a(string.cpp.obj):(.rdata$.refptr._ZTVSt16invalid_argument[.refptr._ZTVSt16invalid_argument]+0x0): undefined reference to `vtable for std::invalid_argument'
[...]
C:\msys64\mingw64\lib/libc++.a(locale_win32.cpp.obj):(.text+0xbb7): undefined reference to `__libcpp_vasprintf(char**, char const*, char*)'
[...]
C:\msys64\mingw64\lib/libc++abi.a(stdlib_stdexcept.cpp.obj):(.text+0x28): undefined reference to `__imp__ZTVSt11logic_error'
[...]
C:\msys64\mingw64\lib/libc++abi.a(stdlib_typeinfo.cpp.obj):(.text+0x23): undefined reference to `__imp__ZTVSt8bad_cast'
[...]
C:\msys64\mingw64\lib/libc++abi.a(private_typeinfo.cpp.obj):(.text+0x2d): undefined reference to `__imp__ZNSt9type_infoD2Ev'
[...]
C:\msys64\mingw64\lib/libc++abi.a(cxa_exception.cpp.obj):(.text+0x39): undefined reference to `__imp__ZSt9terminatev'
[...]
C:\msys64\mingw64\lib/libc++abi.a(cxa_default_handlers.cpp.obj):(.text+0x14): undefined reference to `__imp__ZSt9terminatev'
C:\msys64\mingw64\lib/libc++abi.a(cxa_demangle.cpp.obj):(.text+0xde5): undefined reference to `__imp__ZSt9terminatev'
[...]
C:\msys64\mingw64\lib/libc++abi.a(cxa_aux_runtime.cpp.obj):(.text+0x17): undefined reference to `__imp__ZNSt8bad_castC1Ev'
[...]

Now I've seen:
https://github.com/martell/mingw-w64-clang/blob/8186317d9addb132701d83c588634ba6a4090cb9/README.MD#status

  • libcxx - builds

so I'm beginning to believe that it might not be working yet!

Could you shed some light on this?
What is the state of msys's libc++? Is it usable? Which flags should I pass? Any usable cmake example?

Thanks.

@mati865
Copy link

mati865 commented Dec 17, 2018

This repository is not related to MSYS2 packages.
I think the issue with MSYS2 package is improperly built libc++abi.

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

No branches or pull requests

2 participants