public inbox for libffi-discuss@sourceware.org
 help / color / mirror / Atom feed
* Building on Mingw64
@ 2012-11-09 11:57 Daniel Holden
  2012-11-09 12:04 ` Luis Lavena
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Holden @ 2012-11-09 11:57 UTC (permalink / raw)
  To: libffi-discuss

Hi all,

I'm having a little trouble building libffi on Windows 7 64 bit using 
Mingw64 (http://mingw-w64.sourceforge.net/).

Here is the error message on compile:

libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I. -I../include 
-Iinclude -I..
src -DFFI_BUILDING -I. -I../include -Iinclude -I../src -DFFI_BUILDING -g 
-MT sr
/x86/win32.lo -MD -MP -MF src/x86/.deps/win32.Tpo -c ../src/x86/win32.S  
-DDLL_
XPORT -DPIC -o src/x86/.libs/win32.o
../src/x86/win32.S: Assembler messages:
../src/x86/win32.S:486: Error: invalid instruction suffix for `push'
../src/x86/win32.S:497: Error: invalid instruction suffix for `push'
../src/x86/win32.S:498: Error: invalid instruction suffix for `push'
../src/x86/win32.S:643: Error: invalid instruction suffix for `pop'
../src/x86/win32.S:652: Error: invalid instruction suffix for `push'
../src/x86/win32.S:669: Error: invalid instruction suffix for `push'
../src/x86/win32.S:768: Error: invalid instruction suffix for `pop'
../src/x86/win32.S:780: Error: invalid instruction suffix for `pop'
../src/x86/win32.S:797: Error: invalid instruction suffix for `push'
../src/x86/win32.S:799: Error: invalid instruction suffix for `push'
../src/x86/win32.S:814: Error: invalid instruction suffix for `push'
../src/x86/win32.S:818: Error: invalid instruction suffix for `push'
../src/x86/win32.S:918: Error: invalid instruction suffix for `pop'
../src/x86/win32.S:919: Error: invalid instruction suffix for `pop'
../src/x86/win32.S:934: Error: invalid instruction suffix for `push'
../src/x86/win32.S:1032: Error: invalid instruction suffix for `pop'
make[3]: *** [src/x86/win32.lo] Error 1

I know very little about assembly but this looks like a 32/64 bit issue. 
Is MinGW64 supported as a compiler?

The reason I ask is that I was getting some issues when I was using 
Pyton ctypes and trying to call particular functions in a C library 
compiled using MinGW64. The details I outlined in this stack overflow 
question:

http://stackoverflow.com/questions/13275211/python-ctypes-stack-corruption

I was going to test to see if just using libffi also gives any issues.

Thanks,

Dan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Building on Mingw64
  2012-11-09 11:57 Building on Mingw64 Daniel Holden
@ 2012-11-09 12:04 ` Luis Lavena
  2012-11-09 12:48   ` Daniel Holden
  0 siblings, 1 reply; 3+ messages in thread
From: Luis Lavena @ 2012-11-09 12:04 UTC (permalink / raw)
  To: Daniel Holden; +Cc: libffi-discuss

On Fri, Nov 9, 2012 at 8:56 AM, Daniel Holden
<theonlydancingbanana@hotmail.com> wrote:
> Hi all,
>
> I'm having a little trouble building libffi on Windows 7 64 bit using
> Mingw64 (http://mingw-w64.sourceforge.net/).
>
> Here is the error message on compile:
>
> libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I. -I../include -Iinclude
> -I..
> src -DFFI_BUILDING -I. -I../include -Iinclude -I../src -DFFI_BUILDING -g -MT
> sr
> /x86/win32.lo -MD -MP -MF src/x86/.deps/win32.Tpo -c ../src/x86/win32.S
> -DDLL_
> XPORT -DPIC -o src/x86/.libs/win32.o
> ../src/x86/win32.S: Assembler messages:
> ../src/x86/win32.S:486: Error: invalid instruction suffix for `push'
> ../src/x86/win32.S:497: Error: invalid instruction suffix for `push'
> ../src/x86/win32.S:498: Error: invalid instruction suffix for `push'
> ../src/x86/win32.S:643: Error: invalid instruction suffix for `pop'
> ../src/x86/win32.S:652: Error: invalid instruction suffix for `push'
> ../src/x86/win32.S:669: Error: invalid instruction suffix for `push'
> ../src/x86/win32.S:768: Error: invalid instruction suffix for `pop'
> ../src/x86/win32.S:780: Error: invalid instruction suffix for `pop'
> ../src/x86/win32.S:797: Error: invalid instruction suffix for `push'
> ../src/x86/win32.S:799: Error: invalid instruction suffix for `push'
> ../src/x86/win32.S:814: Error: invalid instruction suffix for `push'
> ../src/x86/win32.S:818: Error: invalid instruction suffix for `push'
> ../src/x86/win32.S:918: Error: invalid instruction suffix for `pop'
> ../src/x86/win32.S:919: Error: invalid instruction suffix for `pop'
> ../src/x86/win32.S:934: Error: invalid instruction suffix for `push'
> ../src/x86/win32.S:1032: Error: invalid instruction suffix for `pop'
> make[3]: *** [src/x86/win32.lo] Error 1
>
> I know very little about assembly but this looks like a 32/64 bit issue. Is
> MinGW64 supported as a compiler?
>

Did you use the configure script and provided the host?

configure --host=x86_64-w64-mingw32?

Because that is required to enable the 64bits mode on my end.

I've compiled libffi in 64bits mode without troubles with mingw-w64
compiler, see binary packages mentioned here:

https://groups.google.com/forum/?fromgroups=#!topic/rubyinstaller/Lp-OukkdGQE

The 64bits version was obtained using tdm64 variant of mingw-w64, but
is mingw-w64 at the end. The trick is always configure with the right
host flag.

Let us know if that helps.
--
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Building on Mingw64
  2012-11-09 12:04 ` Luis Lavena
