Linux2010. 1. 7. 14:23
이녀석.. 미운 4살도 아닌데 크로스 컴파일 대책이 제대로 안되어 있는지 한큐에 안된다 ㄱ-

i686 linux에서는 참 쉽게 한다.

./configure
make
make install

[링크 : http://www.tuxera.com/community/ntfs-3g-download/]

세줄 끝.. 참 쉽죠잉~



그.런.데 크로스컴파일은 악몽의 시작이었다.
sh4-linux 에서 크로스컴파일은 산넘어 산이었는데..

crash 1.
# export CC=gsh4-linux-gcc
# ./configure --host-=i686 --target=sh4-linux
..
checking if libtool supports shared libraries... no
checking whether to build shared libraries... no
..
# make
...
Making install in libntfs-3g
test -z "/usr/local/lib" || /bin/mkdir -p "/home/morpheuz/st7109/target/usr/local/lib"
 /bin/sh ../libtool   --mode=install /usr/bin/install -c  'libntfs-3g.la' '/home/morpheuz/st7109/target/usr/local/lib/libntfs-3g.la'
/usr/bin/install -c .libs/libntfs-3g.lai /home/morpheuz/st7109/target/usr/local/lib/libntfs-3g.la
/usr/bin/install -c .libs/libntfs-3g.a /home/morpheuz/st7109/target/usr/local/lib/libntfs-3g.a
chmod 644 /home/morpheuz/st7109/target/usr/local/lib/libntfs-3g.a
ranlib /home/morpheuz/st7109/target/usr/local/lib/libntfs-3g.a
libtool: install: warning: remember to run `libtool --finish /usr/local/lib'
make  install-exec-hook
test -z "/lib" || /bin/mkdir -p "/home/morpheuz/st7109/target/lib"
if [ ! "/lib" -ef "/usr/local/lib" ]; then \
/bin/mv -f "/home/morpheuz/st7109/target//usr/local/lib"/libntfs-3g.so* "/home/morpheuz/st7109/target//lib";  \
fi
/bin/mv: cannot stat `/home/morpheuz/st7109/target//usr/local/lib/libntfs-3g.so*': No such file or directory
make[3]: *** [install-exec-hook] Error 1
make[2]: *** [install-exec-am] Error 2
make[1]: *** [install-am] Error 2
make: *** [install-recursive] Error 1

머.. 간단해 보이지만 대책이 안선다 ㄱ-
일단은 so 파일도 생성하지 못하면서, so 파일을 옮길려고 하면서 죽는다..
미네랄!

아무튼 해결책은 아래와 같다.

Step 1. 혹시 모르니 liunx kernel의 FUSE 지원여부를 확인한다.
Step 2. 환경설정
# unset CC
# ./configure

# vi Makefile
# vi src/Makefile
# vi libntfs-3g/Makefile
# vi libfuse-lite/Makefile

에서
AR = ar
CC = gcc
CPP = gcc -E
CXX = g++
CXXCPP = g++ -E
ac_ct_CC = gcc
ac_ct_CXX = g++
를 찾아 sh4-linux- 접두를 붙여준다.

# vi libtool
에서
AR="ar"
LTCC="gcc"
CC="gcc"
OBJDUMP="objdump"
AS="as"
를 찾아 sh4-linux- 접두를 붙여준다.

이렇게 수정후에는 마음 편하게

# make

만약 make 시에 secaudio.c 에러가 발생하면
<attr/xattr.h> 를 <sys/xattr.h>로 수정한다.

# vi src/secaudit.c
 261 #ifdef HAVE_SETXATTR
 262 #include <sys/xattr.h>
 263 #else
 264 #warning "The extended attribute package is not available"
 265 #endif /* HAVE_SETXATTR */

아무래도 target 경로가 다를테니 DESTDIR을 넣고 목적지를 정해준다.

# make DESTDIR={target path} install

설치후 생성되는 파일목록
/sbin/mount.ntfs-3g -> /bin/ntfs-3g
/bin/ntfs-3g
/usr/local/bin/ntfs-3g.probe
/usr/local/bin/ntfs-3g.secaudit
/usr/local/bin/ntfs-3g.usermap

/lib/libntfs-3g.so -> libntfs-3g.so.71.0.0
/lib/libntfs-3g.so.71 -> libntfs-3g.so.71.0.0
/lib/libntfs-3g.so.71.0.0

/usr/local/share/man/man8/mount.ntfs-3g.8 -> ntfs-3g.8
/usr/local/share/man/man8/ntfs-3g.8
/usr/local/share/man/man8/ntfs-3g.probe.8
/usr/local/share/man/man8/ntfs-3g.secaudit.8
/usr/local/share/man/man8/ntfs-3g.usermap.8

/usr/local/lib/libntfs-3g.a
/usr/local/lib/libntfs-3g.la
/usr/local/lib/libntfs-3g.so -> /lib/libntfs-3g.so


실행결과
# mount -t ntfs-3g /dev/sda1 /root/sda1
mount: mounting /dev/sda1 on /root/sda1 failed: No such device

# ntfs-3g /dev/sda1 /root/sda1
WARNING: Deficient Linux kernel detected. Some driver features are
         not available (swap file on NTFS, boot from NTFS by LILO), and
         unmount is not safe unless it's made sure the ntfs-3g process
         naturally terminates after calling 'umount'. If you wish this
         message to disappear then you should upgrade to at least kernel
         version 2.6.20, or request help from your distribution to fix
         the kernel problem. The below web page has more information:
         http://ntfs-3g.org/support.html#fuse26

# mount
rootfs on / type rootfs (rw)
/dev/root on / type nfs (rw,noatime,vers=2,rsize=4096,wsize=4096,hard,nolock,proto=tcp,timeo=600,retrans=2,addr=192.168.10.10)
proc on /proc type proc (rw)
usbfs on /proc/bus/usb type usbfs (rw)
sysfs on /sys type sysfs (rw)
/dev/sda1 on /root/sda1 type fuse (rw,user_id=0,group_id=0,allow_other)

'Linux' 카테고리의 다른 글

fork-exec 종료시 리턴값  (0) 2010.01.11
mount.cifs mount.ntfs 등 자동연결의 비밀(?)  (0) 2010.01.08
FUSE 넌 머냐?  (0) 2010.01.07
ntfs-3g at Tuxera  (0) 2010.01.06
웹캠 VLC에서 테스트(Ubuntu 9.10)  (0) 2009.12.29
Posted by 구차니
임베디드 개발하다보면, 크로스 컴파일은 밥먹듯 하는데..
가끔 황당한 오류가 바로 ld 관련 오류이다.

ntfs_3g_usermap-usermap.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make[2]: *** [ntfs-3g.usermap] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

이녀석은 ntfs-3g 라는 녀석인데, 크로스 컴파일을 하려니 이러한 오류가 발생했다.
조금은 뜬금없기도 하고, 옵션도 문제가 없는데 왜 이러냐면은..


원인 : 크로스 컴파일 이전에 컴파일 되는지 확인하기 위해 호스트에서(i686-linux) 컴파일을 이미 했기 때문!
해결 : 머. make clean 한번 하고 ./configure 다시 해주고..

결론 : 잊지말자 make clean!



사족 : File in wrong format 인건, 당연히 링커가 아키텍쳐가 다른 파일을 조작하려 하니 포맷을 알리가 ㅋㅋ
         이런 경우에는 갸우뚱 하지 말고 make clean 하고 다시 컴파일 하는게 상책이다.

'프로그램 사용 > 실패기' 카테고리의 다른 글

svn+ssh 사용하도록 설정 실패  (0) 2009.05.10
xgprof - gnome based gprof GUI frontend  (0) 2009.04.27
ponyprog FC9에서 실행 실패 / avrdude 실패  (0) 2009.04.20
kscope OTL  (0) 2009.04.20
Posted by 구차니
삼바를 하면서 고생한게 몇개 있는데..

첫째는 크로스 컴파일시에 --target 옵션 넣으면 안된다는 것과
둘째는 설치 경로를 못잡아서 헤맨 것이다.


일단 삼바가 제대로 설정되었는지 확인하기 위한 testparm툴을 삼바에서 제공한다.
이 녀석을 사용하면 무엇이 잘못되었는지 찾는데 도움이 될 것이다.
[링크 : http://forums.debian.net/viewtopic.php?f=5&t=42082]

나의 경우에는 무리하게 Makefile 을 수정해서 생긴문제였는데
testparm을 하면 아래와 같이 출력되었었다.
# testparm
Load smb config files from /etc/smb.conf
creating default valid table
Loaded services file OK.
ERROR: lock directory /home/morpheuz/st7109/target/var/locks does not exist
ERROR: state directory /home/morpheuz/st7109/target/var/locks does not exist
ERROR: cache directory /home/morpheuz/st7109/target/var/locks does not exist
ERROR: pid directory /home/morpheuz/st7109/target/var/locks does not exist
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

[global]
        netbios name = SMB TEST

Makefile에서
prefix를 /home/morpheuz/st7109/target 으로 했었는데. 이 경우에 컴파일 된 smbd에 저 경로를 이식하는 바람에
타켓 환경에서 엉뚱한 경로를 뒤적이게 되서 이러한 현상이 발생하게 되었다.

이를 해결하기 위해서는
아~~~무런 Makefile 수정없이 아래와 같이 입력하면 된다.

make DESTDIR=/home/morpheuz/st7109/target install

물론 Makefile 내에 DESTDIR이 있지만, 설정상의 문제인지 강제로 저값을 넣어주면
설치중에 엉뚱한 경로가 추가되어 설치에 실패하게 된다.
($(DESTDIR)%(LIBDIR) 사이에 이상하게도 /가 하나더 들어간다 결과적으로
/home/moprheuz/st7109/target//usr/local 경로가 되면서 설치 실패한다.)


아래의 링크는 autoconf의 DESTDIR 과 각종 디렉토리 변수에 대한 gnu 문서이다.
[링크 : http://www.gnu.org/software/autoconf/manual/standards/DESTDIR.html#DESTDIR]
[링크 : http://www.gnu.org/software/autoconf/manual/standards/Directory-Variables.html#Directory-Variables]
Posted by 구차니