This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Unable to run executables on other PCs


On Fri, 25 Apr 2003, Michael Purves wrote:

>     I have downloaded the cygwin programs, and compiled several of my
> own programs using gcc. The programs work with no problem on my PC when
> I use the cygwin window. Using a Command Prompt window, the programs
> work nearly perfectly. The one call in the programs that will not work
> is something like:
>
>     (void) system("cat file");
>
>     Other than re-writing the program, is there something I can do to
> make this work?

When you make this call, /bin might not be in your path.  You might try
changing the above to system("/bin/cat file").  Don't forget that "file"
should be a POSIX path.  It's also a good habit to always check the return
code of system calls, just in case.

Alternatively, something like this should also work(*):

    #include <stdio.h>
    FILE *fp = fopen("file","r");
    char buf[256];
    while (!feof(fp)) {
      fgets(fp, buf, 255); buf[255]='\0';
      printf("%s", buf);
    }

(*) Note, I haven't tested or compiled this, but it should give you a
general idea.

>     I copied my executables and the cygwin dll's to another Windows PC.
> This second PC does not have cygwin installed. When I run my programs, I
> get the following error message:
>
> 'cygwin': unknown terminal type.

You're most likely missing the mount table (so programs can't find /etc or
/usr/share/terminfo).

To recreate your mount table on another computer, run "mount -m >
mounts.bat" on the source machine, then copy over "mount.exe" and
"mounts.bat" to the target machine (along with cygwin1.dll and the rest of
the programs you need).  Make sure the root cygwin directory on the target
machine is the same as on the source machine, and run "mounts.bat".

You will also need to copy over /etc/termcap and the whole
/usr/share/terminfo/ tree (including symlinks, so you might want to use
"tar").  After a while it becomes tedious and too much bother, and you
might consider simply using "setup.exe" to install the needed set of
packages on the target machine.

>     Is it possible to run my executables on PCs without installing
> cygwin on them? If so, what do I need to do? I tried putting the
> /etc/termcap from cygwin PC into my DOS path; I set a HOME environment
> variable and put termcap in $HOME\etc; I made a directory d:\cygwin\etc
> and put termcap there, too. All to no avail.
>
> Michael Purves
> Yukon College

Why this aversion to installing Cygwin?  Cygwin installation doesn't touch
your machine except in the Cygwin root directory, and the mounts (which
are *currently* stored in the registry).  It will not install any extra
services or open up security holes (on its own).  When you copy over
Cygwin files, to make them work you have to perform the same steps as the
installation does, but manually.  Why bother?

If you are concerned about disk space, someone posted here a minimal set
of Cygwin packages that will work consistently.  Search the archives for
"minimal install".  There's no reason to not install Cygwin.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha at cs dot nyu dot edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor at watson dot ibm dot com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Knowledge is an unending adventure at the edge of uncertainty.
  -- Leto II


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]