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

Support POSIX threading model for MINGW #37

Open
fire opened this issue Sep 16, 2017 · 3 comments
Open

Support POSIX threading model for MINGW #37

fire opened this issue Sep 16, 2017 · 3 comments

Comments

@fire
Copy link

fire commented Sep 16, 2017

The use of godot crosscompiled on Linux requires POSIX threading model.

They suggest:

To use posix mode for mingw by default:

$ sudo update-alternatives --config x86_64-w64-mingw32-gcc
<choose x86_64-w64-mingw32-gcc-posix from the list>
$ sudo update-alternatives --config x86_64-w64-mingw32-g++
<choose x86_64-w64-mingw32-g++-posix from the list>

(godotengine/godot#9258)

I'm not sure how to do this for wclang.

@fire
Copy link
Author

fire commented Sep 16, 2017

$ x86_64-w64-mingw32-gcc-posix -v
Using built-in specs.
COLLECT_GCC=x86_64-w64-mingw32-gcc-posix
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/lto-wrapper
Target: x86_64-w64-mingw32
Configured with: ../../src/configure --build=x86_64-linux-gnu --prefix=/usr --includedir='/usr/include' --mandir='/usr/s
hare/man' --infodir='/usr/share/info' --sysconfdir=/etc --localstatedir=/var --disable-silent-rules --libexecdir='/usr/l
ib/gcc-mingw-w64' --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --enable-shared --enable-static
--disable-multilib --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --libdir=/usr/lib --enable-libstd
cxx-time=yes --with-tune=generic --enable-version-specific-runtime-libs --enable-fully-dynamic-string --enable-libgomp -
-enable-languages=c,c++,fortran,objc,obj-c++ --enable-lto --with-plugin-ld --enable-threads=posix --program-suffix=-posi
x --program-prefix=x86_64-w64-mingw32- --target=x86_64-w64-mingw32 --with-as=/usr/bin/x86_64-w64-mingw32-as --with-ld=/u
sr/bin/x86_64-w64-mingw32-ld --disable-libatomic
Thread model: posix
gcc version 5.3.1 20160211 (GCC)
$ x86_64-w64-mingw32-gcc-win32 -v
Using built-in specs.
COLLECT_GCC=x86_64-w64-mingw32-gcc-win32
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-w64-mingw32/5.3-win32/lto-wrapper
Target: x86_64-w64-mingw32
Configured with: ../../src/configure --build=x86_64-linux-gnu --prefix=/usr --includedir='/usr/include' --mandir='/usr/s
hare/man' --infodir='/usr/share/info' --sysconfdir=/etc --localstatedir=/var --disable-silent-rules --libexecdir='/usr/l
ib/gcc-mingw-w64' --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --enable-shared --enable-static
--disable-multilib --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --libdir=/usr/lib --enable-libstd
cxx-time=yes --with-tune=generic --enable-version-specific-runtime-libs --enable-fully-dynamic-string --enable-libgomp -
-enable-languages=c,c++,fortran,objc,obj-c++ --enable-lto --with-plugin-ld --enable-threads=win32 --program-suffix=-win3
2 --program-prefix=x86_64-w64-mingw32- --target=x86_64-w64-mingw32 --with-as=/usr/bin/x86_64-w64-mingw32-as --with-ld=/u
sr/bin/x86_64-w64-mingw32-ld --disable-libatomic
Thread model: win32
gcc version 5.3.1 20160211 (GCC)

@fire
Copy link
Author

fire commented Sep 16, 2017

clang version 4.0.0-1ubuntu1~16.04.2 (tags/RELEASE_400/rc1)
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: /usr/bin
 "/usr/lib/llvm-4.0/bin/clang" -cc1 -triple x86_64-w64-windows-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name hello.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -momit-leaf-frame-pointer -v -dwarf-column-info -debugger-tuning=gdb -nostdsysteminc -nobuiltininc -resource-dir /usr/lib/llvm-4.0/bin/../lib/clang/4.0.0 -isystem /usr/bin/../lib/clang/4.0/include -isystem /usr/x86_64-w64-mingw32/include/../../../usr/lib/gcc/x86_64-w64-mingw32/5.3-win32/include/c++ -isystem /usr/x86_64-w64-mingw32/include/../../../usr/lib/gcc/x86_64-w64-mingw32/5.3-win32/include/c++/x86_64-w64-mingw32 -isystem /usr/x86_64-w64-mingw32/include -fdeprecated-macro -fdebug-compilation-dir /home/fire -ferror-limit 19 -fmessage-length 120 -fno-use-cxa-atexit -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/hello-c55cd5.o -x c++ hello.cpp
clang -cc1 version 4.0.0 based upon LLVM 4.0.0 default target x86_64-pc-linux-gnu
#include "..." search starts here:
#include <...> search starts here:
 /usr/bin/../lib/clang/4.0/include
 /usr/x86_64-w64-mingw32/include/../../../usr/lib/gcc/x86_64-w64-mingw32/5.3-win32/include/c++
 /usr/x86_64-w64-mingw32/include/../../../usr/lib/gcc/x86_64-w64-mingw32/5.3-win32/include/c++/x86_64-w64-mingw32
 /usr/x86_64-w64-mingw32/include
End of search list.
 "/usr/bin/x86_64-w64-mingw32-ld" -m i386pep -Bdynamic -o hello /usr/x86_64-w64-mingw32/lib/crt2.o /usr/x86_64-w64-mingw32/lib/crtbegin.o -L/usr/lib/gcc/x86_64-w64-mingw32/5.3-posix -L/usr/x86_64-w64-mingw32/lib -L/usr/lib -L/usr/x86_64-w64-mingw32/sys-root/mingw/lib /tmp/hello-c55cd5.o -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt /usr/x86_64-w64-mingw32/lib/crtend.o
/tmp/hello-c55cd5.o:(.text+0xc): undefined reference to `std::ios_base::Init::Init()'
/tmp/hello-c55cd5.o:(.text+0x3c): undefined reference to `std::ios_base::Init::~Init()'
/tmp/hello-c55cd5.o:(.text+0x62): undefined reference to `std::cout'
/tmp/hello-c55cd5.o:(.text+0x75): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)```

`/usr/lib/gcc/x86_64-w64-mingw32/5.3-win32` is incorrect.

Should be `/usr/lib/gcc/x86_64-w64-mingw32/5.3-posix`.

@fire
Copy link
Author

fire commented Sep 16, 2017

I gave up and just deleted /usr/lib/gcc/x86_64-w64-mingw32/5.3-win32. This is a clue that it's an ordering issue.

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

1 participant