Create TOC

레이블이 cygwin인 게시물을 표시합니다. 모든 게시물 표시
레이블이 cygwin인 게시물을 표시합니다. 모든 게시물 표시

2013년 1월 21일

cygwin/error: cannot fork() for fetch-pack: Resource temporarily unavailable

cygwin 환경에서 git실행 시 아래와 같은 오류가 발생했다.

$ git clone https://주소
Cloning into '주소'...
       0 [main] git-remote-https 1076 child_info_fork::abort: cygldap-2-3-0.dll: Loaded to different address: parent(0x320000) != child(0x3A0000)
error: cannot fork() for fetch-pack: Resource temporarily unavailable

cygwin FAQ에 해결 방법이 나와 있다. 내 환경에서는 rebaseall명령으로 해결되었다.

cygwin/필요한 공유 라이브러리가 없어서 실행되지 않을 때

최근 cygwin을 다시 설치하고 curl을 실행했더니 아래와 같은 오류가 발생했다.

$ curl
/usr/bin/curl.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory

ldd을 이용해서 설치되지 않은 라이브러리를 찾던 도중 cygcurl-4.dll에서 아래와 같은 무수한 ???를 만나게 되었다.

$ ldd /usr/bin/cygcurl-4.dll
        ntdll.dll => /cygdrive/c/Windows/SysWOW64/ntdll.dll (0x77700000)
        kernel32.dll => /cygdrive/c/Windows/syswow64/kernel32.dll (0x75640000)
        KERNELBASE.dll => /cygdrive/c/Windows/syswow64/KERNELBASE.dll (0x74ff0000)
        ??? => ??? (0x63f80000)
        ??? => ??? (0x6ff60000)
        ??? => ??? (0x61000000)
        ??? => ??? (0x68b80000)
        ??? => ??? (0x6f550000)
        ??? => ??? (0x6b440000)
        ??? => ??? (0x67d40000)
        ??? => ??? (0x71440000)
        ??? => ??? (0x6a840000)
        ??? => ??? (0x6bc80000)
        ??? => ??? (0x44000000)
        ??? => ??? (0x70ec0000)
        ??? => ??? (0x67140000)
        ??? => ??? (0x6c100000)
        ??? => ??? (0x6fd50000)
        ??? => ??? (0x6fd70000)
        ??? => ??? (0x64d80000)
        ??? => ??? (0x71040000)
        ??? => ??? (0x6c400000)
        ??? => ??? (0x10000000)
        ??? => ??? (0x410000)

???의 정체를 알기 위해 구글링해본 결과 cygcheck을 사용해보라는 글이 있어서 cygcheck을 사용해 보았다.

