public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* How to build a DLL without cygwin DLL dependencies
@ 2019-05-29 17:02 Jose Isaias Cabrera
  2019-05-29 17:55 ` Tony Kelman
  0 siblings, 1 reply; 8+ messages in thread
From: Jose Isaias Cabrera @ 2019-05-29 17:02 UTC (permalink / raw)
  To: cygwin


Greetings!

I am trying to build the latest sqlite windows DLL, and I am succeeding, but I am getting an error that cygwin1.dll is missing, when I am trying to use the DLL from outside cygwin in the Windows environment.  I am using,

gcc -shared sqlite3.c -o sqlite3.dll

to build it, but this command creates a dependency for cygwin1.dll.  Is there any way to build the dll as a standalone DLL with no dependency?  Thanks.

josé

--
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

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

* Re: How to build a DLL without cygwin DLL dependencies
  2019-05-29 17:02 How to build a DLL without cygwin DLL dependencies Jose Isaias Cabrera
@ 2019-05-29 17:55 ` Tony Kelman
  2019-05-29 18:27   ` Jose Isaias Cabrera
  0 siblings, 1 reply; 8+ messages in thread
From: Tony Kelman @ 2019-05-29 17:55 UTC (permalink / raw)
  To: Jose Isaias Cabrera, cygwin

> I am trying to build the latest sqlite windows DLL, and I am
> succeeding, but I am getting an error that cygwin1.dll is missing,
> when I am trying to use the DLL from outside cygwin in the Windows
> environment.  I am using,
>
> gcc -shared sqlite3.c -o sqlite3.dll
>
> to build it, but this command creates a dependency for cygwin1.dll.
> Is there any way to build the dll as a standalone DLL with no
> dependency?  Thanks.

Yep, you want the mingw-w64 cross compiler, x86_64-w64-mingw32-gcc
(or i686-w64-mingw32-gcc for 32 bit). There's a cross-compiled sqlite
package already available under mingw64-x86_64-sqlite3 in setup - or
http://mirrors.kernel.org/sourceware/cygwin/noarch/release/mingw64-x86_64-sqlite3/mingw64-x86_64-sqlite3-3.19.3-1.tar.xz
if you're okay with that particular release.

--
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

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

* Re: How to build a DLL without cygwin DLL dependencies
  2019-05-29 17:55 ` Tony Kelman
@ 2019-05-29 18:27   ` Jose Isaias Cabrera
  2019-05-29 20:18     ` Tony Kelman
  0 siblings, 1 reply; 8+ messages in thread
From: Jose Isaias Cabrera @ 2019-05-29 18:27 UTC (permalink / raw)
  To: Tony Kelman, cygwin


Tony Kelman, on Wednesday, May 29, 2019 01:55 PM, wrote...
>>
>> gcc -shared sqlite3.c -o sqlite3.dll
>>
>> to build it, but this command creates a dependency for cygwin1.dll.
>> Is there any way to build the dll as a standalone DLL with no
>> dependency?  Thanks.
>
>Yep, you want the mingw-w64 cross compiler, x86_64-w64-mingw32-gcc
>(or i686-w64-mingw32-gcc for 32 bit).

Thanks for the prompt reply, Tony.

So, I downloaded "i686-w64-mingw32-gcc" from the setup packages and ran,

i686-w64-mingw32-gcc -shared sqlite3.c -o sqlite3.dll,

but it still wants me to add other DLLs.  I just want to drop the sqlite3.dll just created in another spot and run a tool using that without need of any other DLL. I know I can do it with MinGW, but I don't want to install two systems on my computer.  I know I am missing something because I know other folks have done it before.  I duckduckgo'ed some answers, but have not found anything but "use MinGW".  Is this even possible with cygwin and its packages?  Thanks for the support.

josé



--
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

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

* Re: How to build a DLL without cygwin DLL dependencies
  2019-05-29 18:27   ` Jose Isaias Cabrera
@ 2019-05-29 20:18     ` Tony Kelman
  2019-05-30  2:51       ` Jose Isaias Cabrera
  0 siblings, 1 reply; 8+ messages in thread
From: Tony Kelman @ 2019-05-29 20:18 UTC (permalink / raw)
  To: Jose Isaias Cabrera, cygwin

> So, I downloaded "i686-w64-mingw32-gcc" from the setup packages and ran,
> i686-w64-mingw32-gcc -shared sqlite3.c -o sqlite3.dll,
> but it still wants me to add other DLLs.  I just want to drop the
> sqlite3.dll just created in another spot and run a tool using that
> without need of any other DLL. I know I can do it with MinGW, but I
> don't want to install two systems on my computer.  I know I am missing
> something because I know other folks have done it before.
> I duckduckgo'ed some answers, but have not found anything but
> "use MinGW".  Is this even possible with cygwin and its packages?

You just did "use MinGW with cygwin and its packages." MinGW is the
compiler triple you just used via a cross compiler. The end user
system won't need cygwin, and it won't need a compiler. Would be good
if you were more specific about what "it" you're referring to and which
"other DLLs" you mean. I just tried what you described:

curl -L https://www.sqlite.org/2019/sqlite-autoconf-3280000.tar.gz | tar -xz
cd sqlite-autoconf-3280000
i686-w64-mingw32-gcc -shared sqlite3.c -o sqlite3.dll

and dependency walker is telling me there are a few dependencies on
libgcc_s_sjlj-1.dll for __divdi3 etc. That's a compiler runtime dll
and you can avoid the issue by building a 64 bit dll, or in 32 bit via

i686-w64-mingw32-gcc -shared -static-libgcc sqlite3.c -o sqlite3.dll

--
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

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

* Re: How to build a DLL without cygwin DLL dependencies
  2019-05-29 20:18     ` Tony Kelman