@ 2012-11-09 12:48   ` Daniel Holden
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Holden @ 2012-11-09 12:48 UTC (permalink / raw)
  To: libffi-discuss

Hi,

Many Thanks - that managed to get it to compile.

I set up a small test program again and now I believe I have encountered 
the same issue I was getting when using Python ctypes. I will have to 
investigate a bit more before I have an idea of what exactly is going on 
but there is some very odd stuff and I may have found a bug.

For example upon calling the troublesome function using the ffi my 
program crashes and in the stack-trace is a call to a completely 
unrelated function in my library. I will try to get my head around what 
is happening and post a more detailed breakdown soon.

- Dan

On 09/11/2012 12:04, Luis Lavena wrote:
> On Fri, Nov 9, 2012 at 8:56 AM, Daniel Holden
> <theonlydancingbanana@hotmail.com> wrote:
>> Hi all,
>>
>> I'm having a little trouble building libffi on Windows 7 64 bit using
>> Mingw64 (http://mingw-w64.sourceforge.net/).
>>
>> Here is the error message on compile:
>>
>> libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I. -I../include -Iinclude
>> -I..
>> src -DFFI_BUILDING -I. -I../include -Iinclude -I../src -DFFI_BUILDING -g -MT
>> sr
>> /x86/win32.lo -MD -MP -MF src/x86/.deps/win32.Tpo -c ../src/x86/win32.S
>> -DDLL_
>> XPORT -DPIC -o src/x86/.libs/win32.o
>> ../src/x86/win32.S: Assembler messages:
>> ../src/x86/win32.S:486: Error: invalid instruction suffix for `push'
>> ../src/x86/win32.S:497: Error: invalid instruction suffix for `push'
>> ../src/x86/win32.S:498: Error: invalid instruction suffix for `push'
>> ../src/x86/win32.S:643: Error: invalid instruction suffix for `pop'
>> ../src/x86/win32.S:652: Error: invalid instruction suffix for `push'
>> ../src/x86/win32.S:669: Error: invalid instruction suffix for `push'
>> ../src/x86/win32.S:768: Error: invalid instruction suffix for `pop'
>> ../src/x86/win32.S:780: Error: invalid instruction suffix for `pop'
>> ../src/x86/win32.S:797: Error: invalid instruction suffix for `push'
>> ../src/x86/win32.S:799: Error: invalid instruction suffix for `push'
>> ../src/x86/win32.S:814: Error: invalid instruction suffix for `push'
>> ../src/x86/win32.S:818: Error: invalid instruction suffix for `push'
>> ../src/x86/win32.S:918: Error: invalid instruction suffix for `pop'
>> ../src/x86/win32.S:919: Error: invalid instruction suffix for `pop'
>> ../src/x86/win32.S:934: Error: invalid instruction suffix for `push'
>> ../src/x86/win32.S:1032: Error: invalid instruction suffix for `pop'
>> make[3]: *** [src/x86/win32.lo] Error 1
>>
>> I know very little about assembly but this looks like a 32/64 bit issue. Is
>> MinGW64 supported as a compiler?
>>
> Did you use the configure script and provided the host?
>
> configure --host=x86_64-w64-mingw32?
>
> Because that is required to enable the 64bits mode on my end.
>
> I've compiled libffi in 64bits mode without troubles with mingw-w64
> compiler, see binary packages mentioned here:
>
> https://groups.google.com/forum/?fromgroups=#!topic/rubyinstaller/Lp-OukkdGQE
>
> The 64bits version was obtained using tdm64 variant of mingw-w64, but
> is mingw-w64 at the end. The trick is always configure with the right
> host flag.
>
> Let us know if that helps.
> --
> Luis Lavena
> AREA 17
> -
> Perfection in design is achieved not when there is nothing more to add,
> but rather when there is nothing more to take away.
> Antoine de Saint-Exupéry
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-11-09 12:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-09 11:57 Building on Mingw64 Daniel Holden
2012-11-09 12:04 ` Luis Lavena
2012-11-09 12:48   ` Daniel Holden

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).