ncurses 라이브러리는 static link(static build)가 안되나요 ? // gcc -static hello.c -o hello -lncurses 빌드가 안되네요...

ukyoukyo의 이미지



CentOS 6.3 32비트 환경입니다.

ncurses 라이브러리는 static link(static build)가 안되나요 ? // gcc -static hello.c -o hello -lncurses 빌드가 안되네요...


gcc hello.c -o hello -lncurses


위와 같이 -static 옵션이 없을때는 빌드와 실행이 잘 됩니다.



gcc -static hello.c -o hello -lncurses


위와 같이 -static 옵션이 있을때는 아래와 같은 에러가 발생합니다.


/tmp/ccq871Lz.o: In function `main':
hello.c:(.text+0x1b): undefined reference to `stdscr'
hello.c:(.text+0x28): undefined reference to `stdscr'
/usr/lib/gcc/i686-redhat-linux/4.4.6/../../../libncurses.a(lib_endwin.o): In function `endwin':
(.text+0x8): undefined reference to `SP'
/usr/lib/gcc/i686-redhat-linux/4.4.6/../../../libncurses.a(lib_endwin.o): In function `endwin':
(.text+0x2f): undefined reference to `reset_shell_mode'
/usr/lib/gcc/i686-redhat-linux/4.4.6/../../../libncurses.a(lib_getch.o): In function `_nc_wgetch':
(.text+0x1ef): undefined reference to `_nc_keypad'
/usr/lib/gcc/i686-redhat-linux/4.4.6/../../../libncurses.a(lib_getch.o): In function `_nc_wgetch':
(.text+0x355): undefined reference to `_nc_timed_wait'




ncurses 라이브러리는 정적링크가 안되는 라이브러리인가요 ?

아니면 다른 방법이 있는지요 ?



shint의 이미지

아마도. 라이브러리 때문인거 같은데요.
심볼릭 링크를 연결해주거나. export. path등으로 사용가능하게 해주면 될듯 싶습니다.

그 전에 configure -static과 make LDFLAGS=-static 등이 필요해 보입니다.
해보고 컴파일도 되고. 실행도 되긴하는데.

이게 static인지 아닌지...는 잘 모르겠습니다. 한번 참고해보세요.

//------------------------------------------------------------------------------------------------------------------------
//심볼릭 링크 연결해주기
http://sessi0n.com/data/LFS_Ko/chapter06/ncurses.html
 
//http://blog.naver.com/grayjoker?Redirect=Log&logNo=40117194412
//http://wiki.kldp.org/wiki.php/NCURSES-Programming-HOWTO#s-1.1.3
wget <a href="http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.7.tar.gz
tar" rel="nofollow">http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.7.tar.gz
tar</a> xvfz ncurses-5.7.tar.gz
ln -s ncurses-5.7 ncurses
cd ncurses
mkdir install
 
su -u root
 
//path
http://kin.naver.com/qna/detail.nhn?d1id=1&dirId=10302&docId=65776081&qb=bWFrZSBpbnN0YWxsIOyerOyEpOy5mA==&enc=utf8&section=kin&rank=1&search_sort=0&spq=0
 
//http://www.phpschool.com/gnuboard4/bbs/board.php?bo_table=qna_install&wr_id=85519
//./configure --prefix=/home/shint/test13/ncurses/install --enable-static
./configure --enable-static=yes
make LDFLAGS=-DNCURSES_STATIC
make install
 
 
 
//------------------------------------------------------------------------------------------------------------------------
//http://kin.naver.com/qna/detail.nhn?d1id=1&dirId=10302&docId=118098451&qb=ZXJyb3I6IG5jdXJzZXMuaA==&enc=utf8&section=kin&rank=1&search_sort=0&spq=0
export CURSES_CFLAGS="-I/usr/include/ncurses"
export CURSES_LDFLAGS="-L/usr/lib/ncurses -lncurses"
 
//http://stackoverflow.com/questions/3514852/statically-link-ncurses-to-program
gcc -W -Wall -o hello hello.c -lncurses
gcc -W -Wall -o hello hello.c -l:libncurses.a
 
//http://stackoverflow.com/questions/9708086/static-linking-with-boost-and-ncurses
gcc -DNCURSES_STATIC -o hello hello.c -l:libncurses.a
 
//
http://stackoverflow.com/questions/9364685/how-i-can-static-build-gdb-from-source
make LDFLAGS=-static
 
 
//http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/NCURSES-Programming-HOWTO.html
compile and link: gcc <program file> -lncurses
gcc -DNCURSES_STATIC -o hello hello.c -l:libncurses.a
 
//http://cafe.naver.com/cmdir/37
make uninstall
make clean
make menuconfig
 
 
//------------------------------------------------------------------------------------------------------------------------
gcc -static 으로 빌드할 경우.
/usr/bin/ld: cannot find -lc 이런 에러가 났었다.
 
//ln -s 로 라이브러리 링크 걸어라. 라고 함.
Qt-Embedded에서 /usr/bin/ld: cannot find -lqte
http://dreamkorea.tistory.com/74
 
//W Wall 이게 뭔지... ㅡ_ㅡ??
http://mintnlatte.tistory.com/429
 
//MakeFile로 사용하자
http://blog.naver.com/qodudtn1224?Redirect=Log&logNo=40099239145
http://smeffect.tistory.com/45
 
//http://blog.naver.com/cache798?Redirect=Log&logNo=130033773223
:%s/Ctrl+v엔터키//g 로 vi에서 ^M을 제거 할 수 있다.
 
 
//------------------------------------------------------------------------------------------------------------------------
//ncurses-devel 설치권유
http://kin.naver.com/qna/detail.nhn?d1id=1&dirId=10302&docId=69548782&qb=ZXJyb3I6IG5jdXJzZXMuaA==&enc=utf8&section=kin&rank=4&search_sort=0&spq=0
 
//yum설치
http://kyagami.blog.me/80118110754
 
//apt 사용 설치
http://blog.naver.com/chandong83?Redirect=Log&logNo=40171015640
sudo apt-get install lib32ncurses5-dev
sudo apt-get install libncurses5-dev
 
//apt
http://illusion9.tistory.com/13
sudo apt-get install build-essential
sudo apt-get install libncurses5-dev
sudo apt-get install libncursesw5-dev
 
 
//------------------------------------------------------------------------------------------------------------------------
//기타 참고용 링크
//------------------------------------------------------------------------------------------------------------------------
http://stuff.mit.edu/afs/athena/software/cygwin/cygwin_v1.3.2/usr/doc/Cygwin/ncurses-5.2.README
http://cross-lfs.org/view/svn/x86_64-64/final-system/ncurses.html
http://stackoverflow.com/questions/5156729/ncurses-static-libraries-to-include-with-a-c-project
http://www.cplusplus.com/forum/general/38995/
http://rpm.pbone.net/index.php3/stat/4/idpl/18075160/dir/other/com/ncurses-static-5.7-11.20101211mgc25.i686.rpm.html
http://kldp.org/node/57161
http://truckercloud.tistory.com/16
http://letov.blog.me/70097192797
http://blog.naver.com/khsrdc?Redirect=Log&logNo=110113745055
http://kin.naver.com/qna/detail.nhn?d1id=1&dirId=10302&docId=64911463&qb=bmN1cnNlcw==&enc=utf8&section=kin&rank=1&search_sort=0&spq=0&pid=RLk52F5Y7uGsscYEuCCsssssst4-356633&sid=UNbJ2nJvLC4AAHvmCX0
http://wiki.kldp.org/wiki.php/NCURSES-Programming-HOWTO#s-1.1.3
http://thesoul214.tistory.com/13
http://blog.naver.com/gouhc46?Redirect=Log&logNo=60144582600
http://www.php.net/manual/en/function.ncurses-raw.php
 
//문자 단위
http://cafe.naver.com/enbedddedlinux/31
 
//Qt
http://cafe.naver.com/mayan00/1155
http://cafe.naver.com/gabriel98/299
/usr/bin/ld: cannot find -lstdc++
HOST PC용 g++말고 arm-linux-g++로 컴파일 할것!
qmake -spec /home/gabriel/qt/qte-3.3.3/mkspecs/qws/linux-ipaq-g++ -p Makefile 프로젝트이름.pro
 
http://qt-project.org/search/tag/static~build
 
//한글 나비를 사용하라.
http://www.oops.kldp.org/node/134156
http://kldp.net/projects/nabi/forum/309749
 
//------------------------------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------
젊음'은 모든것을 가능하게 만든다.

매일 1억명이 사용하는 프로그램을 함께 만들어보고 싶습니다.
정규 근로 시간을 지키는. 야근 없는 회사와 거래합니다.

각 분야별. 좋은 책'이나 사이트' 블로그' 링크 소개 받습니다. shintx@naver.com

ukyoukyo의 이미지

참고자료 감사합니다.


------------------ System programmer...^^

김정균의 이미지

CentOS 6의 ncurses-devel에 static library가 없기 때문입니다. -static 옵션을 주면 libncurses.a를 찾게 되는데, so file만 있고 .a가 없어서 빌드가 안되는 겁니다.

Redhat에서 빌드하는 패키지들은 대부분 .a 파일을 빼버리더군요.

ukyoukyo의 이미지


역시, 라이브러리 문제였네요.

RedHat 계열은 .a 파일류들을 뺀다는걸 몰랐네요...


------------------ System programmer...^^

댓글 달기

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
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.