[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debian-users:45703] Re: クロスコンパイル環境の構築について



山本です。

すみません。ディレクトリ構造が分からないと、理解できませんよね。

まず、limits.h ヘッダファイルは、
/usr/powerpc/include/limits.h (glibc-cross-powerpc パッケージ)
/usr/powerpc/include/linux/limits.h (binutils-powerpc パッケージ)
/usr/powerpc/lib/gcc-lib/powerpc-linux/3.3.3/install-tools/include/limits.h
(gcc-3.3-powerpc パッケージ)
/usr/powerpc/lib/gcc-lib/powerpc-linux/3.3.3/include/limits.h
(gcc-3.3-powerpc パッケージ)
の四つからなり、/usr/powerpc/powerpc-linux/include が
/usr/powerpc/include へのシンボリックリンクになっております。

つまり、#include <limits.h> の時は gcc-3.3-powerpc パッケージのものの
み、#include <linux/limits.h> の時は binutils-powerpc パッケージのものの
みをインクルードしていて、その他は全く無視されているようであります。

binutils-cross → gcc-boot-cross → glibc-cross → gcc-cross-3.3 の順番で
buildpackage しておりますので、最後の gcc-cross-3.3 の buildpackage でミ
スをしているのでしょうかね?


Hiroyuki Yamamoto wrote:

>早速、同じようなソースで $ /usr/powerpc/bin/powerpc-linux-cpp a.c >
>a-result をやってみました。
>---------- a.c
>//a.c
>#include <limits.h>
>main()
>{
>printf("%i\n", 4096);
>}
>
>---------- a-result
># 1 "a.c"
># 1 "<built-in>"
># 1 "<command line>"
># 1 "a.c"
># 1 "/usr/powerpc/lib/gcc-lib/powerpc-linux/3.3.3/include/limits.h" 1 3 4
># 2 "a.c" 2
>main()
>{
>printf("%i\n", 4096);
>}
>
>----------b.c
>//b.c
>#include <linux/limits.h>
>main()
>{
>printf("%i\n", 4096);
>}
>
>----------b-result
># 1 "b.c"
># 1 "<built-in>"
># 1 "<command line>"
># 1 "b.c"
># 1 "/usr/powerpc/powerpc-linux/include/linux/limits.h" 1 3
># 2 "b.c" 2
>main()
>{
>printf("%i\n", 4096);
>}
>
>----------
>  
>
>

gcc-cross-3.3 の debian/rules と debian/rules.def は次の通りです。

debian/rules
----------
#!/usr/bin/make -f
# -*- makefile -*-
# debian/rules file for the Debian/GNU Linux gcc-cross-3.2 package
# Copyright 2002-2004 by Julien LEMOINE <speedblue@debian.org>

include debian/rules.def

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
CFLAGS += -g
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
INSTALL_PROGRAM += -s
endif

configure: configure-stamp
configure-stamp:
dh_testdir
tar jxvf $(GCC).tar.bz2
cd $(GCC); for p in $(PATCH); do \
/bin/sh ../patches/$$p.dpatch -patch; done
cd $(GCC); cat ../patches/libjava | patch -p1
touch configure-stamp

build: build-stamp

build-stamp: configure-stamp
dh_testdir

clean:
dh_testdir
dh_testroot
rm -rf configure-stamp $(GCC)
-$(MAKE) clean
dh_clean

