Bigeye's techlog

Recent Tweets @_bigeye
Who I Follow

파이썬 OpenSSL 라이브러리인 pyOpenSSL의 최신버젼은 0.13이다. (2011년 1월 2일 기준)

하지만 설치를 하다보니 다음과 같이 Build에 실패하는 것이었다.

$ easy_install pyOpenSSL

…(중략)

OpenSSL/ssl/connection.c: In function ‘ssl_Connection_set_context’:
OpenSSL/ssl/connection.c:289: warning: implicit declaration of function ‘SSL_set_SSL_CTX’
OpenSSL/ssl/connection.c: In function ‘ssl_Connection_get_servername’:
OpenSSL/ssl/connection.c:313: error: ‘TLSEXT_NAMETYPE_host_name’ undeclared (first use in this function)
OpenSSL/ssl/connection.c:313: error: (Each undeclared identifier is reported only once
OpenSSL/ssl/connection.c:313: error: for each function it appears in.)
OpenSSL/ssl/connection.c:320: warning: implicit declaration of function ‘SSL_get_servername’
OpenSSL/ssl/connection.c:320: warning: assignment makes pointer from integer without a cast
OpenSSL/ssl/connection.c: In function ‘ssl_Connection_set_tlsext_host_name’:
OpenSSL/ssl/connection.c:346: warning: implicit declaration of function ‘SSL_set_tlsext_host_name’
error: command ‘gcc’ failed with exit status 1

구글링을 해보니 OpenSSL version 문제로 0.9.8f 이상의 버젼을 깔아서 이 문제를 해결할 수 있다고 한다.

Support for SNI was introduced in OpenSSL 0.9.8f. Thus, pyOpenSSL 0.13 will build with OpenSSL 0.9.8f or later, but not OpenSSL 0.9.8e or earlier, where the APIs it expects to be wrapping do not exist.

yum에 올라와 있는 최신 버젼은 openssl-0.9.8e 였기에 openssl-1.0.0을 다운로드받아서 설치하였다.

$ wget http://www.openssl.org/source/openssl-1.0.0e.tar.gz
$ tar -xvf openssl-1.0.0e.tar.gz
$ make && sudo make install

openssl-1.0.0 설치 후, 다시 한번 pyOpenSSL 설치를 시도하였으나 같은 에러를 내며 빌드에 실패하였다.
Library Path가 이미 Yum을 통해 깔려져 있던 0.9.8e 버젼을 가르키고 있었기 때문인걸로 보인다.
하지만 매우 많은 패키지들과 의존성을 가지고 있는 openssl-0.9.8e 패키지를 지울수도 없는 노릇이다.
따라서 직접 Source를 내려받아 컴파일을 하고, 컴파일 시에 Library Path를 직접 openssl-1.0.0 설치 위치로 설정함으로써 빌드에 성공하였다.

$ wget http://pypi.python.org/packages/source/p/pyOpenSSL/pyOpenSSL-0.13.tar.gz#md5=767bca18a71178ca353dff9e10941929
$ python setup.py build_ext -I/usr/local/ssl/include -L/usr/local/ssl/lib $ python setup.py install

Build Completed :)

참조 URL:

Emacs 기본 글꼴을 쓰다보면 “됫”이나 “됬”같은 흔치 않은 글자들을 쓸 때

가끔씩 다른 글자와 어울리지 못할 때가 있다.

쓰다보면 자꾸 신경쓰이는 이 문제를 다른 글꼴을 사용함으로써 해결 할 수 있다.

(참고로 Emacs 23.3에서만 테스트되었다.)

