public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* compile ncurses "hello world" to run independent of cygwin?
@ 2015-11-02  3:04 Daniel Goldman
  2015-11-02  4:09 ` Darik Horn
  2015-11-02 12:42 ` cyg Simple
  0 siblings, 2 replies; 7+ messages in thread
From: Daniel Goldman @ 2015-11-02  3:04 UTC (permalink / raw)
  To: cygwin

I have a Windows 7 / 64 bit PC.

I just installed 32 bit cygwin to d:\cygin\. Installed everything.
https://cygwin.com/faq.html#faq.setup.everything

I started up the Cygwin Terminal.

$ echo $PATH
/usr/local/bin:/usr/bin:/cygdrive/c/Program Files/Common Files/Microsoft 
Shared/Windows Live:/cygdrive/c/Program Files (x86)/Common 
Files/Microsoft Shared/Windows 
Live:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program 
Files (x86)/Intel/OpenCL SDK/3.0/bin/x86:/cygdrive/c/Program Files 
(x86)/Intel/OpenCL SDK/3.0/bin/x64:/cygdrive/d/Program Files 
(x86)/Putty:/cygdrive/c/Program Files (x86)/Windows 
Live/Shared:/cygdrive/d/msys64/usr/bin:/usr/lib/lapack:/usr/openwin/bin

$ cat ncurses-1.c
// http://www.tldp.org/HOWTO/NCURSES-Programming-HOWTO/helloworld.html

#include <curses.h>

int main()
  {
  initscr(); /* Start curses mode */
  printw("Hello World !!!"); /* Print Hello World */
  refresh(); /* Print it on to the real screen */
  getch(); /* Wait for user input */
  endwin(); /* End curses mode */

  return 0;
  }

$ gcc ncurses-1.c -lncurses

$ ./a.exe # runs perfectly under cygwin

$ i686-pc-mingw32-gcc -I /usr/include ncurses-1.c -L /lib -lncurses

$ ./a.exe
Segmentation fault

Switching to a windows 7 command window (dos window), and running a.exe, 
I get an error message:

"the program can't start because cygncursesw-10.dll is missing..."

What am I doing wrong? How do I use cygwin to compile the test ncurses 
program so it can run in a dos terminal, independent of cygwin? I looked 
around the docs and archives and could not figure out.

Thanks,
Daniel

--
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] 7+ messages in thread

* Re: compile ncurses "hello world" to run independent of cygwin?
  2015-11-02  3:04 compile ncurses "hello world" to run independent of cygwin? Daniel Goldman
@ 2015-11-02  4:09 ` Darik Horn
  2015-11-02 12:48   ` cyg Simple
  2015-11-02 12:42 ` cyg Simple
  1 sibling, 1 reply; 7+ messages in thread
From: Darik Horn @ 2015-11-02  4:09 UTC (permalink / raw)
  To: cygwin

On Sun, Nov 1, 2015 at 10:04 PM, Daniel Goldman <dgoldman@ehdp.com> wrote:
>
> What am I doing wrong? How do I use cygwin to compile the test ncurses
> program so it can run in a dos terminal, independent of cygwin? I looked
> around the docs and archives and could not figure out.

Was libncurses built for the MinGW target on the Cygwin host?

Keep in mind that this job is a cross compile, so ncurses and every
other dependency must be built for the MinGW runtime.  The mingw-* and
mingw64-* packages for Cygwin are just the toolchain plus some
essentials; there is no mingw-libncurses-devel package in
distribution.

Unless there is a specific reason to cross through Cygwin, it could be
easier to use the native MinGW environment directly:

* http://www.mingw.org/wiki/Getting_Started

And link against the ncurses redistributable:

* http://invisible-mirror.net/ncurses/ncurses.html

--
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] 7+ messages in thread

* Re: compile ncurses "hello world" to run independent of cygwin?
  2015-11-02  3:04 compile ncurses "hello world" to run independent of cygwin? Daniel Goldman
  2015-11-02  4:09 ` Darik Horn
@ 2015-11-02 12:42 ` cyg Simple
  1 sibling, 0 replies; 7+ messages in thread
From: cyg Simple @ 2015-11-02 12:42 UTC (permalink / raw)
  To: cygwin

On 11/1/2015 10:04 PM, Daniel Goldman wrote:
> 
> $ gcc ncurses-1.c -lncurses
> 
> $ ./a.exe # runs perfectly under cygwin
> 

A Cygwin build using the Cygwin runtime should work.

> $ i686-pc-mingw32-gcc -I /usr/include ncurses-1.c -L /lib -lncurses
> 
> $ ./a.exe
> Segmentation fault
> 

A MinGW build using the Cygwin runtime should *never* work.

> 
> What am I doing wrong? How do I use cygwin to compile the test ncurses
> program so it can run in a dos terminal, independent of cygwin? I looked
> around the docs and archives and could not figure out.
> 

You need to specify include and lib paths that contain MinGW libraries.
 Don't use the Cygwin native paths of /usr/include and /lib.  This means
that you need a ncurses library that is built with MinGW.

-- 
cyg Simple

--
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] 7+ messages in thread

* Re: compile ncurses "hello world" to run independent of cygwin?
  2015-11-02  4:09 ` Darik Horn
@ 2015-11-02 12:48   ` cyg Simple
  2015-11-02 15:14     ` Greg Freemyer
  0 siblings, 1 reply; 7+ messages in thread
