All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: Felipe Contreras <felipe.contreras@gmail.com>,
	 Marat Radchenko <marat@slonopotamus.org>,
	 Felipe Contreras <felipe.contreras@gmail.com>
Cc: Marat Radchenko <marat@slonopotamus.org>,
	 Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	 Sebastian Schuberth <sschuberth@gmail.com>,
	 Heiko Voigt <hvoigt@hvoigt.net>,
	 git@vger.kernel.org,
	 msysGit Mailinglist <msysgit@googlegroups.com>
Subject: RE: [NOT_A_PATCH] A naive attempt to cross-build Linux->mingw64 Git
Date: Mon, 21 Apr 2014 19:06:24 -0500	[thread overview]
Message-ID: <5355b2807a10c_1d5ab792ecfd@nysa.notmuch> (raw)
In-Reply-To: <5355b0ce562b8_6c39e772f0cb@nysa.notmuch>

Felipe Contreras wrote:
> Marat Radchenko wrote:
> > 4. Observe errors [1]
> 
> I see those errors with a 64-bit compiler, but not with the old 32-bit one.
> 
> > I would be happy to find out I'm doing something wrong -- Johannes says building
> > mingw64 Git is dirt-easy.
> 
> I get the same error. I've been cross-compiling since basically all my
> professional life, so I don't think you are doing something wrong, it just
> doesn't work.

I managed to fix all the errors, some apply to newer mingw, regardless of 32 or
64, others are specific to 64-bit. It's all hacky and I haven't checked if it
runs, but at least it compiles (mostly).

diff --git a/compat/bswap.h b/compat/bswap.h
index 5061214..285d89c 100644
--- a/compat/bswap.h
+++ b/compat/bswap.h
@@ -5,6 +5,8 @@
  * operation.
  */
 
+#include <stdint.h>
+
 /*
  * Default version that the compiler ought to optimize properly with
  * constant values.
diff --git a/compat/mingw.h b/compat/mingw.h
index e033e72..9274b64 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -5,7 +5,6 @@
  * things that are not available in header files
  */
 
-typedef int pid_t;
 typedef int uid_t;
 typedef int socklen_t;
 #define hstrerror strerror
@@ -90,8 +89,6 @@ static inline int symlink(const char *oldpath, const char *newpath)
 { errno = ENOSYS; return -1; }
 static inline int fchmod(int fildes, mode_t mode)
 { errno = ENOSYS; return -1; }
-static inline pid_t fork(void)
-{ errno = ENOSYS; return -1; }
 static inline unsigned int alarm(unsigned int seconds)
 { return 0; }
 static inline int fsync(int fd)
@@ -261,12 +258,6 @@ static inline int getrlimit(int resource, struct rlimit *rlp)
 	return 0;
 }
 
-/*
- * Use mingw specific stat()/lstat()/fstat() implementations on Windows.
- */
-#define off_t off64_t
-#define lseek _lseeki64
-
 /* use struct stat with 64 bit st_size */
 #ifdef stat
 #undef stat
diff --git a/compat/nedmalloc/malloc.c.h b/compat/nedmalloc/malloc.c.h
index f216a2a..3e4affd 100644
--- a/compat/nedmalloc/malloc.c.h
+++ b/compat/nedmalloc/malloc.c.h
@@ -720,6 +720,7 @@ struct mallinfo {
   inlining are defined as macros, so these aren't used for them.
 */
 
+#undef FORCEINLINE
 #ifndef FORCEINLINE
   #if defined(__GNUC__)
 #define FORCEINLINE __inline __attribute__ ((always_inline))
@@ -1352,58 +1353,6 @@ LONG __cdecl _InterlockedExchange(LONG volatile *Target, LONG Value);
 #ifndef __MINGW32__
 #pragma intrinsic (_InterlockedCompareExchange)
 #pragma intrinsic (_InterlockedExchange)
-#else
-  /* --[ start GCC compatibility ]----------------------------------------------
-   * Compatibility <intrin_x86.h> header for GCC -- GCC equivalents of intrinsic
-   * Microsoft Visual C++ functions. Originally developed for the ReactOS
-   * (<http://www.reactos.org/>) and TinyKrnl (<http://www.tinykrnl.org/>)
-   * projects.
-   *
-   * Copyright (c) 2006 KJK::Hyperion <hackbunny@reactos.com>
-   *
-   * Permission is hereby granted, free of charge, to any person obtaining a
-   * copy of this software and associated documentation files (the "Software"),
-   * to deal in the Software without restriction, including without limitation
-   * the rights to use, copy, modify, merge, publish, distribute, sublicense,
-   * and/or sell copies of the Software, and to permit persons to whom the
-   * Software is furnished to do so, subject to the following conditions:
-   *
-   * The above copyright notice and this permission notice shall be included in
-   * all copies or substantial portions of the Software.
-   *
-   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-   * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-   * DEALINGS IN THE SOFTWARE.
-   */
-
-  /*** Atomic operations ***/
-  #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100
-    #define _ReadWriteBarrier() __sync_synchronize()
-  #else
-    static __inline__ __attribute__((always_inline)) long __sync_lock_test_and_set(volatile long * const Target, const long Value)
-    {
-      long res;
-      __asm__ __volatile__("xchg%z0 %2, %0" : "=g" (*(Target)), "=r" (res) : "1" (Value));
-      return res;
-    }
-    static void __inline__ __attribute__((always_inline)) _MemoryBarrier(void)
-    {
-      __asm__ __volatile__("" : : : "memory");
-    }
-    #define _ReadWriteBarrier() _MemoryBarrier()
-  #endif
-  /* BUGBUG: GCC only supports full barriers */
-  static __inline__ __attribute__((always_inline)) long _InterlockedExchange(volatile long * const Target, const long Value)
-  {
-    /* NOTE: __sync_lock_test_and_set would be an acquire barrier, so we force a full barrier */
-    _ReadWriteBarrier();
-    return __sync_lock_test_and_set(Target, Value);
-  }
-  /* --[ end GCC compatibility ]---------------------------------------------- */
 #endif
 #define interlockedcompareexchange _InterlockedCompareExchange
 #define interlockedexchange _InterlockedExchange
diff --git a/config.mak.uname b/config.mak.uname
index efaed94..01acd54 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -13,6 +13,11 @@ ifdef MSVC
 	uname_O := Windows
 endif
 
+ifdef MINGW
+	uname_S := MINGW
+	uname_O := MINGW
+endif
+
 # We choose to avoid "if .. else if .. else .. endif endif"
 # because maintaining the nesting to match is a pain.  If
 # we had "elif" things would have been much nicer...
@@ -508,7 +513,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
 	NO_INET_NTOP = YesPlease
 	NO_POSIX_GOODIES = UnfortunatelyYes
 	DEFAULT_HELP_FORMAT = html
-	COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32
+	COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -Icompat -Icompat/win32
 	COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
 	COMPAT_OBJS += compat/mingw.o compat/winansi.o \
 		compat/win32/pthread.o compat/win32/syslog.o \

-- 
Felipe Contreras

-- 
-- 
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups "msysGit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

  reply	other threads:[~2014-04-22  0:16 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-19 13:35 [ANNOUNCE] WinGit - native x86/x64 Git for Windows Marat Radchenko
2014-04-19 17:01 ` Thomas Braun
2014-04-19 17:37 ` Johannes Schindelin
2014-04-19 18:42 ` Heiko Voigt
2014-04-19 21:12   ` Sebastian Schuberth
2014-04-20 22:10   ` [msysGit] " Johannes Schindelin
2014-04-20 22:12     ` Johannes Schindelin
2014-04-21 18:37     ` Sebastian Schuberth
2014-04-21 18:56       ` Johannes Schindelin
2014-04-21 18:56         ` Felipe Contreras
2014-04-21 22:14           ` [NOT_A_PATCH] A naive attempt to cross-build Linux->mingw64 Git Marat Radchenko
2014-04-21 23:59             ` Felipe Contreras
2014-04-22  0:06               ` Felipe Contreras [this message]
2014-04-22 13:36                 ` Marat Radchenko
2014-04-22 16:08                   ` Felipe Contreras
2014-04-22 13:36             ` Johannes Schindelin
2014-04-22 13:14           ` Re: Re: [ANNOUNCE] WinGit - native x86/x64 Git for Windows Johannes Schindelin
2014-04-22 14:17             ` David Kastrup
2014-04-22 16:00             ` Re: " Felipe Contreras
2014-04-22 16:14               ` Johannes Schindelin
2014-04-19 20:56 ` Sebastian Schuberth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5355b2807a10c_1d5ab792ecfd@nysa.notmuch \
    --to=felipe.contreras@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=hvoigt@hvoigt.net \
    --cc=marat@slonopotamus.org \
    --cc=msysgit@googlegroups.com \
    --cc=sschuberth@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.