Advertisement
SoCo_cpp

Cross Compiling chrpath-0.14

Nov 17th, 2011
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.66 KB | None | 0 0
  1. /------------------------------\
  2. | Cross Compiling chrpath-0.14 |
  3. \------------------------------/
  4.  
  5. A typical compile and install of chrpath would follow the common routine:
  6.  
  7. $ ./configure
  8. $ make
  9. $ make install
  10.  
  11. ## A Typical Cross Compile Environment:
  12.  
  13. Cross compile environments take on some common directory structures and tool-chain naming conventions.
  14.  
  15. Mainly, tool chain directory system is logically within some sub directory that contains your cross compile environment. All your compile tools normally in /usr/bin, libraries normally in /usr/lib, and headers normally in /usr/include, are in your environment's identical sub-directories.
  16.  
  17. /(root)
  18. /usr
  19. bin
  20. include
  21. lib
  22. /opt
  23. cross
  24. mycross-env
  25. usr
  26. bin
  27. include
  28. lib
  29.  
  30. Your compile tools take on a naming convention that prefixes their name with the target system type. So the gcc and g++ compile tools for an ARM cross compiler would be named arm-linux-gnueabi-gcc and arm-linux-gnueabi-g++, if your target was arm-linux-gnueabi.
  31.  
  32. ## A Typical Cross Compile:
  33.  
  34. A typical cross compile requires little more than telling the configure script the target system's type with the --target argument.
  35.  
  36. When using the target argument, the configure script detects that the target and host are different and goes into cross compile mode. It should automatically prefix the tools with the target naming convention.
  37. (gcc -> my-target-gcc)
  38.  
  39. You typically use the --prefix argument to specify that the compilation output should be installed into the cross compile environment, not your host computer's standard locations.
  40. (/usr/bin/out -> /opt/cross/mycross-env/usr/bin/out)
  41.  
  42. Additionally, you could tell configure your host system type with the --host argument, but configure usually auto-detects this with a config.guess script. Also, you can tell configure that your build environment is different from both your host and target with the --build argument, for fancy Canadian Cross techniques.
  43.  
  44. ## Cross Compiling chrpath-0.14:
  45.  
  46. 1) You should tell configure that your target is different that your host by including the --target argument.
  47. 2) You should tell configure the base directory to install into with the --prefix argument.
  48.  
  49. Note) The tool name prefixing doesn't seem to work. Since chrpath only has C source files, you can specify the tool manually with the CC argument.
  50.  
  51. 3) You should manually specify your C compiler's full directory and file name.
  52.  
  53.  
  54. So we specify the target, the prefix, and manually specify the C compiler tool (relative paths are generally not allowed).
  55.  
  56. Example depicts cross compile environment at /opt/cross/EMAC-OE_stable-2009_SDK_i486 and target system type of i486-emac-linux:
  57.  
  58. $ ./configure \
  59. --target=i486-emac-linux \
  60. --prefix=/opt/cross/EMAC-OE_stable-2009_SDK_i486/gcc-4.2.4-i486-emac-linux \
  61. CC=/opt/cross/EMAC-OE_stable-2009_SDK_i486/gcc-4.2.4-i486-emac-linux/bin/i486-emac-linux-gcc
  62.  
  63. $ make
  64. $ make install
  65.  
  66. This will install the finished files in their proper sub directories within the prefix directory (the cross compile environment directory).
  67.  
  68. If your concerned that the files will not be installed to the correct locations, override the make install with the DESTDIR argument to further prefix the install directories:
  69.  
  70. $ make install DESTDIR=/opt/cross/test
  71.  
  72. This should result in the following helpful verification test install:
  73.  
  74. /opt/cross/test/opt/cross/EMAC-OE_stable-2009_SDK_i486/bin/chrpath
  75.  
  76. Once you verify the output is structured correctly, drop the DESTDIR and let it install into your cross compile environment.
  77.  
  78. -----------------------------
  79. SoCo
  80.  
  81.  
  82.  
  83.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement