Hi

Are you building from ports?

I haven't tried building from source outside ports in quite some time now.
What I have to build with this change is the normal 1.24.6 gnustep-base
port to which I added 3 patches and it builds fine for me on FreeBSD
11.0-CURRENT (amd64).

Here they are:



/usr/ports/lang/gnustep-base/files/patch-Headers__GNUstepBase__config.h.in

--- ./Headers/GNUstepBase/config.h.in.orig    2013-09-10 16:24:29.000000000
+0900
+++ ./Headers/GNUstepBase/config.h.in    2014-04-23 18:27:40.000000000 +0900
@@ -817,6 +817,9 @@
 /* Define if using the libffi library for invocations */
 #undef USE_LIBFFI

+/* Define if using setname functions of pthread */
+#undef PTHREAD_SETNAME
+
 /* Enable extensions on AIX 3, Interix.  */
 #ifndef _ALL_SOURCE
 # undef _ALL_SOURCE




/usr/ports/lang/gnustep-base/files/patch-Source__NSThread.m

--- ./Source/NSThread.m.orig    2013-08-12 17:56:18.000000000 +0900
+++ ./Source/NSThread.m    2014-04-23 18:33:38.000000000 +0900
@@ -28,7 +28,7 @@
    Boston, MA 02111 USA.

    <title>NSThread class reference</title>
-   $Date: 2013-08-12 09:56:18 +0100 (Mon, 12 Aug 2013) $ $Revision: 36966 $
+   $Date: 2013-08-12 17:56:18 +0900 (Mon, 12 Aug 2013) $ $Revision: 36966 $
 */

 #import "common.h"
@@ -93,6 +93,47 @@
 #endif


+/*
+ NSThread setName: method for windows
+ */
+#if defined(__MINGW__) && defined(HAVE_WINDOWS_H)
+// Usage: SetThreadName (-1, "MainThread");
+#include <windows.h>
+const DWORD MS_VC_EXCEPTION=0x406D1388;
+
+#pragma pack(push,8)
+typedef struct tagTHREADNAME_INFO
+{
+  DWORD dwType; // Must be 0x1000.
+  LPCSTR szName; // Pointer to name (in user addr space).
+  DWORD dwThreadID; // Thread ID (-1=caller thread).
+  DWORD dwFlags; // Reserved for future use, must be zero.
+} THREADNAME_INFO;
+#pragma pack(pop)
+
+static void SetThreadName( DWORD dwThreadID, char* threadName)
+{
+  THREADNAME_INFO info;
+  info.dwType = 0x1000;
+  info.szName = threadName;
+  info.dwThreadID = dwThreadID;
+  info.dwFlags = 0;
+
+  __try
+  {
+    RaiseException( MS_VC_EXCEPTION, 0, sizeof(info)/sizeof(ULONG_PTR),
(ULONG_PTR*)&info );
+  }
+  __except(EXCEPTION_EXECUTE_HANDLER)
+  {
+  }
+}
+
+#define PTHREAD_SETNAME(a,b)  SetThreadName(-1, b)
+
+#endif
+
+
+
 // Some older BSD systems used a non-standard range of thread priorities.
 // Use these if they exist, otherwise define standard ones.
 #ifndef PTHREAD_MAX_PRIORITY
@@ -752,6 +793,14 @@
 - (void) setName: (NSString*)aName
 {
   ASSIGN(_name, aName);
+#ifdef PTHREAD_SETNAME
+  [self performSelector:@selector(setNameOnCurrentThread:) onThread:self
withObject:aName waitUntilDone:NO];
+#endif
+}
+
+- (void) setNameOnCurrentThread: (NSString *)aName
+{
+  PTHREAD_SETNAME(pthread_self(), [aName
cStringUsingEncoding:NSUTF8StringEncoding]);
 }

 - (void) setStackSize: (NSUInteger)stackSize





/usr/ports/lang/gnustep-base/files/patch-configure.ac

--- ./configure.ac.orig    2013-11-27 07:55:47.000000000 +0900
+++ ./configure.ac    2014-04-23 18:27:40.000000000 +0900
@@ -1780,6 +1780,23 @@
 CFLAGS=$saved_CFLAGS

 #--------------------------------------------------------------------
+# Check if we can name pthreads
+#--------------------------------------------------------------------
+
+AC_CHECK_FUNC(pthread_setname_np, pthread_setname_ok=yes,
pthread_setname_ok=no)
+if test $pthread_setname_ok = yes ; then
+   case "$target_os" in
+       darwin*)     AC_DEFINE(PTHREAD_SETNAME(a,b),
pthread_setname_np(b),   [Description: Define set name function for
pthread]);;
+    *)         AC_DEFINE(PTHREAD_SETNAME(a,b), pthread_setname_np(a,b),
[Description: Define set name function for pthread]);;
+   esac
+fi
+
+AC_CHECK_FUNC(pthread_set_name_np, pthread_set_name_ok=yes,
pthread_set_name_ok=no)
+if test $pthread_set_name_ok = yes ; then
+   AC_DEFINE(PTHREAD_SETNAME(a,b), pthread_set_name_np(a,b), [Description:
Define set name function for pthread])
+fi
+
+#--------------------------------------------------------------------
 # Check whether Objective-C /really/ works
 #--------------------------------------------------------------------
 AC_MSG_CHECKING(whether objc really works)



And then I added this to the port makefile to have it reconf

post-patch:
    cd ${WRKSRC} && /usr/local/bin/autoreconf


Hope this helps..



--
Johannes Lundberg
BRILLIANTSERVICE CO., LTD.

On Tue, Dec 2, 2014 at 9:47 AM, Riccardo Mottola <riccardo.mott...@libero.it
> wrote:

> Hi,
>
> I just tried compiling on FreeBSD 10.0 clang:
>
>  Compiling file NSThread.m ...
> NSThread.m:810:14: error: assigning to 'int' from incompatible type 'void'
>       result = PTHREAD_SETNAME(pthread_self(),
>              ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 1 error generated.
>
> Ideas? It looks it is Johannes' change here.
>
> Riccardo
>
> _______________________________________________
> Gnustep-dev mailing list
> Gnustep-dev@gnu.org
> https://lists.gnu.org/mailman/listinfo/gnustep-dev
>

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
秘密保持について:この電子メールは、名宛人に送信したものであり、秘匿特権の対象となる情報を含んでいます。
もし、名宛人以外の方が受信された場合、このメールの破棄、およびこのメールに関する一切の開示、
複写、配布、その他の利用、または記載内容に基づくいかなる行動もされないようお願い申し上げます。
---
CONFIDENTIALITY NOTE: The information in this email is confidential
and intended solely for the addressee.
Disclosure, copying, distribution or any other action of use of this
email by person other than intended recipient, is prohibited.
If you are not the intended recipient and have received this email in
error, please destroy the original message.
_______________________________________________
Gnustep-dev mailing list
Gnustep-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to