검색을 해보니, arm 용으로 크로스 컴파일 하는 문서가 있다.

# ./configure --build=i686-linux --host=arm-linux --target=arm-linux --prefix=/nfsroot/gdb
# ./configure --build=i686-linux --host=i686-linux --target=arm-linux --prefix=$PWD/build
[링크 : http://blog.daum.net/joell/11772014]

일단 gdb는 두번을 컴파일 해야 한다.
target 에서 native 하게 돌아갈 gdb와 (위)
host 에서 target architecture에 맞추어 돌아갈 gdb. (아래)

그리고 prefix 경로는 /usr 을 넣어주는게 좋을듯 하다. (설치를 하면서 보니 prefix가 usr 경로를 의미하는 것으로 보인다)

--- gdb/gdbserver
# ./configure --build=i686-linux --host=sh4-linux --target=sh4-linux --prefix=/home/morpheuz/st7109/target
# make
# make install
n=`echo gdbserver | sed 's,^,sh4-linux-,'`; \
        if [ x$n = x ]; then n=gdbserver; else true; fi; \
        /bin/sh ./../../mkinstalldirs /home/morpheuz/st7109/target/bin; \
        /usr/bin/install -c gdbserver /home/morpheuz/st7109/target/bin/$n; \
        /bin/sh ./../../mkinstalldirs /home/morpheuz/st7109/target/man/man1; \
        /usr/bin/install -c -m 644 ./gdbserver.1 /home/morpheuz/st7109/target/man/man1/$n.1

Posted by 구차니
프로그램 사용/VLC2010. 2. 2. 16:48
VLC 1.0.4
ubuntu 9.10 에서 크로스 컴파일을 시도했다.

$ ./configure --disable-mmx --disable-sse --enable-run-as-root --with-tuning=no --host=sh4-linux --build=i686

$ vi configure.ac
1621 dnl
1622 dnl  Special arch tuning
1623 dnl
1624 AC_ARG_WITH(tuning,
1625 [  --with-tuning=ARCH      enable special tuning for an architecture
1626                           (default Pentium 2 on IA-32 and G4 on PPC)])
1627 if test -n "${with_tuning}"; then
1628     if test "${with_tuning}" != "no"; then
1629         CFLAGS_TUNING="-mtune=${with_tuning}"
1630     fi
1631 else
1632     if test "${SYS}" = "darwin" -a "${host_cpu}" != "powerpc"; then
1633         CFLAGS_TUNING="-march=pentium-m -mtune=prescott"
1634     elif test "${host_cpu}" = "i686" -o "${host_cpu}" = "i586" -o "${host_cpu}" = "i486" -o "${host_cpu}" = "i386"; then
1635         CFLAGS_TUNING="-mtune=pentium2"
1636     elif test "${host_cpu}" = "x86_64"; then
1637         CFLAGS_TUNING="-mtune=athlon64"
1638     elif test "${host_cpu}" = "powerpc"; then
1639         CFLAGS_TUNING="-mtune=G4";
1640     fi
1641 fi

그리고 ubuntu 에서 sudo vlc 하면
$ sudo vlc
VLC is not supposed to be run as root. Sorry. If you need to use real-time priorities and/or privileged TCP ports
you can use vlc-wrapper (make sure it is Set-UID root and cannot be run by non-trusted users first).
라는 메시지가 출력되면서 실행되지 않는다. busybox나 대부분의 embeded 에서는 root로 할테니
크로스 컴파일 시에 root로 실행가능하도록 수정하고 (--enable-run-as-root)
cpu 최적화 부분을 꺼준다음 (--disable-mmx --disable-sse --with-tuning=no)
크로스 컴파일 되서 돌아갈 host를 지정해준다. (--host=sh4-linux)

좀 특이한(?) 점인데 --host=HOST_ARCH(==i686) --target=TARGET_ARCH(==sh4-linux)
처럼 입력이 되는게 아니라 host는 프로그램이 돌아갈 플랫폼을 의미한다.
즉, 일반적인 크로스 컴파일 옵션의 host, target 옵션이 바뀌어 build, host 로 인식한다.

$ ./configure --help

System types:
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       cross-compile to build programs to run on HOST [BUILD]

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

vlc-1.0.5 cross compile  (3) 2010.02.09
VLC cross compile시 오류 (vlc-1.0.4)  (0) 2010.02.03
의미는 없는 Linux / Windows VLC 차이  (0) 2010.01.26
VLC로 youtube 동영상 감상하기  (0) 2010.01.26
youtube mobile on VLC  (0) 2010.01.18
Posted by 구차니
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 구차니