public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Michael Soegtrop <MSoegtrop@yahoo.de>
To: Jose Isaias Cabrera <jicman@outlook.com>,
	"cygwin@cygwin.com" <cygwin@cygwin.com>
Subject: Re: Creating the sqlite3.exe stand-alone w/o cygwin dependency
Date: Sun, 11 Dec 2022 21:41:31 +0100	[thread overview]
Message-ID: <32b257b8-b9db-67d5-4c9a-597700027647@yahoo.de> (raw)
In-Reply-To: <DB9P251MB0063791D209FB7A612196349DE1E9@DB9P251MB0063.EURP251.PROD.OUTLOOK.COM>

Hi José,

Yes, I did. I think you missed one of my emails. But, here is what I did:
> $ ldd sqlite3.exe
>          ntdll.dll => /cygdrive/c/Windows/SYSTEM32/ntdll.dll (0x7ffc1d6f0000)
>          ntdll.dll => /cygdrive/c/Windows/SysWOW64/ntdll.dll (0x778c0000)
>          wow64.dll => /cygdrive/c/Windows/System32/wow64.dll (0x7ffc1c830000)
>          wow64win.dll => /cygdrive/c/Windows/System32/wow64win.dll (0x7ffc1d540000)

Ah, you compiled a 32 bit executable - I guess on a 64 bit install of 
cygwin.

Try

./configure --host=x86_64-w64-mingw32 CFLAGS=-shared CFLAGS=-static-libgcc

instead of

./configure --host=i686-w64-mingw32 CFLAGS=-shared CFLAGS=-static-libgcc

Of course you need to install the corresponding tool chain in cygwin.

As far as I can tell compiling 32 bit apps on 64 bit cygwin did never 
work (easily). Afair the reason is that certain DLLs like 
SYSTEM32/ntdll.dll have 2 copies under the same file name, a 32 bit and 
a 64 bit variant (a Windows file system hack). Which one you get depends 
on if the calling process is 32 bit or 64 bit. Now if you try to link a 
32 bit executable with a 64 bit linker, it gets the wrong DLL, so your 
32 bit app ends up being linked to a 64 bit DLL.

One could only compile 32 bit Windows apps with 32 bit cygwin - since 
this is no longer supported, I would say 32 bit MinGW is neither. There 
are hacks around this (use a 32 bit executable to copy the DLLs from 
System32 somewhere else and redirect the linker to these files). But the 
better choice is to stop compiling for 32 bit.

Best regards,

Michael


  reply	other threads:[~2022-12-11 20:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-09 21:34 Jose Isaias Cabrera
2022-12-09 23:33 ` Eliot Moss
2022-12-10  2:43   ` Jose Isaias Cabrera
2022-12-10 14:47     ` Eliot Moss
2022-12-10 15:36       ` Cristobal Escamilla Cavazos
2022-12-10 16:35       ` Jose Isaias Cabrera
2022-12-10 14:42 ` Ken Brown
2022-12-10 15:20   ` Michael Soegtrop
2022-12-10 18:00     ` Jose Isaias Cabrera
2022-12-11  3:31       ` Jose Isaias Cabrera
2022-12-11 10:23         ` Michael Soegtrop
2022-12-11 20:03           ` Jose Isaias Cabrera
2022-12-11 20:41             ` Michael Soegtrop [this message]
2022-12-12 23:22               ` Jose Isaias Cabrera

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=32b257b8-b9db-67d5-4c9a-597700027647@yahoo.de \
    --to=msoegtrop@yahoo.de \
    --cc=cygwin@cygwin.com \
    --cc=jicman@outlook.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 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).