이헌석이 듣고 쓴 이럴 땐 이런 음악

살짝 취기가 오른 시간.
좋은 사람들과 기분좋은 술 한잔을 하고 집으로 돌아와서 바로 잠을 잘려니 뭔가 부족한 느낌.

무엇을 하고 잘까 잠깐을 고민 했는데, 마침 생각난 서평쓰기.

그 동안 읽었지만 미처 쓰지 못한 서평을 쓰기에 적당한 시간이란 느낌이 든다.

이헌석이 듣고 쓴 이럴 땐 이런 음악.

귀로 듣는 음악을 눈으로 볼 수 있다면 이런 느낌일까.

단순히 음악에 설명을 하는 것이 아닌 음악에 대한 이야기를 하고 있다는 느낌을 받았다.

이 음악은, 이래서 좋고, 요 음악은 요래서 좋고…
온통 좋은 이야기 뿐이다

근 600여 페이지에 달하는 책 내용에 소개되는 곡 이야기는 줄잡아 1500곡은 넘을 듯 보였다.(한 페이지에 3곡씩..)

책 속에서 소개되는 그 많은 곡 들 중에서 내가 알고 있는 곡은 50여개도 안 될 것이다.

하지만 무슨 상관이랴. 음악을 많이 알고, 적게 알고 따위는 이 책을 읽는데 아무런 상관이 되지 않았다.

 

 

 

mysql_query() return 1

 

mysql 라이브러리를 이용한 MySQL C 프로그램에서 이상한 로그를 발견했다.

 

mysql_query()  함수 결과를 수행한 결과값이 1이 나왔던 것.
mysql_query() 에 관한 명세는 다음 링크에서 찾을 수 있었다.

http://dev.mysql.com/doc/refman/5.0/en/mysql-query.html

 

이 중, Return Value와 관계있는 항목을 아래에 나타내었다.

Return Values

Zero if the statement was successful. Nonzero if an error occurred.

정상일 경우 0, 실패일 경우 0이 아닌 다른 값이 나온다고 나와있다.
에러가 발생했을 경우의 나타나지는 결과값들을 살펴보았다.

Errors

mysql_query() 함수의 리턴값이 1인 경우에 대한 내용은 찾을 수 없었다.
결국 mysql_error() 와 mysql_errno() 함수를 이용해 에러 메시지를 직접 로그에 찍어보고 나서야 그 원인을 알 수 있었다.

1054  – Unknown column

