Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mikezang

macrumors 6502a
Original poster
May 22, 2010
924
36
Tokyo, Japan
I tried to create a cross compile for my old Lego RCX, I use GCC 3.3.6 and NEWLIB 1.13.
Code:
1. Download GCC 3.3.6 and Unzip
  cd ../..
  wget http://gcc.parentingamerica.com/releases/gcc-3.3.6/gcc-3.3.6.tar.gz
  tar xzvf gcc-3.3.6/gcc-3.3.6.tar.gz

2. Download NEWLIB 1.13 and unzip
  wget ftp://sourceware.org/pub/newlib/newlib-1.13.0.tar.gz
  tar xzvf newlib-1.13.0.tar.gz

3. Link NEWLIB to GCC
   cd gcc-3.3.6/
   ln -s ../newlib-1.13.0/newlib .

4. Make h8300-hms build folder
   cd ..
   mkdir build_gcc_h8300-hms

5. Config
   ../gcc-3.3.6/configure --prefix=/usr/local/h8300-hms --program-prefix=h8300-hms- --target=h8300-hms --enable-languages=c,c++ --with-newlib

6. Make 
   make CFLAGS="-O2 -fomit-frame-pointer" all

When I make it, at last I got error as below, what can I do?
Code:
gcc -c   -O2 -fomit-frame-pointer -DIN_GCC -DCROSS_COMPILE  -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes    -DHAVE_CONFIG_H    -I. -Icp -I../../gcc-3.3.6/gcc -I../../gcc-3.3.6/gcc/cp -I../../gcc-3.3.6/gcc/config -I../../gcc-3.3.6/gcc/../include ../../gcc-3.3.6/gcc/cp/cp-lang.c -o cp/cp-lang.o

gcc   -O2 -fomit-frame-pointer -DIN_GCC -DCROSS_COMPILE  -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long   -DHAVE_CONFIG_H  -o cc1plus \

          cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parse.o cp/ptree.o cp/rtti.o cp/spew.o cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o cp/method.o cp/search.o cp/semantics.o cp/tree.o cp/repo.o cp/dump.o cp/optimize.o cp/mangle.o cp/cp-lang.o attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o c-dump.o  c-pretty-print.o c-opts.o main.o libbackend.a libcpp.a ./intl/libintl.a  -liconv  ../libiberty/libiberty.a

Undefined symbols for architecture x86_64:

  "_libc_name_p", referenced from:

      _nothrow_libfn_p in except.o

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

make[1]: *** [cc1plus] Error 1

make: *** [all-gcc] Error 2
 
What is happening is that OS X's linker can't find the specified function in anything it is trying to link. The reason for this could be a missing preprocessor macro, or the compiled code and/or library isn't being linked.
 
What is happening is that OS X's linker can't find the specified function in anything it is trying to link. The reason for this could be a missing preprocessor macro, or the compiled code and/or library isn't being linked.
Thanks for your message! can you tell me how to solve this problem?
 
Thanks for your message! can you tell me how to solve this problem?

I'm only guessing here but I think you may need to have gperf installed. Then start building from scratch - i.e. make distclean or similar - or just delete your directory and expand the tar file again.
 
Thanks for your message! can you tell me how to solve this problem?

Looks like you are using the wrong GCC.

Either type full path to GCC 3.3.6 or add it to the path with a different name than GCC (because Apple already provides a GCC command which happens to actually run clang). This is why you have the following error:

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

You are actually running Clang which compiles to x86_64. You need to run the GCC that you compiled. Normally when compiling GCC as a cross compiler you give it a different name than GCC (which is one of the configure script options for GCC when compiling it) so that you can tell the difference between the GCC provided by the system and your own GCC cross compiler.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.