install: build
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
# Compile gcc for all languages and remove files in comflict with gcc-3.3
cd $(GCC); OLDPATH=$$PATH; for arch in $(ARCH); do \
mkdir build_tree; cd build_tree; \
march=`echo $$arch | sed 's/\([^-]\)\-.*/\1/'`; \
march2=`echo $$march | sed 's/_/-/g'`; \
export PATH=/usr/$$march/bin:$$OLDPATH; \
export CC=/usr/bin/gcc; \
../configure --prefix=/usr/$$march --exec-prefix=/usr/$$march\
--target=$$arch --enable-shared --disable-nls --disable-multilib\
--enable-languages=c,c++,ada,f77,objc; \
make all || exit 1; \
make install \
prefix=$(CURDIR)/debian/gcc-3.3-$$march2/usr \
exec_prefix=$(CURDIR)/debian/gcc-3.3-$$march2/usr/$$march\
|| exit 1; \
make distclean || true; \
rm -rf $(CURDIR)/debian/gcc-3.3-$$march2/usr/info; \
rm -f $(CURDIR)/debian/gcc-3.3-$$march2/usr/man/man1/cpp.1;\
rm -f $(CURDIR)/debian/gcc-3.3-$$march2/usr/man/man1/gcov.1;\
rm -rf $(CURDIR)/debian/gcc-3.3-$$march2/usr/man/man7;\
rm -rf $(CURDIR)/debian/gcc-3.3-$$march2/usr/$$march/include;\
mv $(CURDIR)/debian/gcc-3.3-$$march2/usr/include/ \
$(CURDIR)/debian/gcc-3.3-$$march2/usr/$$march; \
cd ..; rm -rf build_tree; \
done
# Move Data to g++ package
cd $(GCC); for arch in $(ARCH); do \
march=`echo $$arch | sed 's/\([^-]\)\-.*/\1/'`; \
march2=`echo $$march | sed 's/_/-/g'`; \
mkdir $(G++PATHS); \
mv $(G++MANS) $(G++PATH)/usr/man/man1; \
mv $(G++INCLUDES) $(G++PATH)/usr/$$march/include; \
mv $(G++BINS) $(G++PATH)/usr/$$march/bin; \
mv $(G++LIBSN) $(G++PATH)/usr/$$march/$$arch/lib/nof; \
mv $(G++LIBS) $(G++PATH)/usr/$$march/$$arch/lib || true;\
done
# Move data to gobjc package
cd $(GCC); for arch in $(ARCH); do \
march=`echo $$arch | sed 's/\([^-]\)\-.*/\1/'`; \
march2=`echo $$march | sed 's/_/-/g'`; \
mkdir $(GOBJCPATHS); \
mv $(GOBJCINCLUDES) \
$(GOBJCPATH)/usr/$$march/lib/gcc-lib/$$arch/$(VERSION)/include;\
mv $(GOBJCLIBSN) \
$(GOBJCPATH)/usr/$$march/$$arch/lib/nof; \
mv $(GOBJCLIBS) \
$(GOBJCPATH)/usr/$$march/$$arch/lib || true; \
done
# Move data to g77 package
cd $(GCC); for arch in $(ARCH); do \
march=`echo $$arch | sed 's/\([^-]\)\-.*/\1/'`; \
march2=`echo $$march | sed 's/_/-/g'`; \
mkdir $(G77PATHS); \
mv $(G77BINS) $(G77PATH)/usr/$$march/bin; \
mv $(G77INCLUDES) \
$(G77PATH)/usr/$$march/lib/gcc-lib/$$arch/$(VERSION)/include; \
mv $(G77LIBS) \
$(G77PATH)/usr/$$march/lib/gcc-lib/$$arch/$(VERSION) || true; \
done

binary-indep: build install

binary-arch: build install
dh_testdir
dh_testroot
dh_installdocs
dh_installman
dh_installinfo
dh_installchangelogs
dh_link
dh_compress
dh_fixperms
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure


debian/rules.def
----------
#!/usr/bin/make -f
# -*- makefile -*-
# debian/rules file for the Debian/GNU Linux gcc-cross-3.3 package
# Copyright 2002-2004 by Julien LEMOINE <speedblue@debian.org>

VERSION = 3.3.3
GCC = gcc-3.3.3
ARCH = sparc64-linux powerpc64-linux \
x86_64-linux m68k-linux \
hppa-linux sparc-linux \
mips-linux arm-linux \
powerpc-linux alpha-linux \
ia64-linux mipsel-linux \
s390-linux

PATCH = gcc-names gcc-version \
libstdc++-incdir libstdc++-codecvt \
libstdc++-pic

GCCPATH = $(CURDIR)/debian/gcc-3.3-$$march2
G++PATH = $(CURDIR)/debian/g++-3.3-$$march2
GOBJCPATH = $(CURDIR)/debian/gobjc-3.3-$$march2
G77PATH = $(CURDIR)/debian/g77-3.3-$$march2

G++PATHS = $(G++PATH)/usr \
$(G++PATH)/usr/$$march \
$(G++PATH)/usr/$$march/bin \
$(G++PATH)/usr/$$march/include \
$(G++PATH)/usr/man \
$(G++PATH)/usr/man/man1 \
$(G++PATH)/usr/$$march/$$arch \
$(G++PATH)/usr/$$march/$$arch/lib \
$(G++PATH)/usr/$$march/$$arch/lib/nof
G++BINS = $(GCCPATH)/usr/$$march/bin/$$arch-g++ \
$(GCCPATH)/usr/$$march/bin/$$arch-c++ \
$(GCCPATH)/usr/$$march/bin/$$arch-c++filt
G++MANS = $(GCCPATH)/usr/man/man1/$$arch-g++.1
G++INCLUDES = $(GCCPATH)/usr/$$march/include/c++
G++LIBS = $(GCCPATH)/usr/$$march/$$arch/lib/libstdc++.a \
$(GCCPATH)/usr/$$march/$$arch/lib/libstdc++.la \
$(GCCPATH)/usr/$$march/$$arch/lib/libstdc++.so \
$(GCCPATH)/usr/$$march/$$arch/lib/libstdc++.so.5 \
$(GCCPATH)/usr/$$march/$$arch/lib/libstdc++.so.5.0.1 \
$(GCCPATH)/usr/$$march/$$arch/lib/libstdc++_pic.a \
$(GCCPATH)/usr/$$march/$$arch/lib/libsupc++.a \
$(GCCPATH)/usr/$$march/$$arch/lib/libsupc++.la
G++LIBSN = $(GCCPATH)/usr/$$march/$$arch/lib/nof/libstdc++.a \
$(GCCPATH)/usr/$$march/$$arch/lib/nof/libstdc++.la \
$(GCCPATH)/usr/$$march/$$arch/lib/nof/libstdc++.so \
$(GCCPATH)/usr/$$march/$$arch/lib/nof/libstdc++.so.5 \
$(GCCPATH)/usr/$$march/$$arch/lib/nof/libstdc++.so.5.0.1\
$(GCCPATH)/usr/$$march/$$arch/lib/nof/libstdc++_pic.a \
$(GCCPATH)/usr/$$march/$$arch/lib/nof/libsupc++.a \
$(GCCPATH)/usr/$$march/$$arch/lib/nof/libsupc++.la