undefined reference to `SSL_CTX_free’

 

사내에서 개발중인 제품을 테스트하기 위해 컴파일을 하던 도중, 아래의 오류를 발견했다. mysqlclient 라이브러리를 함께 사용하는 부분이 있었는데, Linking 을 하던 도중 에러가 발생한 것이다.

/usr/lib/mysql/libmysqlclient.a(client.o): In function `mysql_close_free_options’:
(.text+0xd7d): undefined reference to `SSL_CTX_free’
/usr/lib/mysql/libmysqlclient.a(client.o): In function `mysql_get_ssl_cipher’:
(.text+0x1081): undefined reference to `SSL_get_current_cipher’
/usr/lib/mysql/libmysqlclient.a(client.o): In function `mysql_real_connect’:
(.text+0x3a4c): undefined reference to `SSL_get_peer_certificate’
/usr/lib/mysql/libmysqlclient.a(client.o): In function `mysql_real_connect’:
(.text+0x3a60): undefined reference to `X509_get_subject_name’
/usr/lib/mysql/libmysqlclient.a(client.o): In function `mysql_real_connect’:
(.text+0x3a74): undefined reference to `X509_NAME_oneline’
/usr/lib/mysql/libmysqlclient.a(client.o): In function `mysql_real_connect’:
(.text+0x3a7c): undefined reference to `X509_free’
/usr/lib/mysql/libmysqlclient.a(client.o): In function `mysql_get_ssl_cipher’:
(.text+0x108a): undefined reference to `SSL_CIPHER_get_name’
/usr/lib/mysql/libmysqlclient.a(viossl.o): In function `report_errors’:
(.text+0x45): undefined reference to `ERR_get_error_line_data’
/usr/lib/mysql/libmysqlclient.a(viossl.o): In function `ssl_do’:
(.text+0x8c): undefined reference to `SSL_new’
/usr/lib/mysql/libmysqlclient.a(viossl.o): In function `ssl_do’:
(.text+0x9a): undefined reference to `SSL_clear’
/usr/lib/mysql/libmysqlclient.a(viossl.o): In function `ssl_do’:
(.text+0xa2): undefined reference to `SSL_get_session’
/usr/lib/mysql/libmysqlclient.a(viossl.o): In function `ssl_do’:
(.text+0xae): undefined reference to `SSL_SESSION_set_timeout’
/usr/lib/mysql/libmysqlclient.a(viossl.o): In function `ssl_do’:
(.text+0xbc): undefined reference to `SSL_set_fd’
/usr/lib/mysql/libmysqlclient.a(viossl.o): In function `ssl_do’:
(.text+0xd1): undefined reference to `SSL_get_fd’
/usr/lib/mysql/libmysqlclient.a(viossl.o): In function `ssl_do’:
(.text+0x14b): undefined reference to `SSL_free’
/usr/lib/mysql/libmysqlclient.a(viossl.o): In function `sslconnect’:
(.text+0x16f): undefined reference to `SSL_connect’
/usr/lib/mysql/libmysqlclient.a(viossl.o): In function `sslaccept’:
(.text+0x18f): undefined reference to `SSL_accept’
/usr/lib/mysql/libmysqlclient.a(viossl.o): In function `vio_ssl_close’:
(.text+0x1c5): undefined reference to `SSL_set_quiet_shutdown’
/usr/lib/mysql/libmysqlclient.a(viossl.o): In function `vio_ssl_close’:
(.text+0x1cd): undefined reference to `SSL_shutdown’
/usr/lib/mysql/libmysqlclient.a(viossl.o): In function `vio_ssl_delete’:
(.text+0x212): undefined reference to `SSL_free’
/usr/lib/mysql/libmysqlclient.a(viossl.o): In function `vio_ssl_write’:
(.text+0x261): undefined reference to `SSL_write’
/usr/lib/mysql/libmysqlclient.a(viossl.o): In function `vio_ssl_read’:
(.text+0x281): undefined reference to `SSL_read’
/usr/lib/mysql/libmysqlclient.a(viosslfactories.o): In function `report_errors’:
(.text+0x25): undefined reference to `ERR_get_error_line_data’
/usr/lib/mysql/libmysqlclient.a(viosslfactories.o): In function `new_VioSSLFd’:
(.text+0x99): undefined reference to `SSL_CTX_new’
/usr/lib/mysql/libmysqlclient.a(viosslfactories.o): In function `new_VioSSLFd’:
(.text+0xbc): undefined reference to `SSL_CTX_set_cipher_list’
/usr/lib/mysql/libmysqlclient.a(viosslfactories.o): In function `new_VioSSLFd’:
(.text+0xd9): undefined reference to `SSL_CTX_load_verify_locations’
/usr/lib/mysql/libmysqlclient.a(viosslfactories.o): In function `new_VioSSLFd’:
(.text+0xfb): undefined reference to `SSL_CTX_use_certificate_file’
/usr/lib/mysql/libmysqlclient.a(viosslfactories.o): In function `new_VioSSLFd’:
(.text+0x125): undefined reference to `SSL_CTX_use_PrivateKey_file’
/usr/lib/mysql/libmysqlclient.a(viosslfactories.o): In function `new_VioSSLFd’:
(.text+0x135): undefined reference to `SSL_CTX_check_private_key’
/usr/lib/mysql/libmysqlclient.a(viosslfactories.o): In function `new_VioSSLFd’:
(.text+0x142): undefined reference to `DH_new’
/usr/lib/mysql/libmysqlclient.a(viosslfactories.o): In function `new_VioSSLFd’:
(.text+0x166): undefined reference to `BN_bin2bn’
/usr/lib/mysql/libmysqlclient.a(viosslfactories.o): In function `new_VioSSLFd’:
(.text+0x185): undefined reference to `BN_bin2bn’
/usr/lib/mysql/libmysqlclient.a(viosslfactories.o): In function `new_VioSSLFd’:
(.text+0x1bb): undefined reference to `SSL_CTX_ctrl’
/usr/lib/mysql/libmysqlclient.a(viosslfactories.o): In function `new_VioSSLFd’:
(.text+0x1c3): undefined reference to `DH_free’
/usr/lib/mysql/libmysqlclient.a(viosslfactories.o): In function `new_VioSSLFd’:
(.text+0x1da): undefined reference to `SSL_load_error_strings’
/usr/lib/mysql/libmysqlclient.a(viosslfactories.o): In function `new_VioSSLFd’:
(.text+0x1eb): undefined reference to `SSL_library_init’
/usr/lib/mysql/libmysqlclient.a(viosslfactories.o): In function `new_VioSSLFd’:
(.text+0x1f0): undefined reference to `OPENSSL_add_all_algorithms_noconf’
/usr/lib/mysql/libmysqlclient.a(viosslfactories.o): In function `new_VioSSLFd’:
(.text+0x206): undefined reference to `SSL_CTX_set_default_verify_paths’
/usr/lib/mysql/libmysqlclient.a(viosslfactories.o): In function `new_VioSSLFd’:
(.text+0x21d): undefined reference to `SSL_CTX_free’
/usr/lib/mysql/libmysqlclient.a(viosslfactories.o): In function `new_VioSSLFd’:
(.text+0x2bd): undefined reference to `DH_free’
/usr/lib/mysql/libmysqlclient.a(viosslfactories.o): In function `new_VioSSLFd’:
(.text+0x2d6): undefined reference to `SSL_CTX_free’
/usr/lib/mysql/libmysqlclient.a(viosslfactories.o): In function `new_VioSSLAcceptorFd’:
(.text+0x328): undefined reference to `TLSv1_server_method’
/usr/lib/mysql/libmysqlclient.a(viosslfactories.o): In function `new_VioSSLAcceptorFd’:
(.text+0x36f): undefined reference to `SSL_CTX_ctrl’
/usr/lib/mysql/libmysqlclient.a(viosslfactories.o): In function `new_VioSSLAcceptorFd’:
(.text+0x389): undefined reference to `SSL_CTX_set_verify’
/usr/lib/mysql/libmysqlclient.a(viosslfactories.o): In function `new_VioSSLAcceptorFd’:
(.text+0x39f): undefined reference to `SSL_CTX_set_session_id_context’
/usr/lib/mysql/libmysqlclient.a(viosslfactories.o): In function `new_VioSSLConnectorFd’:
(.text+0x3c6): undefined reference to `TLSv1_client_method’
/usr/lib/mysql/libmysqlclient.a(viosslfactories.o): In function `new_VioSSLConnectorFd’:
(.text+0x405): undefined reference to `SSL_CTX_set_verify’
/usr/lib/mysql/libmysqlclient.a(my_compress.o): In function `my_uncompress’:
(.text+0x60): undefined reference to `uncompress’
/usr/lib/mysql/libmysqlclient.a(my_compress.o): In function `my_compress_alloc’:
(.text+0x102): undefined reference to `compress’
collect2: ld returned 1 exit status
make: *** [nxstart] 오류 1

위의 오류는 ssl 관련 라이브러리를 찾지 못해서 발생되는 오류였다. 보통 SSL 라이브러리의 경우 MySQL 이 설치될때 같이 설치가 되는 것 같았는데 이번엔 조금 경우가 특이했다.

OS는 64비트 였지만 제품은 32 비트로 컴파일 해야 했던 것. 처음에는 약간 헤매었지만 결국 해결할 수 있었다.

OS:

Linux localhost.localdomain 2.6.18-238.el5 #1 SMP Thu Jan 13 15:51:15 EST 2011 x86_64 x86_64 x86_64 GNU/Linux

SSL 라이브러리 설치:

# yum install openssl-devel.i386

SSL 라이브러리 추가:

-lssl

 

How to use gdb in Multi Threaded Network Program

 

Stack Overflow 에서 상당히 유용한 스레드를 발견하여 이곳에 싣는다.

내용은 멀티 스레드 환경에서 네트워크 프로그램을 디버그 할 때 어떻게 gdb를 사용하는가? 이다.

 

Enable core dump saving in your environment. Run command ulimit -c unlimited and rerun your program. When it crashes, load generated core dump in gdb and look backtraces of crash. In case of multi threaded program it is convenient to obtain backtraces from all threads by one command at once: (gdb) thread apply all bt.

 

결론적으로 다음의 한 줄로 요약될 수 있다.

(gdb) thread apply all bt

원글의 주소는 아래와 같다.

http://stackoverflow.com/questions/6813629/how-do-i-use-gdb-for-multi-threaded-networking-program

 

 

 

Ubuntu Virtual Box Start Error

 

Ubuntu 11.04 Kernel Version

Linux localhost.localdomain 2.6.18-194.32.1.el5 #1 SMP Wed Jan 5 17:53:09 EST 2011 i686 i686 i386 GNU/Linux

환경에서 Virtual Box 를 구동하려고 하니 다음과 같은 에러메시지가 나타났다.

“Failed to start the virtual machine WindowsXP.
Failed to open/create the internal network ‘HostInterfaceNetworking-eth0’ (you might need to modprobe vboxnetflt to make it accessible) (VERR_SUPDRV_COMPONENT_NOT_FOUND).
Please install the virtualbox-ose-dkms package and execute ‘modprobe vboxdrv’ as root (VERR_SUPDRV_COMPONENT_NOT_FOUND).”

이유인즉, 두 개의 모듈 vboxnetflt 와 vboxdrv 이 적재 되지 않아서 발생하는 문제였다.

vboxdrv 의 경우,

$ sudo modprobe vboxdrv

의 명령어로 로딩시킬 수 있었지만, vboxnetflt 모듈의 경우에는 다음의 에러 메시지를 내며 로딩되지 않았다.

jonathan@jonathan-laptop:~$ sudo modprobe vboxnetflt
[sudo] password for jonathan:
FATAL: Error inserting vboxnetflt (/lib/modules/2.6.32-33-generic-pae/updates/dkms/vboxnetflt.ko): Invalid module format

한참을 고민하다가 해결책을 찾았는데, 너무도 간단했다.
다음의 명령어로 모듈을 업로드 할 수 있다.

$ modprobe /lib/modules/2.6.32-33-generic-pae/updates/dkms/vboxnetflt.ko

또한, 매 재부팅시 자동으로 모듈 업로드를 설정하기 위해서, /etc/modules 의 파일을 수정해야 한다.

</etc/modules>

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with “#” are ignored.

lp
vboxdrv
/lib/modules/2.6.32-33-generic-pae/updates/dkms/vboxnetflt.ko