delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/07/12/03:37:36

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:in-reply-to:references:date
:message-id:subject:from:to:content-type; q=dns; s=default; b=lf
rK8C4TYOFHUBVUBYbqLYQRy0SFfV9bpq7UTjnJ7122JHVxfIGYqCkkqEaQ83mzzM
qBoRCz1fMXxTfQnAIUty1A46UTOfl5akU57vXp5J3nPx8ouaNH48aqLfPUrYCBlZ
y3v+Jzzwvqj0HXMHIjjLiiYsfCbFIl1fdNJn+MALk=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:in-reply-to:references:date
:message-id:subject:from:to:content-type; s=default; bh=B49yfykd
u9oxHCJ/YTgAaQysUxc=; b=HUIvuLUbYBEBzEJ64/12iqUVU2bjklo6N2zPu7ya
I79HL6hv4AAc8mvOjB/6dMmCQ/IQ96/pu/tjGFWNZgXzJhVal/GRdEZSwwnZ2rlM
Z+K+1mnSZiN2+pcsqTD0EylRl2S6x2DzKs7aTrvzOTSqddB3KJkaCuAOUKP+8lRw
6xE=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,SPF_PASS,TW_YG autolearn=ham version=3.3.1
MIME-Version: 1.0
X-Received: by 10.180.183.180 with SMTP id en20mr813271wic.58.1373614634056; Fri, 12 Jul 2013 00:37:14 -0700 (PDT)
In-Reply-To: <1373599038789-100686.post@n5.nabble.com>
References: <1372645646643-100307 DOT post AT n5 DOT nabble DOT com> <51D166B0 DOT 9020807 AT aol DOT com> <1373599038789-100686 DOT post AT n5 DOT nabble DOT com>
Date: Fri, 12 Jul 2013 09:37:14 +0200
Message-ID: <CAEhDDbAVEA2SbXNo=wfDFtJOKqp2WJOv0TYB6eJwX+V8tgH8fg@mail.gmail.com>
Subject: Re: An issue with Matlab for a mex file compiled with GNU CYGWIN g++
From: Csaba Raduly <rcsaba AT gmail DOT com>
To: cygwin AT cygwin DOT com

Hi Emad,

On Fri, Jul 12, 2013 at 5:17 AM, Emad Gad  wrote:
(snip)
> And that led me to conclude that the i686-w64-mingw32-g++ is the way to go
(snip)

> The troubles I am having now is how to build the cmake-based project with
> i686-w64-mingw32-g++ compiler, through the cygwin shell? Somehow, I feel
> that this may be a contradiction in terms, but let me first report my
> observations.
>
> The main issue here is that the cmake that comes with cygwin will not accept
> the compiler i686-w64-mingw32-g++. It will complain that that compiler
> "cannot compile a simple file" which is a lie, because I know that it does.
> I actually tested, and Matlab used successfully. So how come cmake found out
> that it fails to compile?
>
> I found out the reason by invoking cmake with the option --debug-trycompile,
> and there I saw what cmake is trying to do and how it failed.
>
> cmake tests the compiler by requesting it to compile a very small file,
> called textCCompile.c, that it creates on the fly. However, its uses the
> absolute path of this file. To be more precise, here is the literal command
> that the /cygwinish/ cmake issues
>
> /cygdrive/c/MinGW64/mingw64/i686-w64-mingw32-g++ -o
> cmTryxxxxxxxx/testCCompile.c.o -c
> /home/usrername/path/to/the/file/build/CMakeFiles/CMakeTmp/testCCompile.c.
>
> The main problem here is that i686-w64-mingw32-g++ will not take the
> absolute path of the C file /home/usrername/path/to/the/file/testCCompile.c.
> Instead, it returns a "file not found" kind of error.

The problem is that /cygdrive/c/MinGW64/mingw64/i686-w64-mingw32-g++
is not a Cygwin program, so it interprets
/home/usrername/path/to/the/file/testCCompile.c differently from
Cygwin's cmake : as a path on the current drive, starting with a
directory named "home". However, Cygwin's /home is Windows'
C:\cygwin\home

Cygwin contains a utility called "cygpath" which can convert between
POSIX paths and Windows paths:

$ cygpath -w /home/usrername/path/to/the/file/testCCompile.c
C:\cygwin\home\usrername\path\to\the\file\testCCompile.c

Unfortunately, I don't think you can force cmake to pass all paths through it.

> So I feel now that the main problem is that mingw compiler, which worked
> with Matlab, the i686-w64-mingw32-g++, does not like UNIX-style absolute
> paths, and will not be able to grab any file specified using this mode.
>
> So my question is am I in the right place? Is it normal to use a
> cygwin-based cmake to compile a project with i686-w64-mingw32-g++?

It may be possible to force cmake to accept the compiler you specify
without checking, e.g. in the environment, like this:

CXX=/cygdrive/c/MinGW64/mingw64/i686-w64-mingw32-g++  cmake
--trust-the-compiler --the-compiler-is-your-friend path/to/sources

But it's likely that the makefiles it generates would also use POSIX
paths, and i686-w64-mingw32-g++ will not understand them unless you
hack the makefiles to use cygpath to translate filenames before make
passes them to i686-w64-mingw32-g++

I suspect it would be easier to use the native Windows version of
cmake with the mingw compiler.

Csaba
-- 
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019