From: cyg Simple @ 2015-11-02 12:48 UTC (permalink / raw)
  To: cygwin

On 11/1/2015 11:09 PM, Darik Horn wrote:
> 
> Unless there is a specific reason to cross through Cygwin, it could be
> easier to use the native MinGW environment directly:
> 
> * http://www.mingw.org/wiki/Getting_Started
> 

Poppycock! There is no reason that the user couldn't use Cygwin as the
one and only system to build native binaries.

> And link against the ncurses redistributable:
> 
> * http://invisible-mirror.net/ncurses/ncurses.html
> 

Building your own native library with a known set of compilers and
options may be better than depending on someone's build where you don't
know for certain the system, options and compiler used.

-- 
cyg Simple

--
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] 7+ messages in thread

* Re: compile ncurses "hello world" to run independent of cygwin?
  2015-11-02 12:48   ` cyg Simple
@ 2015-11-02 15:14     ` Greg Freemyer
  2015-11-02 15:34       ` Darik Horn
  2015-11-02 15:49       ` Corinna Vinschen
  0 siblings, 2 replies; 7+ messages in thread
From: Greg Freemyer @ 2015-11-02 15:14 UTC (permalink / raw)
  To: cygwin

On Mon, Nov 2, 2015 at 7:48 AM, cyg Simple <cygsimple@gmail.com> wrote:
> On 11/1/2015 11:09 PM, Darik Horn wrote:
>>
>> Unless there is a specific reason to cross through Cygwin, it could be
>> easier to use the native MinGW environment directly:
>>
>> * http://www.mingw.org/wiki/Getting_Started
>>
>
> Poppycock! There is no reason that the user couldn't use Cygwin as the
> one and only system to build native binaries.

I'm relatively new to this mailing list.  Apologies if this is well
covered ground....

The last time I checked (a few years ago), my understanding was the
cygwin dll's were licensed such that any programs using them had to be
GPL (or equivalent).

Is that wrong?

If so, anyone wanting to write a commercial tool has to avoid the
cygwin's core dll's.

Does using mingw do so?

Thanks
Greg

--
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] 7+ messages in thread

* Re: compile ncurses "hello world" to run independent of cygwin?
  2015-11-02 15:14     ` Greg Freemyer
@ 2015-11-02 15:34       ` Darik Horn
  2015-11-02 15:49       ` Corinna Vinschen
  1 sibling, 0 replies; 7+ messages in thread
From: Darik Horn @ 2015-11-02 15:34 UTC (permalink / raw)
  To: cygwin

On Mon, Nov 2, 2015 at 10:14 AM, Greg Freemyer <greg.freemyer@gmail.com> wrote:
>
> The last time I checked (a few years ago), my understanding was the
> cygwin dll's were licensed such that any programs using them had to be
> GPL (or equivalent).
>
> Is that wrong?

No, that is still the case:

* https://cygwin.com/licensing.html


> If so, anyone wanting to write a commercial tool has to avoid the
> cygwin's core dll's.

Or buy a license.


> Does using mingw do so?

No, it is easier to avoid GPL obligations by using the MinGW runtime:

* http://www.mingw.org/license

--
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] 7+ messages in thread

* Re: compile ncurses "hello world" to run independent of cygwin?
  2015-11-02 15:14     ` Greg Freemyer
  2015-11-02 15:34       ` Darik Horn
@ 2015-11-02 15:49       ` Corinna Vinschen
  1 sibling, 0 replies; 7+ messages in thread
From: Corinna Vinschen @ 2015-11-02 15:49 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1565 bytes --]

On Nov  2 10:14, Greg Freemyer wrote:
> On Mon, Nov 2, 2015 at 7:48 AM, cyg Simple <cygsimple@gmail.com> wrote:
> > On 11/1/2015 11:09 PM, Darik Horn wrote:
> >>
> >> Unless there is a specific reason to cross through Cygwin, it could be
> >> easier to use the native MinGW environment directly:
> >>
> >> * http://www.mingw.org/wiki/Getting_Started
> >>
> >
> > Poppycock! There is no reason that the user couldn't use Cygwin as the
> > one and only system to build native binaries.
> 
> I'm relatively new to this mailing list.  Apologies if this is well
> covered ground....
> 
> The last time I checked (a few years ago), my understanding was the
> cygwin dll's were licensed such that any programs using them had to be
> GPL (or equivalent).

Yes, when linking against the Cygwin DLL there are GPL issues.

But that wasn't what "cyg Simple" was referring to.  The Cygwin distro
comes with a Mingw-w64 cross compiler and libs.  When you use those to
create Mingw binaries, you are not linking against the Cygwin DLL.

So, as "cyg Simple" wrote, there's no reason that you can't use the
Cygwin distro as environment to build non-Cygwin binaries.

There's also the fact that the aforementioned mingw.org project is
rather behind.  The Mingw-w64 fork (which is used by Cygwin as well,
incidentally) is more up to speed in terms of WIndows lib and header
file support.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2015-11-02 15:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-02  3:04 compile ncurses "hello world" to run independent of cygwin? Daniel Goldman
2015-11-02  4:09 ` Darik Horn
2015-11-02 12:48   ` cyg Simple
2015-11-02 15:14     ` Greg Freemyer
2015-11-02 15:34       ` Darik Horn
2015-11-02 15:49       ` Corinna Vinschen
2015-11-02 12:42 ` cyg Simple

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