(set-face-font 'default "Bitstream Vera Sans Mono") ; 기본폰트 적용
(set-fontset-font "fontset-default" '(#x1100 . #xffdc)  ; 한글폰트 적용
                    '("UnBom" . "iso10646-1"))
   (set-fontset-font "fontset-default" '(#xe0bc . #xf66e)
                     '("UnBom" . "iso10646-1")))

영문폰트로는 Bitstream Vera Sans Mono을, 한글폰트로는 UnBom을 사용하였다.

그러나 일반적인 Emacs 런치 시에는 잘 동작하지만,

Emacs Daemon을 통해 런치시에는 이 코드를 사용하면

    #<font-spec nil nil Bitstream Vera Sans Mono nil nil nil nil nil nil nil nil nil ((:name . Bitstream Vera Sans Mono))>

등과 같은 에러가 난다. 이는 emacs daemon시에는 frame이 아직 만들어지지 않았기 때문에

에러가 날 수 있다고 한다. 그래서 frame이 만들어질때마다 폰트가 적용되도록 해야

정상적으로 동작한다.

    (add-to-list 'default-frame-alist '(font . "Bitstream Vera Sans Mono"))
    (add-hook 'after-make-frame-functions
                  (lambda (frame)
                    (with-selected-frame frame
                      (set-fontset-font "fontset-default" '(#x1100 . #xffdc)
                                        '("UnBom" . "iso10646-1"))
                      (set-fontset-font "fontset-default" '(#xe0bc . #xf66e)
                                        '("UnBom" . "iso10646-1"))
                      )))

결국 종합하면, (daemonp)를 통해 daemon인지 아닌지 판별하고, 판별 결과에 따라 폰트를 적용시켜주면 된다.

    (if (daemonp)
      (progn
        (add-to-list 'default-frame-alist '(font . "Bitstream Vera Sans Mono"))
        (add-hook 'after-make-frame-functions
                  (lambda (frame)
                    (with-selected-frame frame
                      (set-fontset-font "fontset-default" '(#x1100 . #xffdc)
                                        '("UnBom" . "iso10646-1"))
                      (set-fontset-font "fontset-default" '(#xe0bc . #xf66e)
                                        '("UnBom" . "iso10646-1"))
                      )))
        )
      (set-face-font 'default "Bitstream Vera Sans Mono")
      (set-fontset-font "fontset-default" '(#x1100 . #xffdc)
                        '("UnBom" . "iso10646-1"))
      (set-fontset-font "fontset-default" '(#xe0bc . #xf66e)
                        '("UnBom" . "iso10646-1")))

관련 URL: 

Gentoo에서 외장하드를 쓸 일이 생겨서 mount를 했는데

윈도우에서 쓰던 파일/폴더들의 한글이름이 ???? 와 같은 물음표로

꺠지는 것이었다.

mount manpage를 찾아보다 보니, iocharset이라는 것이 있어서

iocharset 옵션과 함께 mount를 하니 한글이 깨지던 문제가 해결이 되었다.

sudo mount -o iocharset=utf8 /dev/sdb1 /mnt/hdd1

(man mount를 해서 iocharset으로 검색을 해보면 관련 정보를 얻을 수 있다.)

rtf format의 파일을 볼 일이 생겨서 openoffice.org를 깔게 되었다.

http://www.grokdoc.net/index.php/Gentoo-OpenOffice.org 를 참조하니

소스 컴파일은 꽤나 오래걸린다고 해서 그냥 binary를 바로 받기로 하였다.

LINGUAS를 추가하고, openoffice-bin을 emerge한다.

$ echo ‘LINGUAS=”en ko”’ » /etc/make.conf
$ emerge openoffice-bin

하였다.

설치 후에 몇가지 문제점이 발생하였는데,

문제 1. Emerge 후에 Applications Menu에서 icon image가 깨지는 문제

  • 현재 gentoo와 xfce4의 조합을 쓰고 있는데 이 조합을 이용한 초기부터 메뉴에 icon image가 깨지는 문제가 자주 발생해 왔는데, 처음엔 x11-themes/gnome-icon-theme을 설치함으로써 문제를 해결했던 것 같다.
  • 이번에는 USE FLAG에 gnome을 추가하여 다시 컴파일 했더니 문제가 해결되었다.

$ echo “app-office/openoffice-bin gnome” » /etc/portage/package.use

문제 2. openoffice를 실행하니

(soffice:25374): Gtk-WARNING **: /usr/lib/openoffice/program/../basis-link/ure-link/lib/libstdc++.so.6: version `GLIBCXX_3.4.11’ not found (required by /usr/lib/libscim-1.0.so.8)

(soffice:25374): Gtk-WARNING **: Loading IM context type ‘scim’ failed 

와 같은 에러메세지가 나오면서 scim이 먹통이 되는 것이었다.

구글링을 해보니 비슷한 문제들이 많이 나왔는데,

http://www.pclinuxos.com/forum/index.php?topic=75638.0;wap2

이 링크가 직접적으로 도움이 되었다.

$ cd /usr/lib/openoffice/ure/lib
$ mv libstdc++.so.6 libstdc++.so.6.orig
$ mv libgcc_s.so.1 libgcc_s.so.1.orig

정확히 어떻게 해결된 건지는 확실히 모르겠다.

(이 문제가 Xfce-Terminal 실행시에도 같은 문제가 발생했었는데 아직 해결책은 못 찾았다.)

Macbook에서 mutt 및 기타 리눅스 툴들을 사용하기 위해 Gentoo prefix를 설치하는 중..

http://www.gentoo.org/proj/en/gentoo-alt/prefix/bootstrap-macos.xml

를 보면서 따라가는중!