octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: thread model for mxe-octave build


From: John W. Eaton
Subject: Re: thread model for mxe-octave build
Date: Fri, 23 Feb 2018 09:08:26 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

On 02/22/2018 12:02 PM, JohnD wrote:


-----Original Message-----
From: John W. Eaton [mailto:address@hidden
Sent: Thursday, February 22, 2018 11:44 AM
To: John Donoghue; Octave Maintainers List
Cc: address@hidden
Subject: thread model for mxe-octave build

I had someone ask why C++11 threads (mutext, condition_variable_any) wasn't
working with .oct files built with Octave 4.2.1.  After a little searching, I 
found
that we are configuring GCC with
--enable-threads=win32 instead of --enable-threads=posix.  Apparently the
latter is required to enable C++11 thread features.  Is there any reason to not
use --enable-threads=posix by default in our builds?  I tried building 
native-gcc
with this option and it allowed my test program to compile but I don't know
whether there might be other problems.  From what I hve read, it seems that
even if GCC is built with this option you can still use Windows threading
features directly.  I've seen some mention of performance issues "in some
situations" but no explanation of what that might be.

jwe

No reason I know of except that mxe was/is using win32

I tried changing the following change:

diff --git a/src/build-gcc.mk b/src/build-gcc.mk
--- a/src/build-gcc.mk
+++ b/src/build-gcc.mk
@@ -31,7 +31,7 @@ ifeq ($(MXE_SYSTEM),mingw)
     --disable-nls \
     --without-x \
     --disable-win32-registry \
-    --enable-threads=win32
+    --enable-threads=posix
   ifneq ($(TARGET),x86_64-w64-mingw32)
     $(PKG)_SYSDEP_CONFIGURE_OPTIONS += \
     --libdir='$(BUILD_TOOLS_PREFIX)/lib' \
diff --git a/src/native-gcc.mk b/src/native-gcc.mk
--- a/src/native-gcc.mk
+++ b/src/native-gcc.mk
@@ -25,7 +25,7 @@ ifeq ($(MXE_SYSTEM),mingw)
     --without-x \
     --disable-win32-registry \
     --with-native-system-header-dir='$(HOST_PREFIX)/include' \
-    --enable-threads=win32
+    --enable-threads=posix
   ifneq ($(ENABLE_WINDOWS_64),yes)
     $(PKG)_SYSDEP_CONFIGURE_OPTIONS += \
       $(ENABLE_SHARED_OR_STATIC) \

The build-gcc target fails because pthread.h is not available:

In file included from /home/jwe/build/mxe-octave-w64-32-posix/tmp-build-gcc/gcc-7.2.0/libgcc/gthr.h:148:0, from /home/jwe/build/mxe-octave-w64-32-posix/tmp-build-gcc/gcc-7.2.0/libgcc/libgcov-interface.c:27:
./gthr-default.h:35:10: fatal error: pthread.h: No such file or directory
 #include <pthread.h>
          ^~~~~~~~~~~
compilation terminated.
Makefile:915: recipe for target '_gcov_dump.o' failed
make[6]: *** [_gcov_dump.o] Error 1

Maybe this is just a dependency ordering issue, but I'm not sure how to fix it.

Using --enable-threads=win32 for build-gcc and --enable-threads=posix for native-gcc allows the build to succeed, but I'm not sure that is a proper configuration. Even if it is, we will also need to use posix threads for build-gcc if we want to start using C++11 threading features in Octave itself. Any ideas about how to build a GCC cross compiler for Windows that has the posix thread model enabled?

jwe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]