PageRenderTime 61ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/doc/cross-compile.html

https://github.com/sd542927172/StreamOS
HTML | 420 lines | 293 code | 127 blank | 0 comment | 0 complexity | 6a6b64d489fcc8a67c58b2733594679e MD5 | raw file
Possible License(s): GPL-2.0
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html lang="ru">
  3. <head>
  4. <meta name="generator" content="OpenACS version 5.2.3b2">
  5. <title>Cross-compiling for go32v2 under linux</title>
  6. <link rel="stylesheet" type="text/css" href="/resources/acs-templating/lists.css" media="all">
  7. <link rel="stylesheet" type="text/css" href="/resources/acs-templating/forms.css" media="all">
  8. <link rel="stylesheet" type="text/css" href="/resources/acs-subsite/default-master.css" media="all">
  9. <script type="text/javascript" src="/resources/acs-subsite/core.js"></script>
  10. <link rel="stylesheet" type="text/css" href="/resources/acs-subsite/site-master.css" media="all">
  11. <link rel="stylesheet" type="text/css" href="http://www.freepascal.org/css/fp.css" media="all">
  12. <link rel="alternate stylesheet" type="text/css" href="http://www.freepascal.org/css/fp-navl.css" media="all" title="Nav-Left">
  13. <link rel="shortcut icon" href="http://www.freepascal.org/favicon.ico">
  14. </head>
  15. <body onload="" lang="ru">
  16. <div id="header">
  17. <div id="menu" lang="ru">
  18. <a href="http://www.freepascal.org/">Главная</a>
  19. <a href="http://www.freepascal.org/news">Новости</a>
  20. <a href="http://www.freepascal.org/download.var">Скачать</a>
  21. <a href="http://wiki.freepascal.org/">Вики</a>
  22. <a href="http://community.freepascal.org:10000">Сообщество</a>
  23. <a href="http://www.freepascal.org/docs.var">Документация</a>
  24. <a href="http://www.freepascal.org/mantis/set_project.php?project_id=6">Поиск ошибок</a>
  25. </div>
  26. <img src="http://www.freepascal.org/pic/logo.gif" alt="FPC Logo" width="133" height="63" />
  27. <div class="spacer"></div>
  28. <div id="welcome" lang="ru">
  29. Not logged in
  30. <a href="/shared/whos-online">0 участника в сети</a>
  31. <a href="/register/?return%5furl=%2fbboards%2fmessage%3fmessage%255fid%3d252000%26forum%255fid%3d24083" title="Log in to Free Pascal Community">Вход в систему</a>
  32. </div>
  33. <h1>free pascal community</h1>
  34. <h2>Open source compiler for Pascal and Object Pascal</h2>
  35. </div>
  36. <div id="content">
  37. <div id="sidebar" lang="ru">
  38. <h1>Основное</h1>
  39. <div class="submenu" lang="ru">
  40. <a href="http://www.freepascal.org/">Главная</a>
  41. <a href="http://www.freepascal.org/news.var">Новости</a>
  42. <a href="http://www.freepascal.org/download.var">Скачать</a>
  43. <a href="http://www.freepascal.org/wiki">Вики</a>
  44. <a href="http://community.freepascal.org:10000">Сообщество</a>
  45. <a href="http://www.freepascal.org/docs.var">Документация</a>
  46. <a href="http://www.freepascal.org/mantis/set_project.php?project_id=6">Поиск ошибок</a>
  47. </div>
  48. <h1>Программистам</h1>
  49. <div class="submenu" lang="ru">
  50. <a href="http://www.freepascal.org/advantage.var">Преимущества</a>
  51. <a href="http://www.freepascal.org/develop.var">Разработка</a>
  52. <a href="http://www.freepascal.org/future.var">Планы на будущее</a>
  53. <a href="http://www.freepascal.org/probs.var">Известные сложности</a>
  54. <a href="http://www.freepascal.org/fpcmac.var">FPC на Mac</a>
  55. <a href="http://www.freepascal.org/faq.var">ЧаВо</a>
  56. <a href="http://www.freepascal.org/units.var">Модули</a>
  57. <a href="http://www.freepascal.org/contrib/db.php3">Сторонние модули</a>
  58. <a href="http://www.freepascal.org/contrib/add.php3">Внести свой вклад</a>
  59. <a href="http://www.freepascal.org/moreinfo.var">Дополнительная информация</a>
  60. <a href="http://www.freepascal.org/maillist.var">Рассылки</a>
  61. <a href="http://www.freepascal.org/port.var">Миграция с TP7</a>
  62. <a href="http://www.freepascal.org/aboutus.var">Авторы</a>
  63. <a href="http://www.freepascal.org/credits.var">Заслуги</a>
  64. <a href="http://www.freepascal.org/links.var">Ссылки/Зеркальные сайты</a>
  65. </div>
  66. <h1>Инструменты</h1>
  67. <div class="submenu" lang="ru">
  68. <a href="http://www.freepascal.org/prog.html">Programmer's tools</a>
  69. <a href="http://www.freepascal.org/tools/tools.html">Tools</a>
  70. <a href="http://www.freepascal.org/tools/delp.html">Delp</a>
  71. <a href="http://www.freepascal.org/tools/fpcmake.html">FPCMake</a>
  72. <a href="http://www.freepascal.org/tools/h2pas.html">H2Pas</a>
  73. <a href="http://www.freepascal.org/tools/ppdep.html">PPDep</a>
  74. <a href="http://www.freepascal.org/tools/ppudump.html">PPUDump</a>
  75. <a href="http://www.freepascal.org/tools/ppumove.html">PPUMove</a>
  76. <a href="http://www.freepascal.org/tools/ptop.html">PtoP</a>
  77. <a href="http://www.freepascal.org/tools/rstconv.html">RSTConv</a>
  78. <a href="http://www.freepascal.org/tools/tply.html">TPLY</a>
  79. <a href="http://www.freepascal.org/fcl/fcl.html">FCL</a>
  80. <a href="http://www.freepascal.org/packages/packages.html">Packages</a>
  81. </div>
  82. <h1>Поиск</h1>
  83. Искать в документации, форумах и рассылках.
  84. <form action="http://community.freepascal.org:10000/search/search" method="get">
  85. <p><input type="text" name="q" size="20" maxlength="256"/></p>
  86. <p><input type="submit" value="Поиск" name="t"/>
  87. <input type="submit" value="Повезёт?" name="t"/>
  88. </p>
  89. </form>
  90. <div class="logos">
  91. <p><a href="http://www.lazarus.freepascal.org"><img src="http://www.freepascal.org/pic/lazarus_produced_logo.gif" alt="Lazarus Logo" height="57" width="125" /></a></p>
  92. <p><a href="http://www.ffii.org"><img src="http://demo.ffii.org/banners/bsod7s_88x31.en.png" alt="EU-Council segfaulted" height="31" width="88" /></a></p>
  93. <p><a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=2174&amp;type=1" width="88" height="31" alt="SourceForge.net Logo" /></a></p>
  94. <p><a href="http://www.toolbox-mag.de/"><img src="http://www.freepascal.org/txlogo.gif" width="128" height="48" alt="Toolbox Logo" /></a></p>
  95. </div>
  96. </div>
  97. <div id="mainbar">
  98. <div id="context-bar">
  99. <div id="navlinks"></div>
  100. <div id="breadcrumbs" lang="ru">
  101. <ul>
  102. <li><a href="/">Сообщество</a> &#187;</li>
  103. <li><a href="/bboards/">Форумы</a> &#187;</li>
  104. <li><a href="forum?forum%5fid=24083">Developing for Linux</a> &#187;</li>
  105. <li>One message</li>
  106. </ul>
  107. </div>
  108. </div>
  109. <div id="page-body" lang="ru">
  110. <br><h1 class="page-title">Cross-compiling for go32v2 under linux</h1>
  111. <blockquote>
  112. <div align='right'>
  113. <A href='/notifications/request-new?pretty%5fname=Cross%2dcompiling+for+go32v2+under+linux&amp;return%5furl=%2fbboards%2fmessage%3fmessage%5fid%3d252000%26forum%5fid%3d24083&amp;type%5fid=173140&amp;object%5fid=252000&amp;user%5fid=0'>Notify me of responses</A>
  114. </div>
  115. <table cellspacing=0 cellpadding=3 border=0 width="100%">
  116. <tr>
  117. <td colspan=2 align="left">
  118. <br>First of all excuse me my English, it's not my native language.
  119. The problem occured when i tried to compile a sourcefile for DOS under linux, typing such code:
  120. <PRE>
  121. [root@localhost 2.3.1]# ./ppc386 -Tgo32v2 ./test.pas
  122. Free Pascal Compiler version 2.3.1 [2007/05/27] for i386
  123. Copyright (c) 1993-2007 by Florian Klaempfl
  124. Target OS: GO32 V2 DOS extender
  125. Compiling ./test.pas
  126. Fatal: Can't find unit System used by Program
  127. Fatal: Compilation aborted
  128. </PRE>
  129. Then i tried to include path to unit System:
  130. <PRE>
  131. [root@localhost 2.3.1]# ./ppc386 -Tgo32v2 -Fu/fpc/rtl/go32v2/ /root/my-big-work/test.pas
  132. Free Pascal Compiler version 2.3.1 [2007/05/27] for i386
  133. Copyright (c) 1993-2007 by Florian Klaempfl
  134. Target OS: GO32 V2 DOS extender
  135. Compiling /root/my-big-work/test.pas
  136. Compiling /fpc/rtl/go32v2/system.pp
  137. system.pp(34,2) Fatal: Can't open include file "systemh.inc"
  138. Fatal: Compilation aborted
  139. </PRE>
  140. I've included lot of paths i could find. After a few attempt i got huge list of errors while compiling `test.pas', so that i couldn't believe it should be so difficult to cross-compile a sourcefile for DOS.
  141. I've tried to compile a compiler for DOS by getting fpc sources and typing:
  142. <PRE>
  143. cd compiler
  144. make clean
  145. make cycle OS_TARGET=go32v2
  146. </PRE>
  147. After prolonged compiling ' got such error:
  148. <PRE>
  149. i386-go32v2-as -o ../../rtl/units/i386-go32v2/prt0.o v2prt0.as
  150. make: i386-go32v2-as: Command not found
  151. make: *** [prt0.o] Error 127
  152. </PRE>
  153. So, what should i do to get a compiler, that could compile programs for DOS? (I'm using Fedora Core 6 (Red Hat Linux kernel) and i would like to run my programs through Dosbox DOS Emulator under FC6)
  154. </td>
  155. </tr>
  156. <tr>
  157. <td colspan=1 align="left">
  158. -- <a href="messages-by-user?forum_id=24083&amp;user_id=251990">Alexey Taran</a>, Май 27, 2007 13:01
  159. </td>
  160. <td align="right"><small>
  161. <a href="message-mail?forum_id=24083&amp;message_id=252000">(email)</a>
  162. </small></td>
  163. </tr>
  164. </table>
  165. </blockquote>
  166. <br><h1>Answers:</h1>
  167. <h2></h2>
  168. <a name="252042"></a>
  169. <blockquote>
  170. <table cellspacing=0 cellpadding=3 border=0 width="100%">
  171. <tr>
  172. <td colspan=2 align="left">
  173. <br>Well, you are experimenting in the right direction.&nbsp; What you need is a cross-assembler and linker. Perhaps they are in your distribution, otherwise you need to build them yourself or find them on the internet. Then you can build a go32 by executing a make command in the rtl directory. After that you can cross-compile.
  174. </td>
  175. </tr>
  176. <tr>
  177. <td colspan=1 align="left">
  178. -- <a href="messages-by-user?forum_id=24083&amp;user_id=454">Daniël Mantione</a>, Май 27, 2007 15:26
  179. </td>
  180. <td align="right"><small>
  181. <a href="message-mail?forum_id=24083&amp;message_id=252042">(email)</a>
  182. </small></td>
  183. </tr>
  184. </table>
  185. </blockquote>
  186. <h2></h2>
  187. <a name="252092"></a>
  188. <blockquote>
  189. <table cellspacing=0 cellpadding=3 border=0 width="100%">
  190. <tr>
  191. <td colspan=2 align="left">
  192. <br>1. Ok, i've got `binutils' source and compiled a cross-assembler `i386-go32v2-as' & cross-linker `i386-go32v2-ld'. I've putted that to /rtl/go32v2 and tried to run `make'. It was compiled without errors. So i typed:
  193. <PRE>
  194. cd compiler
  195. make cycle
  196. make install
  197. </PRE>
  198. and tried to compile my `test.pas' using new ppc386 compiler. I've got such error:
  199. <PRE>
  200. ./ppc386 -Tgo32v2 ./test.pas
  201. Free Pascal Compiler version 2.3.1 [2007/05/27] for i386
  202. Copyright (c) 1993-2007 by Florian Klaempfl
  203. Target OS: GO32 V2 DOS extender
  204. Compiling /root/my-big-work/test.pas
  205. Fatal: Can't find unit System used by Program
  206. Fatal: Compilation aborted
  207. </PRE>
  208. So, where is my mistake? I thought that i've got a cross-compiler, but it isn't true.<BR>
  209. 2. I've tried to make a cross-compiler for win32, but i couldn't understand which target OS set for compiling cross-assembler & linker - `cygwin' or `mingw'? What is the difference between them?<BR><BR>
  210. ---------------------<BR><BR>
  211. I hope i've done right. My goal is to get a cross-compiler from linux (FC6) to go32v2. So, here is my actions:<BR>
  212. 1. I've got `binutils' source and putted it to /binutils. After
  213. <PRE>
  214. cd /binutils
  215. mkdir cross-utils
  216. cd ./cross-utils
  217. ../configure --target=i386-pc-go32
  218. make
  219. </PRE>
  220. i've found few new folders with `as-new' and `ld-new', my cross-assembler and cross-linker. I renamed them to `i386-go32v2-as ' and `i386-go32v2-ld', and copied to /usr/bin.<BR>
  221. 2. Having fpc sources, i've typed:
  222. <PRE>
  223. cd /fpc/compiler
  224. make clean
  225. make cycle
  226. make install INSTALL_PREFIX=/usr/local
  227. </PRE>
  228. So, i've got new compiler, `ppcnew' say. I've continued:
  229. <PRE>
  230. cd /fpc/rtl/go32v2
  231. make distclean # or make clean. I think, it doesn't matter.
  232. make all OS_TARGET=go32v2 PP=/path_to_new_compiler/ppcnew
  233. </PRE>
  234. Some time passed while making, and i've got `i386-go32v2' folder in /fpc/rtl/units. So, i copied it to /path_to_new_compiler/units. After i tried to compile `hello world' and it worked!<BR>
  235. Thanks a lot, you really helped me to deal with cross-compiling, because i didn't know about the importance of `as' and `ld' utils. :) <BR>
  236. P.S. I've tried to make a cross-compiler for win32, and it also worked!
  237. </td>
  238. </tr>
  239. <tr>
  240. <td colspan=1 align="left">
  241. -- <a href="messages-by-user?forum_id=24083&amp;user_id=251990">Alexey Taran</a>, Май 28, 2007 00:35
  242. </td>
  243. <td align="right"><small>
  244. <a href="message-mail?forum_id=24083&amp;message_id=252092">(email)</a>
  245. </small></td>
  246. </tr>
  247. </table>
  248. </blockquote>
  249. <h2></h2>
  250. <a name="253286"></a>
  251. <blockquote>
  252. <table cellspacing=0 cellpadding=3 border=0 width="100%">
  253. <tr>
  254. <td colspan=2 align="left">
  255. <br>Also have a look at</p>
  256. <p><a href="http://www.stack.nl/~marcov/buildfaq.pdf">http://www.stack.nl/~marcov/buildfaq.pdf</a></p>
  257. <p style="margin-bottom: 0px;">for some crosscompiling background info
  258. </td>
  259. </tr>
  260. <tr>
  261. <td colspan=1 align="left">
  262. -- <a href="messages-by-user?forum_id=24083&amp;user_id=2823">Marco van de Voort</a>, Июнь 13, 2007 12:25
  263. </td>
  264. <td align="right"><small>
  265. <a href="message-mail?forum_id=24083&amp;message_id=253286">(email)</a>
  266. </small></td>
  267. </tr>
  268. </table>
  269. </blockquote>
  270. <center><form action="message-new">
  271. <input type="hidden" name="forum_id" value="24083">
  272. <input type="hidden" name="reply_to" value="252000">
  273. <input type="submit" value="Contribute an answer">
  274. </form></center>
  275. <small>
  276. </small>
  277. <p>
  278. </div>
  279. <div id="site-footer">
  280. <div class="action-list">
  281. <ul>
  282. <li><a href="/acs-lang/?package%5fid=656">Изменить язык интерфейса</a></li>
  283. </ul>
  284. </div>
  285. </div>
  286. </div>
  287. </div>
  288. <div id="footer">
  289. Copyright Free Pascal team 1993-2006.<br />
  290. Page design by <a href="http://www.sixshootermedia.com">6ix Shooter Media</a>, additional modifications by <a href="mailto:mcposeidon@mcville.net">Pos3idon</a>.
  291. </div>
  292. </body>
  293. </html>