@ 2019-05-30  2:51       ` Jose Isaias Cabrera
  2019-05-31 17:01         ` Tatsuro MATSUOKA
  0 siblings, 1 reply; 8+ messages in thread
From: Jose Isaias Cabrera @ 2019-05-30  2:51 UTC (permalink / raw)
  To: Tony Kelman, cygwin


Tony Kelman, on Wednesday, May 29, 2019 04:18 PM, wrote...
>and you can avoid the issue by building a 64 bit dll, or in 32 bit via
>
>i686-w64-mingw32-gcc -shared -static-libgcc sqlite3.c -o sqlite3.dll
>

This is what I needed above. The command I was using,

i686-w64-mingw32-gcc -shared sqlite3.c -o sqlite3.dll

will create a DLL, but it will have dependencies on some cygwin libs.  This command,

i686-w64-mingw32-gcc -shared -static-libgcc sqlite3.c -o sqlite3.dll

creates a DLL with no dependencies.  So, the option -static-libgcc is what I needed.  Thanks.

To summarize, when creating SQLite3 DLL or building any SQLite3 tools with cygwin,
1. Download the i686-w65-mingw32-gcc compiler with the setup tools (the 64 bit)
2. Get the source from sqlite.org
3. untar source
4. cd to the source directory
5. run this command:
i686-w64-mingw32-gcc -shared -static-libgcc sqlite3.c -o sqlite3.dll

Thanks,

josé

--
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

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

* Re: How to build a DLL without cygwin DLL dependencies
  2019-05-30  2:51       ` Jose Isaias Cabrera
@ 2019-05-31 17:01         ` Tatsuro MATSUOKA
  2019-05-31 17:14           ` Jose Isaias Cabrera
  0 siblings, 1 reply; 8+ messages in thread
From: Tatsuro MATSUOKA @ 2019-05-31 17:01 UTC (permalink / raw)
  To: Jose Isaias Cabrera, Tony Kelman, cygwin

--- jicma wrote:
> 
> Tony Kelman, on Wednesday, May 29, 2019 04:18 PM, wrote...
> >and you can avoid the issue by building a 64 bit dll, or in 32 bit via
> >
> >i686-w64-mingw32-gcc -shared -static-libgcc sqlite3.c -o sqlite3.dll
> >
> 
> This is what I needed above. The command I was using,
> 
> i686-w64-mingw32-gcc -shared sqlite3.c -o sqlite3.dll
> 
> will create a DLL, but it will have dependencies on some cygwin libs.  This command,
> 
> i686-w64-mingw32-gcc -shared -static-libgcc sqlite3.c -o sqlite3.dll
> 
> creates a DLL with no dependencies.  So, the option -static-libgcc is what I needed.  Thanks.
> 
> To summarize, when creating SQLite3 DLL or building any SQLite3 tools with cygwin,
> 1. Download the i686-w65-mingw32-gcc compiler with the setup tools (the 64 bit)
> 2. Get the source from sqlite.org
> 3. untar source
> 4. cd to the source directory
> 5. run this command:
> i686-w64-mingw32-gcc -shared -static-libgcc sqlite3.c -o sqlite3.dll
> 
> Thanks,
> 
> josé
> 
If you will have another opportunity to build natitve windows exe or dll, please consider to use msys2.

Tatsuro


--
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

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

* Re: How to build a DLL without cygwin DLL dependencies
  2019-05-31 17:01         ` Tatsuro MATSUOKA
@ 2019-05-31 17:14           ` Jose Isaias Cabrera
  2019-05-31 18:24             ` Brian Inglis
  0 siblings, 1 reply; 8+ messages in thread
From: Jose Isaias Cabrera @ 2019-05-31 17:14 UTC (permalink / raw)
  To: Tatsuro MATSUOKA, Tony Kelman, cygwin


Tatsuro MATSUOKA, on Friday, May 31, 2019 01:01 PM, wrote...
> If you will have another opportunity to build natitve windows exe or dll, please consider to use msys2.

I tried, but the installation doesn't even come with gcc.  So, being behind a firewall, I couldn't use
pacman to get stuff installed.  So, I aborted the idea.  Thanks.

josé


--
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

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

* Re: How to build a DLL without cygwin DLL dependencies
  2019-05-31 17:14           ` Jose Isaias Cabrera
@ 2019-05-31 18:24             ` Brian Inglis
  0 siblings, 0 replies; 8+ messages in thread
From: Brian Inglis @ 2019-05-31 18:24 UTC (permalink / raw)
  To: cygwin

On 2019-05-31 11:14, Jose Isaias Cabrera wrote:
> Tatsuro MATSUOKA, on Friday, May 31, 2019 01:01 PM, wrote...
>> If you will have another opportunity to build natitve windows exe or dll, 
>> please consider to use msys2.
> I tried, but the installation doesn't even come with gcc. So, being behind a 
> firewall, I couldn't use pacman to get stuff installed. So, I aborted the 
> idea.
Could you install WSL Debian/Ubuntu or use a Linux system to cross-build MSYS2
and sqlite3 as in https://arrayfire.com/cross-compile-to-windows-from-linux/

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.

--
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

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

end of thread, other threads:[~2019-05-31 18:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-29 17:02 How to build a DLL without cygwin DLL dependencies Jose Isaias Cabrera
2019-05-29 17:55 ` Tony Kelman
2019-05-29 18:27   ` Jose Isaias Cabrera
2019-05-29 20:18     ` Tony Kelman
2019-05-30  2:51       ` Jose Isaias Cabrera
2019-05-31 17:01         ` Tatsuro MATSUOKA
2019-05-31 17:14           ` Jose Isaias Cabrera
2019-05-31 18:24             ` Brian Inglis

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).