$ cygcheck /bin/cygcurl-4.dll
C:\cygwin\bin\cygcurl-4.dll
  C:\cygwin\bin\cyggcc_s-1.dll
    C:\cygwin\bin\cygwin1.dll
      C:\Windows\system32\KERNEL32.dll
        C:\Windows\system32\API-MS-Win-Core-RtlSupport-L1-1-0.dll
        C:\Windows\system32\ntdll.dll
        C:\Windows\system32\KERNELBASE.dll
        C:\Windows\system32\API-MS-Win-Core-ProcessThreads-L1-1-0.dll
        C:\Windows\system32\API-MS-Win-Core-Heap-L1-1-0.dll
        C:\Windows\system32\API-MS-Win-Core-Memory-L1-1-0.dll
        C:\Windows\system32\API-MS-Win-Core-Handle-L1-1-0.dll
        C:\Windows\system32\API-MS-Win-Core-Synch-L1-1-0.dll
        C:\Windows\system32\API-MS-Win-Core-File-L1-1-0.dll
        C:\Windows\system32\API-MS-Win-Core-IO-L1-1-0.dll
        C:\Windows\system32\API-MS-Win-Core-ThreadPool-L1-1-0.dll
        C:\Windows\system32\API-MS-Win-Core-LibraryLoader-L1-1-0.dll
        C:\Windows\system32\API-MS-Win-Core-NamedPipe-L1-1-0.dll
        C:\Windows\system32\API-MS-Win-Core-Misc-L1-1-0.dll
        C:\Windows\system32\API-MS-Win-Core-SysInfo-L1-1-0.dll
        C:\Windows\system32\API-MS-Win-Core-Localization-L1-1-0.dll
        C:\Windows\system32\API-MS-Win-Core-ProcessEnvironment-L1-1-0.dll
        C:\Windows\system32\API-MS-Win-Core-String-L1-1-0.dll
        C:\Windows\system32\API-MS-Win-Core-Debug-L1-1-0.dll
        C:\Windows\system32\API-MS-Win-Core-ErrorHandling-L1-1-0.dll
        C:\Windows\system32\API-MS-Win-Core-Fibers-L1-1-0.dll
        C:\Windows\system32\API-MS-Win-Core-Util-L1-1-0.dll
        C:\Windows\system32\API-MS-Win-Core-Profile-L1-1-0.dll
        C:\Windows\system32\API-MS-Win-Security-Base-L1-1-0.dll
  C:\cygwin\bin\cygcrypto-1.0.0.dll
    C:\cygwin\bin\cygz.dll
  C:\cygwin\bin\cyggssapi-3.dll
    C:\cygwin\bin\cygheimntlm-0.dll
      C:\cygwin\bin\cygkrb5-26.dll
        C:\cygwin\bin\cygasn1-8.dll
          C:\cygwin\bin\cygroken-18.dll
            C:\cygwin\bin\cygcrypt-0.dll
          C:\cygwin\bin\cygcom_err-2.dll
        C:\cygwin\bin\cygwind-0.dll
        C:\cygwin\bin\cyghx509-5.dll
        C:\cygwin\bin\cygintl-8.dll
          C:\cygwin\bin\cygiconv-2.dll
        C:\cygwin\bin\cygsqlite3-0.dll
        C:\cygwin\bin\cygheimbase-1.dll
  C:\cygwin\bin\cygidn-11.dll
  C:\cygwin\bin\cyglber-2-4-2.dll
  C:\cygwin\bin\cygldap-2-4-2.dll
cygcheck: track_down: could not find cygsasl2-2.dll

    C:\cygwin\bin\cygssl-1.0.0.dll
  C:\cygwin\bin\cygssh2-1.dll

중간에 cygsasl2-2.dll이 없다고 나왔고, 관련 라이브러리를 설치 한 후 curl 실행 오류도 해결되었다.

2012년 8월 11일

cygwin/Windows 개발을 위한 Makefile template

cygwin에서 Windows 프로그램 개발을 위한 Makefile template.

BASECFLAGS = -DUNICODE -D_UNICODE -DWIN32 -D_WIN32 -Wall -Wextra -ffunction-sections -fdata-sections
CXXFLAGS = -fno-rtti -fno-exceptions

ifdef debug
	OPTFLAGS = -g -DDEBUG -Wall -Wextra -Wfloat-equal -Wunreachable-code
else
	OPTFLAGS = -Os -s -DNDEBUG
endif

ifdef x64
	MINGWPREFIX = x86_64-w64-mingw32
	CFLAGS = $(BASECFLAGS) $(OPTFLAGS) -DWIN64 -D_WIN64
else
	MINGWPREFIX = i686-pc-mingw32
	CFLAGS = $(BASECFLAGS) $(OPTFLAGS)
endif
LDFLAGS = -Wl,--gc-sections -mwindows -mno-cygwin

CC = $(MINGWPREFIX)-gcc
CXX = $(MINGWPREFIX)-g++
RES = $(MINGWPREFIX)-windres

%.o: %.c
	$(CC) $(CFLAGS) -c $< -o $@

%.o: %.cpp
	$(CXX) $(CFLAGS) $(CXXFLAGS) -c $< -o $@

%.res.o: %.rc
	$(RES) -i $< -o $@

위 Makefile은 아래와 같이 사용할 수 있다.

디버그 빌드시

$ make debug=1

x64 빌드시

$ make x64=1

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