lighttpd(gcc로 컴파일된)에 g++ 모듈 사용하기.

olif의 이미지

아아.. 정확히 제목을 설명하기가 난해해서 제목이 좀 그렇습니다.

원래 Apache의 한 모듈로서 동작하던 것을. Apache 가 메모리 leak 등등. 많은 문제가 있음직해서.

lighttpd로 갈아타려는 준비를 하고 있습니다.

근데. Apache를 이용해서 http 데이터를 hooking 하는 mod_sphere.so 라는 모듈이 있었는데 이것을 lighttpd 로 포팅하려고 합니다.

mod_sphere.cpp 는 c++ 이라서. g++ 로 컴파일을 하였고, lighttpd는 gcc 로 되어 있습니다.

어찌저찌 해서 컴파일까지는 완료. 모듈로 만들어서 올리기 직전까지 완료하였는데. 마지막으로 심볼 하나가 이상해서 안됩니다.

gdb lighttpd 로 디버깅하면.

(gdb) c
Continuing.
2007-09-06 17:31:28: (plugin.c.165) dlopen() failed for: /root/lighttpd_root/lib
/mod_sphere.so /root/lighttpd_root/lib/mod_sphere.so: undefined symbol: __gxx_pe
rsonality_v0
2007-09-06 17:31:28: (server.c.609) loading plugins finally failed

이렇게 나오구요.

nm mod_sphere.so 하면
00001e74 d DW.ref.__gxx_personality_v0
00001d3c A _DYNAMIC
00001e10 A _GLOBAL_OFFSET_TABLE_
w _Jv_RegisterClasses
00001d2c d __CTOR_END__
00001d28 d __CTOR_LIST__
00001d34 d __DTOR_END__
00001d30 d __DTOR_LIST__
00000d24 r __FRAME_END__
00001d38 d __JCR_END__
00001d38 d __JCR_LIST__
00001e78 A __bss_start
w __cxa_finalize@@GLIBC_2.1.3
00000bb8 t __do_global_ctors_aux
00000758 t __do_global_dtors_aux
00001e4c d __dso_handle
w __gmon_start__
U __gxx_personality_v0
00001e78 A _edata
00001e7c A _end
00000be8 T _fini
0000064c T _init
U array_free
U array_init
U buffer_free
U buffer_init
U buffer_init_string
U buffer_is_equal_string
00000734 t call_gmon_start
U calloc@@GLIBC_2.0
00001e78 b completed.1
U config_check_cond
U config_insert_values_global
000007b4 t frame_dummy
U free@@GLIBC_2.0
00000820 t mod_sphere_free
000007f0 t mod_sphere_init
00000b58 T mod_sphere_plugin_init
000008c4 t mod_sphere_set_defaults
000009b4 t mod_sphere_uri_handler
00001e50 d p.0
U strncmp@@GLIBC_2.0

이렇게 나와서 심볼을 못찾는거 같은데. DW.ref.__gxx_personality_v0 앞의 DW.ref. 는 무엇이며 어떻게 잘 없앨 수 있을까요? ㅠㅠ.

mod_sphere_init 등의 함수도. extern "C" 를 이용해서 C 에 맞게끔 고쳤는데. __gxx_personality_v0는 대충 찾아보니 g++ 로 된 아주 기본적인 녀석인거 같은데. 어떻게 하면 좋을까요?

고수님들의 많은 조언 부탁드립니다.

p.s. lighty 에서 C++ 로 된 외부모듈 만들어보신분.. 더 많은 조언해 주시면 감사하겠습니다.

익명 사용자의 이미지

http://kldp.org/node/86120
또는
gcc에 -lstdc++주고 링크하세요.

olif의 이미지

빠른 답변 감사드립니다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.