GOBJCPATHS = $(GOBJCPATH)/usr \
$(GOBJCPATH)/usr/$$march \
$(GOBJCPATH)/usr/$$march/$$arch \
$(GOBJCPATH)/usr/$$march/$$arch/lib \
$(GOBJCPATH)/usr/$$march/$$arch/lib/nof \
$(GOBJCPATH)/usr/$$march/lib \
$(GOBJCPATH)/usr/$$march/lib/gcc-lib \
$(GOBJCPATH)/usr/$$march/lib/gcc-lib/$$arch \
$(GOBJCPATH)/usr/$$march/lib/gcc-lib/$$arch/$(VERSION)\
$(GOBJCPATH)/usr/$$march/lib/gcc-lib/$$arch/$(VERSION)/include
GOBJCINCLUDES =
$(GCCPATH)/usr/$$march/lib/gcc-lib/$$arch/$(VERSION)/include/objc
GOBJCLIBS = $(GCCPATH)/usr/$$march/$$arch/lib/libobjc.a \
$(GCCPATH)/usr/$$march/$$arch/lib/libobjc.la \
$(GCCPATH)/usr/$$march/$$arch/lib/libobjc.so \
$(GCCPATH)/usr/$$march/$$arch/lib/libobjc.so.1 \
$(GCCPATH)/usr/$$march/$$arch/lib/libobjc.so.1.0.0
GOBJCLIBSN = $(GCCPATH)/usr/$$march/$$arch/lib/nof/libobjc.a \
$(GCCPATH)/usr/$$march/$$arch/lib/nof/libobjc.la \
$(GCCPATH)/usr/$$march/$$arch/lib/nof/libobjc.so \
$(GCCPATH)/usr/$$march/$$arch/lib/nof/libobjc.so.1 \
$(GCCPATH)/usr/$$march/$$arch/lib/nof/libobjc.so.1.0.0
G77PATHS = $(G77PATH)/usr \
$(G77PATH)/usr/$$march \
$(G77PATH)/usr/$$march/$$arch \
$(G77PATH)/usr/$$march/$$arch/lib \
$(G77PATH)/usr/$$march/$$arch/lib/nof \
$(G77PATH)/usr/$$march/lib \
$(G77PATH)/usr/$$march/bin \
$(G77PATH)/usr/$$march/lib/gcc-lib \
$(G77PATH)/usr/$$march/lib/gcc-lib/$$arch \
$(G77PATH)/usr/$$march/lib/gcc-lib/$$arch/$(VERSION) \
$(G77PATH)/usr/$$march/lib/gcc-lib/$$arch/$(VERSION)/include
G77BINS = $(GCCPATH)/usr/$$march/bin/$$arch-g77
G77INCLUDES =
$(GCCPATH)/usr/$$march/lib/gcc-lib/$$arch/$(VERSION)/include/gobjc \
$(GCCPATH)/usr/$$march/lib/gcc-lib/$$arch/$(VERSION)/include/g2c.h
G77LIBS = $(GCCPATH)/usr/$$march/lib/gcc-lib/$$arch/$(VERSION)/f771 \
$(GCCPATH)/usr/$$march/$$arch/lib/libg2c.a \
$(GCCPATH)/usr/$$march/$$arch/lib/libg2c.la \
$(GCCPATH)/usr/$$march/$$arch/lib/libg2c.so.0.0.0 \
$(GCCPATH)/usr/$$march/$$arch/lib/libg2c.so.0 \
$(GCCPATH)/usr/$$march/$$arch/lib/libg2c.so \
$(GCCPATH)/usr/$$march/$$arch/lib/nof/libg2c.a \
$(GCCPATH)/usr/$$march/$$arch/lib/nof/libg2c.la \
$(GCCPATH)/usr/$$march/$$arch/lib/nof/libg2c.so.0.0.0 \
$(GCCPATH)/usr/$$march/$$arch/lib/nof/libg2c.so.0 \
$(GCCPATH)/usr/$$march/$$arch/lib/nof/libg2c.so



----------
yama1066@xxxxxxxxxxxxxxx