Create TOC

2006년 11월 16일

cygwin

설정 내용

~/.inputrc

set meta-flag on
set convert-meta off
set output-meta on
set completion-ignore-case on
set horizontal-scroll-mode on
set show-all-if-ambiguous on

~/.bashrc

alias ls='ls --show-control-chars -F --color=tty'
export PS1='\u@\h\w\$ '

rxvt 사용

아래와 같은 batch file을 작성한다.

@echo off

C:
chdir \cygwin\bin

set CYGWIN=tty

rxvt -tn xterm -rv -fn fixedsys -e /bin/bash --login -i

MingW로 build

link 옵션에 아래 내용 추가

--target=i686-pc-mingw32 -mno-cygwin

gcc 3.4.4 버그

cygwin/gcc 3.4.4 에서는 -mno-cygwin 옵션을 주면 링크 에러가 난다. 해결책은 아래 링크에 있다

http://www.hotsolder.com/labels/cygwin.html

만일을 위해 일부를 발췌해 놓는다.

1) In /usr/lib/gcc there is a directory for i686-pc-mingw32/3.4.4. In that directory, the Cygwin installer put ordinary .lnk files linking back to /usr/lib/gcc/i686-pc-cygwin/3.4.4. None of these work, so the first step is to make hard or symbolic links to the correct files. For example, cc1.exe.lnk needs to be fixed (from the i686-pc-mingw32/3.4.4 directory):
ln ../i686-pc-cygwin/cc1.exe cc1.exe
Fix all the links in this way. Now gcc will run with -mno-cygwin, but it still won't link. 2) The problem is, gcc is a driver and the specs file is broken. In the same directory, edit the file named specs. The trick here is we need to change the references to crt2.o to refer to a specific path (/usr/lib/mingw/crt2.0). We also need to add -L/usr/lib/mingw to several places. Here's a diff between the standard specs file and mine (significant additions in red):
$ diff specs ../../i686-pc-cygwin/3.4.4/specs
51c51
<   %{pg:-lgmon}   %{!mno-cygwin:-lcygwin}   %{mno-cygwin:%{mthreads:-lmingwthrd -L/usr/lib/mingw} -lmingw32}   %{mwindows:-lgdi32 -lcomdlg32}   -luser32 -lkernel32 -ladvapi32 -lshell32
---
>   %{pg:-lgmon}   %{!mno-cygwin:-lcygwin}   %{mno-cygwin:%{mthreads:-lmingwthrd} -lmingw32}   %{mwindows:-lgdi32 -lcomdlg32}   -luser32 -lkernel32 -ladvapi32 -lshell32
54c54
< %{mno-cygwin: %{mthreads:-lmingwthrd} -lmingw32} -lgcc           %{mno-cygwin:-lmoldname -lmingwex -lmsvcrt -L/usr/lib/mingw}
---
> %{mno-cygwin: %{mthreads:-lmingwthrd} -lmingw32} -lgcc           %{mno-cygwin:-lmoldname -lmingwex -lmsvcrt}
57c57
<   %{shared|mdll: %{mno-cygwin:dllcrt2%O%s}}  %{!shared: %{!mdll: %{!mno-cygwin:crt0%O%s} %{mno-cygwin:/usr/lib/mingw/crt2%O%s} %{mno-cygwin:-L/usr/lib/mingw}  %{pg:gcrt0%O%s}}}
---
>   %{shared|mdll: %{mno-cygwin:dllcrt2%O%s}}  %{!shared: %{!mdll: %{!mno-cygwin:crt0%O%s} %{mno-cygwin:crt2%O%s}  %{pg:gcrt0%O%s}}}

Running a native win32 application from cygwin/bash

http://hermitte.free.fr/cygwin/#Win32