2015년 11월 8일 일요일

Make Cross-Compiler(2); How to Build and Install GCC on Macbook Pro 2015 early

- My Development Environment
Mac OS X 10.11.1 El Capitan
already installed Binutils
already installed Xcode

It is similar to build and install Binutils but your time can waste too much.
Please do this when you have enough time.

- Procedure

1. Download  GCC Source codes at https://gcc.gnu.org/ (click 'our mirror sites' after clicking any versions)

2. extract your files
 example)  $ cd ~/Downloads/
                 $ tar -zxvf gcc-5.2.tar.gz  (tar.gz files can extract as zxvf command.)
                 $ cd gcc-5.2   (move to ~/Downloads/gcc-5.2/)
3. downloads libraries when your computer need as this command.
 $ ./contrib/download_prerequisites

4. setup your platform and location.
$ export TARGET=x86_64-pc-linux
$ export PREFIX=/opt/cross  (<- this location is same to setup binutils)

 Confirm .bash_profile  (It is already have after doing Make Cross-Compiler(1))
 You can see
export PATH=/opt/cross/bin:$PATH
when you type  $cat ~/.bash_profile

5. build and install

$ ./configure --target=$TARGET --prefix=$PREFIX --enable-64-bit-bfd --disable-shared --disable-nls
$ make configure-host
$ make LDFLAGS="-all-static"
$ sudo make install

6. How to test gcc cross-compiler after install that.
$ /opt/cross/bin/x86_64-pc-linux-gcc -dumpspecs | grep -A1 multilib_options

result

I use too much time. cheer up! . It is really hard to me. So I leave this text.


-My Problems
C compiler cannot create executables when I type $./configure ~~~blar~~~
Solve this problem to delete installed binutils then to reinstall them in my case.
$rm -rf /opt  can removes all the binutils.  ***Use caution when you type rm command.


References
Book <64비트 멀티코어 OS 원리와 구조>

Procedure of Explanation.
http://nayuta.net/64%EB%B9%84%ED%8A%B8_%EB%A9%80%ED%8B%B0%EC%BD%94%EC%96%B4_OS_%EC%9B%90%EB%A6%AC%EC%99%80_%EA%B5%AC%EC%A1%B0/OS_X%EC%97%90%EC%84%9C_%EA%B0%9C%EB%B0%9C%ED%99%98%EA%B2%BD_%EA%B5%AC%EC%B6%95%ED%95%98%EA%B8%B0

댓글 없음:

댓글 쓰기