You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.html 72 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584
  1. <!doctype html>
  2. <html lang="en" class="no-js">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1">
  6. <link rel="canonical" href="https://openblas.net/docs/install/">
  7. <link rel="prev" href="..">
  8. <link rel="next" href="../user_manual/">
  9. <link rel="icon" href="../logo.svg">
  10. <meta name="generator" content="mkdocs-1.6.0, mkdocs-material-9.5.26">
  11. <title>Install OpenBLAS - OpenBLAS</title>
  12. <link rel="stylesheet" href="../assets/stylesheets/main.6543a935.min.css">
  13. <link rel="stylesheet" href="../assets/stylesheets/palette.06af60db.min.css">
  14. <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  15. <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback">
  16. <style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
  17. <script>__md_scope=new URL("..",location),__md_hash=e=>[...e].reduce((e,_)=>(e<<5)-e+_.charCodeAt(0),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
  18. </head>
  19. <body dir="ltr" data-md-color-scheme="default" data-md-color-primary="grey" data-md-color-accent="indigo">
  20. <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
  21. <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
  22. <label class="md-overlay" for="__drawer"></label>
  23. <div data-md-component="skip">
  24. <a href="#install-openblas" class="md-skip">
  25. Skip to content
  26. </a>
  27. </div>
  28. <div data-md-component="announce">
  29. </div>
  30. <header class="md-header md-header--shadow" data-md-component="header">
  31. <nav class="md-header__inner md-grid" aria-label="Header">
  32. <a href=".." title="OpenBLAS" class="md-header__button md-logo" aria-label="OpenBLAS" data-md-component="logo">
  33. <img src="../logo.svg" alt="logo">
  34. </a>
  35. <label class="md-header__button md-icon" for="__drawer">
  36. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"/></svg>
  37. </label>
  38. <div class="md-header__title" data-md-component="header-title">
  39. <div class="md-header__ellipsis">
  40. <div class="md-header__topic">
  41. <span class="md-ellipsis">
  42. OpenBLAS
  43. </span>
  44. </div>
  45. <div class="md-header__topic" data-md-component="header-topic">
  46. <span class="md-ellipsis">
  47. Install OpenBLAS
  48. </span>
  49. </div>
  50. </div>
  51. </div>
  52. <label class="md-header__button md-icon" for="__search">
  53. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
  54. </label>
  55. <div class="md-search" data-md-component="search" role="dialog">
  56. <label class="md-search__overlay" for="__search"></label>
  57. <div class="md-search__inner" role="search">
  58. <form class="md-search__form" name="search">
  59. <input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
  60. <label class="md-search__icon md-icon" for="__search">
  61. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
  62. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12Z"/></svg>
  63. </label>
  64. <nav class="md-search__options" aria-label="Search">
  65. <button type="reset" class="md-search__icon md-icon" title="Clear" aria-label="Clear" tabindex="-1">
  66. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41Z"/></svg>
  67. </button>
  68. </nav>
  69. </form>
  70. <div class="md-search__output">
  71. <div class="md-search__scrollwrap" tabindex="0" data-md-scrollfix>
  72. <div class="md-search-result" data-md-component="search-result">
  73. <div class="md-search-result__meta">
  74. Initializing search
  75. </div>
  76. <ol class="md-search-result__list" role="presentation"></ol>
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. </nav>
  83. </header>
  84. <div class="md-container" data-md-component="container">
  85. <main class="md-main" data-md-component="main">
  86. <div class="md-main__inner md-grid">
  87. <div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
  88. <div class="md-sidebar__scrollwrap">
  89. <div class="md-sidebar__inner">
  90. <nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
  91. <label class="md-nav__title" for="__drawer">
  92. <a href=".." title="OpenBLAS" class="md-nav__button md-logo" aria-label="OpenBLAS" data-md-component="logo">
  93. <img src="../logo.svg" alt="logo">
  94. </a>
  95. OpenBLAS
  96. </label>
  97. <ul class="md-nav__list" data-md-scrollfix>
  98. <li class="md-nav__item">
  99. <a href=".." class="md-nav__link">
  100. <span class="md-ellipsis">
  101. Home
  102. </span>
  103. </a>
  104. </li>
  105. <li class="md-nav__item md-nav__item--active">
  106. <input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
  107. <label class="md-nav__link md-nav__link--active" for="__toc">
  108. <span class="md-ellipsis">
  109. Install OpenBLAS
  110. </span>
  111. <span class="md-nav__icon md-icon"></span>
  112. </label>
  113. <a href="./" class="md-nav__link md-nav__link--active">
  114. <span class="md-ellipsis">
  115. Install OpenBLAS
  116. </span>
  117. </a>
  118. <nav class="md-nav md-nav--secondary" aria-label="Table of contents">
  119. <label class="md-nav__title" for="__toc">
  120. <span class="md-nav__icon md-icon"></span>
  121. Table of contents
  122. </label>
  123. <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
  124. <li class="md-nav__item">
  125. <a href="#quick-install" class="md-nav__link">
  126. <span class="md-ellipsis">
  127. Quick install
  128. </span>
  129. </a>
  130. </li>
  131. <li class="md-nav__item">
  132. <a href="#source" class="md-nav__link">
  133. <span class="md-ellipsis">
  134. Source
  135. </span>
  136. </a>
  137. </li>
  138. <li class="md-nav__item">
  139. <a href="#platforms" class="md-nav__link">
  140. <span class="md-ellipsis">
  141. Platforms
  142. </span>
  143. </a>
  144. <nav class="md-nav" aria-label="Platforms">
  145. <ul class="md-nav__list">
  146. <li class="md-nav__item">
  147. <a href="#linux" class="md-nav__link">
  148. <span class="md-ellipsis">
  149. Linux
  150. </span>
  151. </a>
  152. <nav class="md-nav" aria-label="Linux">
  153. <ul class="md-nav__list">
  154. <li class="md-nav__item">
  155. <a href="#precompiled-packages" class="md-nav__link">
  156. <span class="md-ellipsis">
  157. Precompiled packages
  158. </span>
  159. </a>
  160. </li>
  161. </ul>
  162. </nav>
  163. </li>
  164. <li class="md-nav__item">
  165. <a href="#windows" class="md-nav__link">
  166. <span class="md-ellipsis">
  167. Windows
  168. </span>
  169. </a>
  170. <nav class="md-nav" aria-label="Windows">
  171. <ul class="md-nav__list">
  172. <li class="md-nav__item">
  173. <a href="#precompiled-packages_1" class="md-nav__link">
  174. <span class="md-ellipsis">
  175. Precompiled packages
  176. </span>
  177. </a>
  178. </li>
  179. <li class="md-nav__item">
  180. <a href="#visual-studio" class="md-nav__link">
  181. <span class="md-ellipsis">
  182. Visual Studio
  183. </span>
  184. </a>
  185. </li>
  186. <li class="md-nav__item">
  187. <a href="#windows-on-arm" class="md-nav__link">
  188. <span class="md-ellipsis">
  189. Windows on Arm
  190. </span>
  191. </a>
  192. </li>
  193. <li class="md-nav__item">
  194. <a href="#mingw-import-library" class="md-nav__link">
  195. <span class="md-ellipsis">
  196. MinGW import library
  197. </span>
  198. </a>
  199. </li>
  200. </ul>
  201. </nav>
  202. </li>
  203. <li class="md-nav__item">
  204. <a href="#mac-osx" class="md-nav__link">
  205. <span class="md-ellipsis">
  206. Mac OSX
  207. </span>
  208. </a>
  209. <nav class="md-nav" aria-label="Mac OSX">
  210. <ul class="md-nav__list">
  211. <li class="md-nav__item">
  212. <a href="#precompiled-packages_2" class="md-nav__link">
  213. <span class="md-ellipsis">
  214. Precompiled packages
  215. </span>
  216. </a>
  217. </li>
  218. <li class="md-nav__item">
  219. <a href="#build-on-apple-m1" class="md-nav__link">
  220. <span class="md-ellipsis">
  221. Build on Apple M1
  222. </span>
  223. </a>
  224. </li>
  225. </ul>
  226. </nav>
  227. </li>
  228. <li class="md-nav__item">
  229. <a href="#android" class="md-nav__link">
  230. <span class="md-ellipsis">
  231. Android
  232. </span>
  233. </a>
  234. <nav class="md-nav" aria-label="Android">
  235. <ul class="md-nav__list">
  236. <li class="md-nav__item">
  237. <a href="#prerequisites_1" class="md-nav__link">
  238. <span class="md-ellipsis">
  239. Prerequisites
  240. </span>
  241. </a>
  242. </li>
  243. <li class="md-nav__item">
  244. <a href="#building-with-android-ndk-using-clang-compiler" class="md-nav__link">
  245. <span class="md-ellipsis">
  246. Building with android NDK using clang compiler
  247. </span>
  248. </a>
  249. </li>
  250. <li class="md-nav__item">
  251. <a href="#build-armv7-with-clang" class="md-nav__link">
  252. <span class="md-ellipsis">
  253. Build ARMV7 with clang
  254. </span>
  255. </a>
  256. </li>
  257. <li class="md-nav__item">
  258. <a href="#build-armv8-with-clang" class="md-nav__link">
  259. <span class="md-ellipsis">
  260. Build ARMV8 with clang
  261. </span>
  262. </a>
  263. </li>
  264. <li class="md-nav__item">
  265. <a href="#alternative-script-which-was-tested-on-osx-with-ndk2136528147" class="md-nav__link">
  266. <span class="md-ellipsis">
  267. Alternative script which was tested on OSX with NDK(21.3.6528147)
  268. </span>
  269. </a>
  270. </li>
  271. <li class="md-nav__item">
  272. <a href="#building-openblas-with-very-old-gcc-based-versions-of-the-ndk-without-fortran" class="md-nav__link">
  273. <span class="md-ellipsis">
  274. Building OpenBLAS with very old gcc-based versions of the NDK, without Fortran
  275. </span>
  276. </a>
  277. </li>
  278. <li class="md-nav__item">
  279. <a href="#building-openblas-with-fortran" class="md-nav__link">
  280. <span class="md-ellipsis">
  281. Building OpenBLAS with Fortran
  282. </span>
  283. </a>
  284. </li>
  285. <li class="md-nav__item">
  286. <a href="#linking-openblas-0219-and-earlier-for-armv7" class="md-nav__link">
  287. <span class="md-ellipsis">
  288. Linking OpenBLAS (0.2.19 and earlier) for ARMV7
  289. </span>
  290. </a>
  291. </li>
  292. </ul>
  293. </nav>
  294. </li>
  295. <li class="md-nav__item">
  296. <a href="#iphoneios" class="md-nav__link">
  297. <span class="md-ellipsis">
  298. iPhone/iOS
  299. </span>
  300. </a>
  301. </li>
  302. <li class="md-nav__item">
  303. <a href="#mips" class="md-nav__link">
  304. <span class="md-ellipsis">
  305. MIPS
  306. </span>
  307. </a>
  308. </li>
  309. <li class="md-nav__item">
  310. <a href="#freebsd" class="md-nav__link">
  311. <span class="md-ellipsis">
  312. FreeBSD
  313. </span>
  314. </a>
  315. </li>
  316. <li class="md-nav__item">
  317. <a href="#cortex-m" class="md-nav__link">
  318. <span class="md-ellipsis">
  319. Cortex-M
  320. </span>
  321. </a>
  322. </li>
  323. </ul>
  324. </nav>
  325. </li>
  326. </ul>
  327. </nav>
  328. </li>
  329. <li class="md-nav__item">
  330. <a href="../user_manual/" class="md-nav__link">
  331. <span class="md-ellipsis">
  332. User manual
  333. </span>
  334. </a>
  335. </li>
  336. <li class="md-nav__item">
  337. <a href="../extensions/" class="md-nav__link">
  338. <span class="md-ellipsis">
  339. Extensions
  340. </span>
  341. </a>
  342. </li>
  343. <li class="md-nav__item">
  344. <a href="../developers/" class="md-nav__link">
  345. <span class="md-ellipsis">
  346. Developer manual
  347. </span>
  348. </a>
  349. </li>
  350. <li class="md-nav__item">
  351. <a href="../build_system/" class="md-nav__link">
  352. <span class="md-ellipsis">
  353. Build system
  354. </span>
  355. </a>
  356. </li>
  357. <li class="md-nav__item">
  358. <a href="../distributing/" class="md-nav__link">
  359. <span class="md-ellipsis">
  360. Redistributing OpenBLAS
  361. </span>
  362. </a>
  363. </li>
  364. <li class="md-nav__item">
  365. <a href="../ci/" class="md-nav__link">
  366. <span class="md-ellipsis">
  367. CI jobs
  368. </span>
  369. </a>
  370. </li>
  371. <li class="md-nav__item">
  372. <a href="../about/" class="md-nav__link">
  373. <span class="md-ellipsis">
  374. About
  375. </span>
  376. </a>
  377. </li>
  378. <li class="md-nav__item">
  379. <a href="../faq/" class="md-nav__link">
  380. <span class="md-ellipsis">
  381. FAQ
  382. </span>
  383. </a>
  384. </li>
  385. </ul>
  386. </nav>
  387. </div>
  388. </div>
  389. </div>
  390. <div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
  391. <div class="md-sidebar__scrollwrap">
  392. <div class="md-sidebar__inner">
  393. <nav class="md-nav md-nav--secondary" aria-label="Table of contents">
  394. <label class="md-nav__title" for="__toc">
  395. <span class="md-nav__icon md-icon"></span>
  396. Table of contents
  397. </label>
  398. <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
  399. <li class="md-nav__item">
  400. <a href="#quick-install" class="md-nav__link">
  401. <span class="md-ellipsis">
  402. Quick install
  403. </span>
  404. </a>
  405. </li>
  406. <li class="md-nav__item">
  407. <a href="#source" class="md-nav__link">
  408. <span class="md-ellipsis">
  409. Source
  410. </span>
  411. </a>
  412. </li>
  413. <li class="md-nav__item">
  414. <a href="#platforms" class="md-nav__link">
  415. <span class="md-ellipsis">
  416. Platforms
  417. </span>
  418. </a>
  419. <nav class="md-nav" aria-label="Platforms">
  420. <ul class="md-nav__list">
  421. <li class="md-nav__item">
  422. <a href="#linux" class="md-nav__link">
  423. <span class="md-ellipsis">
  424. Linux
  425. </span>
  426. </a>
  427. <nav class="md-nav" aria-label="Linux">
  428. <ul class="md-nav__list">
  429. <li class="md-nav__item">
  430. <a href="#precompiled-packages" class="md-nav__link">
  431. <span class="md-ellipsis">
  432. Precompiled packages
  433. </span>
  434. </a>
  435. </li>
  436. </ul>
  437. </nav>
  438. </li>
  439. <li class="md-nav__item">
  440. <a href="#windows" class="md-nav__link">
  441. <span class="md-ellipsis">
  442. Windows
  443. </span>
  444. </a>
  445. <nav class="md-nav" aria-label="Windows">
  446. <ul class="md-nav__list">
  447. <li class="md-nav__item">
  448. <a href="#precompiled-packages_1" class="md-nav__link">
  449. <span class="md-ellipsis">
  450. Precompiled packages
  451. </span>
  452. </a>
  453. </li>
  454. <li class="md-nav__item">
  455. <a href="#visual-studio" class="md-nav__link">
  456. <span class="md-ellipsis">
  457. Visual Studio
  458. </span>
  459. </a>
  460. </li>
  461. <li class="md-nav__item">
  462. <a href="#windows-on-arm" class="md-nav__link">
  463. <span class="md-ellipsis">
  464. Windows on Arm
  465. </span>
  466. </a>
  467. </li>
  468. <li class="md-nav__item">
  469. <a href="#mingw-import-library" class="md-nav__link">
  470. <span class="md-ellipsis">
  471. MinGW import library
  472. </span>
  473. </a>
  474. </li>
  475. </ul>
  476. </nav>
  477. </li>
  478. <li class="md-nav__item">
  479. <a href="#mac-osx" class="md-nav__link">
  480. <span class="md-ellipsis">
  481. Mac OSX
  482. </span>
  483. </a>
  484. <nav class="md-nav" aria-label="Mac OSX">
  485. <ul class="md-nav__list">
  486. <li class="md-nav__item">
  487. <a href="#precompiled-packages_2" class="md-nav__link">
  488. <span class="md-ellipsis">
  489. Precompiled packages
  490. </span>
  491. </a>
  492. </li>
  493. <li class="md-nav__item">
  494. <a href="#build-on-apple-m1" class="md-nav__link">
  495. <span class="md-ellipsis">
  496. Build on Apple M1
  497. </span>
  498. </a>
  499. </li>
  500. </ul>
  501. </nav>
  502. </li>
  503. <li class="md-nav__item">
  504. <a href="#android" class="md-nav__link">
  505. <span class="md-ellipsis">
  506. Android
  507. </span>
  508. </a>
  509. <nav class="md-nav" aria-label="Android">
  510. <ul class="md-nav__list">
  511. <li class="md-nav__item">
  512. <a href="#prerequisites_1" class="md-nav__link">
  513. <span class="md-ellipsis">
  514. Prerequisites
  515. </span>
  516. </a>
  517. </li>
  518. <li class="md-nav__item">
  519. <a href="#building-with-android-ndk-using-clang-compiler" class="md-nav__link">
  520. <span class="md-ellipsis">
  521. Building with android NDK using clang compiler
  522. </span>
  523. </a>
  524. </li>
  525. <li class="md-nav__item">
  526. <a href="#build-armv7-with-clang" class="md-nav__link">
  527. <span class="md-ellipsis">
  528. Build ARMV7 with clang
  529. </span>
  530. </a>
  531. </li>
  532. <li class="md-nav__item">
  533. <a href="#build-armv8-with-clang" class="md-nav__link">
  534. <span class="md-ellipsis">
  535. Build ARMV8 with clang
  536. </span>
  537. </a>
  538. </li>
  539. <li class="md-nav__item">
  540. <a href="#alternative-script-which-was-tested-on-osx-with-ndk2136528147" class="md-nav__link">
  541. <span class="md-ellipsis">
  542. Alternative script which was tested on OSX with NDK(21.3.6528147)
  543. </span>
  544. </a>
  545. </li>
  546. <li class="md-nav__item">
  547. <a href="#building-openblas-with-very-old-gcc-based-versions-of-the-ndk-without-fortran" class="md-nav__link">
  548. <span class="md-ellipsis">
  549. Building OpenBLAS with very old gcc-based versions of the NDK, without Fortran
  550. </span>
  551. </a>
  552. </li>
  553. <li class="md-nav__item">
  554. <a href="#building-openblas-with-fortran" class="md-nav__link">
  555. <span class="md-ellipsis">
  556. Building OpenBLAS with Fortran
  557. </span>
  558. </a>
  559. </li>
  560. <li class="md-nav__item">
  561. <a href="#linking-openblas-0219-and-earlier-for-armv7" class="md-nav__link">
  562. <span class="md-ellipsis">
  563. Linking OpenBLAS (0.2.19 and earlier) for ARMV7
  564. </span>
  565. </a>
  566. </li>
  567. </ul>
  568. </nav>
  569. </li>
  570. <li class="md-nav__item">
  571. <a href="#iphoneios" class="md-nav__link">
  572. <span class="md-ellipsis">
  573. iPhone/iOS
  574. </span>
  575. </a>
  576. </li>
  577. <li class="md-nav__item">
  578. <a href="#mips" class="md-nav__link">
  579. <span class="md-ellipsis">
  580. MIPS
  581. </span>
  582. </a>
  583. </li>
  584. <li class="md-nav__item">
  585. <a href="#freebsd" class="md-nav__link">
  586. <span class="md-ellipsis">
  587. FreeBSD
  588. </span>
  589. </a>
  590. </li>
  591. <li class="md-nav__item">
  592. <a href="#cortex-m" class="md-nav__link">
  593. <span class="md-ellipsis">
  594. Cortex-M
  595. </span>
  596. </a>
  597. </li>
  598. </ul>
  599. </nav>
  600. </li>
  601. </ul>
  602. </nav>
  603. </div>
  604. </div>
  605. </div>
  606. <div class="md-content" data-md-component="content">
  607. <article class="md-content__inner md-typeset">
  608. <h1 id="install-openblas">Install OpenBLAS</h1>
  609. <div class="admonition note">
  610. <p class="admonition-title">Note</p>
  611. <p>Lists of precompiled packages are not comprehensive, is not meant to validate nor endorse a particular third-party build over others, and may not always lead to the newest version</p>
  612. </div>
  613. <h2 id="quick-install">Quick install</h2>
  614. <p>Precompiled packages have recently become available for a number of platforms through their normal installation procedures, so for users of desktop devices at least, the instructions below are mostly relevant when you want to try the most recent development snapshot from git. See your platform's relevant "Precompiled packages" section.</p>
  615. <p>The <a href="https://github.com/conda-forge">Conda-Forge</a> project maintains packages for the conda package manager at <a href="https://github.com/conda-forge/openblas-feedstock">https://github.com/conda-forge/openblas-feedstock</a>.</p>
  616. <h2 id="source">Source</h2>
  617. <p>Download the latest <a href="https://github.com/xianyi/OpenBLAS/releases">stable version</a> from release page.</p>
  618. <h2 id="platforms">Platforms</h2>
  619. <h3 id="linux">Linux</h3>
  620. <p>Just type <code>make</code> to compile the library.</p>
  621. <p>Notes:</p>
  622. <ul>
  623. <li>OpenBLAS doesn't support g77. Please use gfortran or other Fortran compilers. e.g. <code>make FC=gfortran</code>.</li>
  624. <li>When building in an emulator (KVM,QEMU etc.) make sure that the combination of CPU features exposed to
  625. the virtual environment matches that of an existing CPU to allow detection of the cpu model to succeed.
  626. (With qemu, this can be done by passing <code>-cpu host</code> or a supported model name at invocation)</li>
  627. </ul>
  628. <h4 id="precompiled-packages">Precompiled packages</h4>
  629. <h5 id="debianubuntumintkali">Debian/Ubuntu/Mint/Kali</h5>
  630. <p>OpenBLAS package is available in default repositories and can act as default BLAS in system</p>
  631. <p>Example installation commands:
  632. <div class="highlight"><pre><span></span><code>$<span class="w"> </span>sudo<span class="w"> </span>apt<span class="w"> </span>update
  633. $<span class="w"> </span>apt<span class="w"> </span>search<span class="w"> </span>openblas
  634. $<span class="w"> </span>sudo<span class="w"> </span>apt<span class="w"> </span>install<span class="w"> </span>libopenblas-dev
  635. $<span class="w"> </span>sudo<span class="w"> </span>update-alternatives<span class="w"> </span>--config<span class="w"> </span>libblas.so.3
  636. </code></pre></div>
  637. Alternatively, if distributor's package proves unsatisfactory, you may try latest version of OpenBLAS, <a href="../faq/#debianlts">Following guide in OpenBLAS FAQ</a></p>
  638. <h5 id="opensusesle">openSuSE/SLE</h5>
  639. <p>Recent OpenSUSE versions include OpenBLAS in default repositories and also permit OpenBLAS to act as replacement of system-wide BLAS.</p>
  640. <p>Example installation commands:
  641. <div class="highlight"><pre><span></span><code>$<span class="w"> </span>sudo<span class="w"> </span>zypper<span class="w"> </span>ref
  642. $<span class="w"> </span>zypper<span class="w"> </span>se<span class="w"> </span>openblas
  643. $<span class="w"> </span>sudo<span class="w"> </span>zypper<span class="w"> </span><span class="k">in</span><span class="w"> </span>openblas-devel
  644. $<span class="w"> </span>sudo<span class="w"> </span>update-alternatives<span class="w"> </span>--config<span class="w"> </span>libblas.so.3
  645. </code></pre></div>
  646. Should you be using older OpenSUSE or SLE that provides no OpenBLAS, you can attach optional or experimental openSUSE repository as a new package source to acquire recent build of OpenBLAS following <a href="https://software.opensuse.org/package/openblas">instructions on openSUSE software site</a></p>
  647. <h5 id="fedoracentosrhel">Fedora/CentOS/RHEL</h5>
  648. <p>Fedora provides OpenBLAS in default installation repositories.</p>
  649. <p>To install it try following:
  650. <div class="highlight"><pre><span></span><code>$<span class="w"> </span>dnf<span class="w"> </span>search<span class="w"> </span>openblas
  651. $<span class="w"> </span>dnf<span class="w"> </span>install<span class="w"> </span>openblas-devel
  652. </code></pre></div>
  653. For CentOS/RHEL/Scientific Linux packages are provided via <a href="https://fedoraproject.org/wiki/EPEL">Fedora EPEL repository</a></p>
  654. <p>After adding repository and repository keys installation is pretty straightforward:
  655. <div class="highlight"><pre><span></span><code>$<span class="w"> </span>yum<span class="w"> </span>search<span class="w"> </span>openblas
  656. $<span class="w"> </span>yum<span class="w"> </span>install<span class="w"> </span>openblas-devel
  657. </code></pre></div>
  658. No alternatives mechanism is provided for BLAS, and packages in system repositories are linked against NetLib BLAS or ATLAS BLAS libraries. You may wish to re-package RPMs to use OpenBLAS instead <a href="https://fedoraproject.org/wiki/How_to_create_an_RPM_package">as described here</a></p>
  659. <h5 id="mageia">Mageia</h5>
  660. <p>Mageia offers ATLAS and NetLIB LAPACK in base repositories.
  661. You can build your own OpenBLAS replacement, and once installed in /opt
  662. TODO: populate /usr/lib64 /usr/include accurately to replicate netlib with update-alternatives</p>
  663. <h5 id="archmanjaroantergos">Arch/Manjaro/Antergos</h5>
  664. <div class="highlight"><pre><span></span><code>$<span class="w"> </span>sudo<span class="w"> </span>pacman<span class="w"> </span>-S<span class="w"> </span>openblas
  665. </code></pre></div>
  666. <h3 id="windows">Windows</h3>
  667. <p>The precompiled binaries available with each release (in <a href="https://github.com/xianyi/OpenBLAS/releases">https://github.com/xianyi/OpenBLAS/releases</a>) are
  668. created with MinGW using an option list of
  669. "NUM_THREADS=64 TARGET=GENERIC DYNAMIC_ARCH=1 DYNAMIC_OLDER=1 CONSISTENT_FPCSR=1" - they should work on
  670. any x86 or x86_64 computer. The zip archive contains the include files, static and dll libraries as well
  671. as configuration files for getting them found via CMAKE or pkgconfig - just create a suitable folder for
  672. your OpenBLAS installation and unzip it there. (Note that you will need to edit the provided openblas.pc
  673. and OpenBLASConfig.cmake to reflect the installation path on your computer, as distributed they have "win"
  674. or "win64" reflecting the local paths on the system they were built on). Some programs will expect the DLL
  675. name to be lapack.dll, blas.dll, or (in the case of the statistics package "R") even Rblas.dll to act as a
  676. direct replacement for whatever other implementation of BLAS and LAPACK they use by default. Just copy the
  677. openblas.dll to the desired name(s).
  678. Note that the provided binaries are built with INTERFACE64=0, meaning they use standard 32bit integers for
  679. array indexing and the like (as is the default for most if not all BLAS and LAPACK implementations). If the
  680. documentation of whatever program you are using with OpenBLAS mentions 64bit integers (INTERFACE64=1) for
  681. addressing huge matrix sizes, you will need to build OpenBLAS from source (or open an issue ticket to make
  682. the demand for such a precompiled build known).</p>
  683. <h4 id="precompiled-packages_1">Precompiled packages</h4>
  684. <ul>
  685. <li><a href="http://sourceforge.net/projects/openblas/files">http://sourceforge.net/projects/openblas/files</a></li>
  686. <li><a href="https://www.nuget.org/packages?q=openblas">https://www.nuget.org/packages?q=openblas</a></li>
  687. </ul>
  688. <h4 id="visual-studio">Visual Studio</h4>
  689. <p>As of OpenBLAS v0.2.15, we support MinGW and Visual Studio (using CMake to generate visual studio solution files &ndash; note that you will need at least version 3.11 of CMake for linking to work correctly) to build OpenBLAS on Windows.</p>
  690. <p>Note that you need a Fortran compiler if you plan to build and use the LAPACK functions included with OpenBLAS. The sections below describe using either <code>flang</code> as an add-on to clang/LLVM or <code>gfortran</code> as part of MinGW for this purpose. If you want to use the Intel Fortran compiler <code>ifort</code> for this, be sure to also use the Intel C compiler <code>icc</code> for building the C parts, as the ABI imposed by <code>ifort</code> is incompatible with <code>msvc</code>.</p>
  691. <h5 id="1-native-msvc-abi">1. Native (MSVC) ABI</h5>
  692. <p>A fully-optimized OpenBLAS that can be statically or dynamically linked to your application can currently be built for the 64-bit architecture with the LLVM compiler infrastructure. We're going to use Miniconda3 to grab all of the tools we need, since some of them are in an experimental status. Before you begin, you'll need to have Microsoft Visual Studio 2015 or newer installed.</p>
  693. <ol>
  694. <li>Install Miniconda3 for 64 bits using <code>winget install --id Anaconda.Miniconda3</code> or easily download from <a href="https://docs.conda.io/en/latest/miniconda.html">conda.io</a>.</li>
  695. <li>Open the "Anaconda Command Prompt," now available in the Start Menu, or at <code>%USERPROFILE%\miniconda3\shell\condabin\conda-hook.ps1</code>.</li>
  696. <li>In that command prompt window, use <code>cd</code> to change to the directory where you want to build OpenBLAS</li>
  697. <li>Now install all of the tools we need:</li>
  698. </ol>
  699. <div class="highlight"><pre><span></span><code>conda update -n base conda
  700. conda config --add channels conda-forge
  701. conda install -y cmake flang clangdev perl libflang ninja
  702. </code></pre></div>
  703. <ol>
  704. <li>Still in the Anaconda Command Prompt window, activate the MSVC environment for 64 bits with <code>vcvarsall x64</code>. On Windows 11 with Visual Studio 2022, this would be done by invoking:</li>
  705. </ol>
  706. <div class="highlight"><pre><span></span><code><span class="s2">&quot;c:\Program Files\Microsoft Visual Studio\2022\Preview\vc\Auxiliary\Build\vcvars64.bat&quot;</span>
  707. </code></pre></div>
  708. <p>With VS2019, the command should be the same &ndash; except for the year number, obviously. For other/older versions of MSVC,
  709. the VS documentation or a quick search on the web should turn up the exact wording you need.</p>
  710. <p>Confirm that the environment is active by typing <code>link</code> &ndash; this should return a long list of possible options for the <code>link</code> command. If it just
  711. returns "command not found" or similar, review and retype the call to vcvars64.bat.
  712. <strong>NOTE:</strong> if you are working from a Visual Studio Command prompt window instead (so that you do not have to do the vcvars call), you need to invoke
  713. <code>conda activate</code> so that CONDA_PREFIX etc. get set up correctly before proceeding to step 6. Failing to do so will lead to link errors like
  714. libflangmain.lib not getting found later in the build.</p>
  715. <ol>
  716. <li>Now configure the project with CMake. Starting in the project directory, execute the following:</li>
  717. </ol>
  718. <div class="highlight"><pre><span></span><code>set &quot;LIB=%CONDA_PREFIX%\Library\lib;%LIB%&quot;
  719. set &quot;CPATH=%CONDA_PREFIX%\Library\include;%CPATH%&quot;
  720. mkdir build
  721. cd build
  722. cmake .. -G &quot;Ninja&quot; -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl -DCMAKE_Fortran_COMPILER=flang -DCMAKE_MT=mt -DBUILD_WITHOUT_LAPACK=no -DNOFORTRAN=0 -DDYNAMIC_ARCH=ON -DCMAKE_BUILD_TYPE=Release
  723. </code></pre></div>
  724. <p>You may want to add further options in the <code>cmake</code> command here &ndash; for instance, the default only produces a static .lib version of the library. If you would rather have a DLL, add -DBUILD_SHARED_LIBS=ON above. Note that this step only creates some command files and directories, the actual build happens next.</p>
  725. <ol>
  726. <li>Build the project:</li>
  727. </ol>
  728. <p><div class="highlight"><pre><span></span><code>cmake --build . --config Release
  729. </code></pre></div>
  730. This step will create the OpenBLAS library in the "lib" directory, and various build-time tests in the <code>test</code>, <code>ctest</code> and <code>openblas_utest</code> directories. However it will not separate the header files you might need for building your own programs from those used internally. To put all relevant files in a more convenient arrangement, run the next step.</p>
  731. <ol>
  732. <li>Install all relevant files created by the build</li>
  733. </ol>
  734. <p><div class="highlight"><pre><span></span><code>cmake --install . --prefix c:\opt -v
  735. </code></pre></div>
  736. This will copy all files that are needed for building and running your own programs with OpenBLAS to the given location, creating appropriate subdirectories for the individual kinds of files. In the case of "C:\opt" as given above, this would be C:\opt\include\openblas for the header files,
  737. C:\opt\bin for the libopenblas.dll and C:\opt\lib for the static library. C:\opt\share holds various support files that enable other cmake-based build scripts to find OpenBLAS automatically.</p>
  738. <h6 id="visual-studio-2017-c2017-standard">Visual studio 2017+ (C++2017 standard)</h6>
  739. <p>In newer visual studio versions, Microsoft has changed <a href="https://docs.microsoft.com/en-us/cpp/c-runtime-library/complex-math-support?view=msvc-170#types-used-in-complex-math">how it handles complex types</a>. Even when using a precompiled version of OpenBLAS, you might need to define <code>LAPACK_COMPLEX_CUSTOM</code> in order to define complex types properly for MSVC. For example, some variant of the following might help:</p>
  740. <div class="highlight"><pre><span></span><code>#if defined(_MSC_VER)
  741. #include &lt;complex.h&gt;
  742. #define LAPACK_COMPLEX_CUSTOM
  743. #define lapack_complex_float _Fcomplex
  744. #define lapack_complex_double _Dcomplex
  745. #endif
  746. </code></pre></div>
  747. <p>For reference, see https://github.com/xianyi/OpenBLAS/issues/3661, https://github.com/Reference-LAPACK/lapack/issues/683, and https://stackoverflow.com/questions/47520244/using-openblas-lapacke-in-visual-studio.</p>
  748. <h6 id="cmake-and-visual-studio">CMake and Visual Studio</h6>
  749. <p>To build OpenBLAS for the 32-bit architecture, you'll need to use the builtin Visual Studio compilers.</p>
  750. <div class="admonition note">
  751. <p class="admonition-title">Note</p>
  752. <p>This method may produce binaries which demonstrate significantly lower performance than those built with the other methods. (The Visual Studio compiler does not support the dialect of assembly used in the cpu-specific optimized files, so only the "generic" TARGET which is
  753. written in pure C will get built. For the same reason it is not possible (and not necessary) to use -DDYNAMIC_ARCH=ON in a Visual Studio build) You may consider building for the 32-bit architecture using the GNU (MinGW) ABI.</p>
  754. </div>
  755. <h6 id="1-install-cmake-at-windows"># 1. Install CMake at Windows</h6>
  756. <h6 id="2-use-cmake-to-generate-visual-studio-solution-files"># 2. Use CMake to generate Visual Studio solution files</h6>
  757. <div class="highlight"><pre><span></span><code># Do this from Powershell so cmake can find visual studio
  758. cmake -G &quot;Visual Studio 14 Win64&quot; -DCMAKE_BUILD_TYPE=Release .
  759. </code></pre></div>
  760. <h6 id="build-the-solution-at-visual-studio">Build the solution at Visual Studio</h6>
  761. <p>Note that this step depends on perl, so you'll need to install perl for windows, and put perl on your path so VS can start perl (http://stackoverflow.com/questions/3051049/active-perl-installation-on-windows-operating-system).</p>
  762. <p>Step 2 will build the OpenBLAS solution, open it in VS, and build the projects. Note that the dependencies do not seem to be automatically configured: if you try to build libopenblas directly, it will fail with a message saying that some .obj files aren't found, but if you build the projects libopenblas depends on before building libopenblas, the build will succeed.</p>
  763. <h6 id="build-openblas-for-universal-windows-platform">Build OpenBLAS for Universal Windows Platform</h6>
  764. <p>OpenBLAS can be built for use on the <a href="https://en.wikipedia.org/wiki/Universal_Windows_Platform">Universal Windows Platform</a> using a two step process since commit <a href="https://github.com/xianyi/OpenBLAS/commit/c66b842d66c5516e52804bf5a0544d18b1da1b44">c66b842</a>.</p>
  765. <h6 id="1-follow-steps-1-and-2-above-to-build-the-visual-studio-solution-files-for-windows-this-builds-the-helper-executables-which-are-required-when-building-the-openblas-visual-studio-solution-files-for-uwp-in-step-2"># 1. Follow steps 1 and 2 above to build the Visual Studio solution files for Windows. This builds the helper executables which are required when building the OpenBLAS Visual Studio solution files for UWP in step 2.</h6>
  766. <h6 id="2-remove-the-generated-cmakecachetxt-and-cmakefiles-directory-from-the-openblas-source-directory-and-re-run-cmake-with-the-following-options"># 2. Remove the generated CMakeCache.txt and CMakeFiles directory from the OpenBLAS source directory and re-run CMake with the following options:</h6>
  767. <div class="highlight"><pre><span></span><code># do this to build UWP compatible solution files
  768. cmake -G &quot;Visual Studio 14 Win64&quot; -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=&quot;10.0&quot; -DCMAKE_SYSTEM_PROCESSOR=AMD64 -DVS_WINRT_COMPONENT=TRUE -DCMAKE_BUILD_TYPE=Release .
  769. </code></pre></div>
  770. <h6 id="build-the-solution-with-visual-studio"># Build the solution with Visual Studio</h6>
  771. <p>This will build the OpenBLAS binaries with the required settings for use with UWP.</p>
  772. <h5 id="2-gnu-mingw-abi">2. GNU (MinGW) ABI</h5>
  773. <p>The resulting library can be used in Visual Studio, but it can only be linked dynamically. This configuration has not been thoroughly tested and should be considered experimental.</p>
  774. <h6 id="incompatible-x86-calling-conventions">Incompatible x86 calling conventions</h6>
  775. <p>Due to incompatibilities between the calling conventions of MinGW and Visual Studio you will need to make the following modifications ( <strong>32-bit only</strong> ):</p>
  776. <ol>
  777. <li>Use the newer GCC 4.7.0. The older GCC (&lt;4.7.0) has an ABI incompatibility for returning aggregate structures larger than 8 bytes with MSVC. </li>
  778. </ol>
  779. <h6 id="build-openblas-on-windows-os">Build OpenBLAS on Windows OS</h6>
  780. <ol>
  781. <li>Install the MinGW (GCC) compiler suite, either 32-bit (http://www.mingw.org/) or 64-bit (http://mingw-w64.sourceforge.net/). Be sure to install its gfortran package as well (unless you really want to build the BLAS part of OpenBLAS only) and check that gcc and gfortran are the same version &ndash; mixing compilers from different sources or release versions can lead to strange error messages in the linking stage. In addition, please install MSYS with MinGW.</li>
  782. <li>Build OpenBLAS in the MSYS shell. Usually, you can just type "make". OpenBLAS will detect the compiler and CPU automatically. </li>
  783. <li>After the build is complete, OpenBLAS will generate the static library "libopenblas.a" and the shared dll library "libopenblas.dll" in the folder. You can type "make PREFIX=/your/installation/path install" to install the library to a certain location.</li>
  784. </ol>
  785. <div class="admonition note">
  786. <p class="admonition-title">Note</p>
  787. <p>We suggest using official MinGW or MinGW-w64 compilers. A user reported that s/he met <code>Unhandled exception</code> by other compiler suite. https://groups.google.com/forum/#!topic/openblas-users/me2S4LkE55w</p>
  788. </div>
  789. <p>Note also that older versions of the alternative builds of mingw-w64 available through http://www.msys2.org may contain a defect that leads to a compilation failure accompanied by the error message
  790. <div class="highlight"><pre><span></span><code>&lt;command-line&gt;:0:4: error: expected identifier or &#39;(&#39; before numeric constant
  791. </code></pre></div>
  792. If you encounter this, please upgrade your msys2 setup or see https://github.com/xianyi/OpenBLAS/issues/1503 for a workaround.</p>
  793. <h6 id="generate-import-library-before-0210-version">Generate import library (before 0.2.10 version)</h6>
  794. <ol>
  795. <li>First, you will need to have the <code>lib.exe</code> tool in the Visual Studio command prompt. </li>
  796. <li>Open the command prompt and type <code>cd OPENBLAS_TOP_DIR/exports</code>, where OPENBLAS_TOP_DIR is the main folder of your OpenBLAS installation.</li>
  797. <li>For a 32-bit library, type <code>lib /machine:i386 /def:libopenblas.def</code>. For 64-bit, type <code>lib /machine:X64 /def:libopenblas.def</code>.</li>
  798. <li>This will generate the import library "libopenblas.lib" and the export library "libopenblas.exp" in OPENBLAS_TOP_DIR/exports. Although these two files have the same name, they are totally different.</li>
  799. </ol>
  800. <h6 id="generate-import-library-0210-and-after-version">Generate import library (0.2.10 and after version)</h6>
  801. <ol>
  802. <li>OpenBLAS already generated the import library "libopenblas.dll.a" for "libopenblas.dll".</li>
  803. </ol>
  804. <h6 id="generate-windows-native-pdb-files-from-gccgfortran-build">generate windows native PDB files from gcc/gfortran build</h6>
  805. <p>Tool to do so is available at https://github.com/rainers/cv2pdb</p>
  806. <h6 id="use-openblas-dll-library-in-visual-studio">Use OpenBLAS .dll library in Visual Studio</h6>
  807. <ol>
  808. <li>Copy the import library (before 0.2.10: "OPENBLAS_TOP_DIR/exports/libopenblas.lib", 0.2.10 and after: "OPENBLAS_TOP_DIR/libopenblas.dll.a") and .dll library "libopenblas.dll" into the same folder(The folder of your project that is going to use the BLAS library. You may need to add the libopenblas.dll.a to the linker input list: properties-&gt;Linker-&gt;Input).</li>
  809. <li>Please follow the documentation about using third-party .dll libraries in MS Visual Studio 2008 or 2010. Make sure to link against a library for the correct architecture. For example, you may receive an error such as "The application was unable to start correctly (0xc000007b)" which typically indicates a mismatch between 32/64-bit libraries.</li>
  810. </ol>
  811. <div class="admonition note">
  812. <p class="admonition-title">Note</p>
  813. <p>If you need CBLAS, you should include cblas.h in /your/installation/path/include in Visual Studio. Please read <a href="http://github.com/xianyi/OpenBLAS/issues/95">this page</a>.</p>
  814. </div>
  815. <h6 id="limitations">Limitations</h6>
  816. <ul>
  817. <li>Both static and dynamic linking are supported with MinGW. With Visual Studio, however, only dynamic linking is supported and so you should use the import library.</li>
  818. <li>Debugging from Visual Studio does not work because MinGW and Visual Studio have incompatible formats for debug information (PDB vs. DWARF/STABS). You should either debug with GDB on the command-line or with a visual frontend, for instance <a href="http://www.eclipse.org/cdt/">Eclipse</a> or <a href="http://qt.nokia.com/products/developer-tools/">Qt Creator</a>.</li>
  819. </ul>
  820. <h4 id="windows-on-arm">Windows on Arm</h4>
  821. <h5 id="prerequisites">Prerequisites</h5>
  822. <p>Following tools needs to be installed</p>
  823. <h6 id="1-download-and-install-clang-for-windows-on-arm">1. Download and install clang for windows on arm</h6>
  824. <p>Find the latest LLVM build for WoA from <a href="https://releases.llvm.org/">LLVM release page</a></p>
  825. <p>E.g: LLVM 12 build for WoA64 can be found <a href="https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.0/LLVM-12.0.0-woa64.exe">here</a></p>
  826. <p>Run the LLVM installer and ensure that LLVM is added to environment PATH.</p>
  827. <h6 id="2-download-and-install-classic-flang-for-windows-on-arm">2. Download and install classic flang for windows on arm</h6>
  828. <p>Classic flang is the only available FORTRAN compiler for windows on arm for now and a pre-release build can be found <a href="https://github.com/kaadam/flang/releases/tag/v0.1">here</a></p>
  829. <p>There is no installer for classic flang and the zip package can be extracted and the path needs to be added to environment PATH.</p>
  830. <p>E.g: on PowerShell</p>
  831. <div class="highlight"><pre><span></span><code>$env:Path += &quot;;C:\flang_woa\bin&quot;
  832. </code></pre></div>
  833. <h5 id="build">Build</h5>
  834. <p>The following steps describe how to build the static library for OpenBLAS with and without LAPACK</p>
  835. <h6 id="1-build-openblas-static-library-with-blas-and-lapack-routines-with-make">1. Build OpenBLAS static library with BLAS and LAPACK routines with Make</h6>
  836. <p>Following command can be used to build OpenBLAS static library with BLAS and LAPACK routines</p>
  837. <div class="highlight"><pre><span></span><code>$<span class="w"> </span>make<span class="w"> </span><span class="nv">CC</span><span class="o">=</span><span class="s2">&quot;clang-cl&quot;</span><span class="w"> </span><span class="nv">HOSTCC</span><span class="o">=</span><span class="s2">&quot;clang-cl&quot;</span><span class="w"> </span><span class="nv">AR</span><span class="o">=</span><span class="s2">&quot;llvm-ar&quot;</span><span class="w"> </span><span class="nv">BUILD_WITHOUT_LAPACK</span><span class="o">=</span><span class="m">0</span><span class="w"> </span><span class="nv">NOFORTRAN</span><span class="o">=</span><span class="m">0</span><span class="w"> </span><span class="nv">DYNAMIC_ARCH</span><span class="o">=</span><span class="m">0</span><span class="w"> </span><span class="nv">TARGET</span><span class="o">=</span>ARMV8<span class="w"> </span><span class="nv">ARCH</span><span class="o">=</span>arm64<span class="w"> </span><span class="nv">BINARY</span><span class="o">=</span><span class="m">64</span><span class="w"> </span><span class="nv">USE_OPENMP</span><span class="o">=</span><span class="m">0</span><span class="w"> </span><span class="nv">PARALLEL</span><span class="o">=</span><span class="m">1</span><span class="w"> </span><span class="nv">RANLIB</span><span class="o">=</span><span class="s2">&quot;llvm-ranlib&quot;</span><span class="w"> </span><span class="nv">MAKE</span><span class="o">=</span>make<span class="w"> </span><span class="nv">F_COMPILER</span><span class="o">=</span>FLANG<span class="w"> </span><span class="nv">FC</span><span class="o">=</span>FLANG<span class="w"> </span><span class="nv">FFLAGS_NOOPT</span><span class="o">=</span><span class="s2">&quot;-march=armv8-a -cpp&quot;</span><span class="w"> </span><span class="nv">FFLAGS</span><span class="o">=</span><span class="s2">&quot;-march=armv8-a -cpp&quot;</span><span class="w"> </span><span class="nv">NEED_PIC</span><span class="o">=</span><span class="m">0</span><span class="w"> </span><span class="nv">HOSTARCH</span><span class="o">=</span>arm64<span class="w"> </span>libs<span class="w"> </span>netlib
  838. </code></pre></div>
  839. <h6 id="2-build-static-library-with-blas-routines-using-cmake">2. Build static library with BLAS routines using CMake</h6>
  840. <p>Classic flang has compatibility issues with cmake hence only BLAS routines can be compiled with CMake</p>
  841. <div class="highlight"><pre><span></span><code>$<span class="w"> </span>mkdir<span class="w"> </span>build
  842. $<span class="w"> </span><span class="nb">cd</span><span class="w"> </span>build
  843. $<span class="w"> </span>cmake<span class="w"> </span>..<span class="w"> </span>-G<span class="w"> </span>Ninja<span class="w"> </span>-DCMAKE_C_COMPILER<span class="o">=</span>clang<span class="w"> </span>-DBUILD_WITHOUT_LAPACK<span class="o">=</span><span class="m">1</span><span class="w"> </span>-DNOFORTRAN<span class="o">=</span><span class="m">1</span><span class="w"> </span>-DDYNAMIC_ARCH<span class="o">=</span><span class="m">0</span><span class="w"> </span>-DTARGET<span class="o">=</span>ARMV8<span class="w"> </span>-DARCH<span class="o">=</span>arm64<span class="w"> </span>-DBINARY<span class="o">=</span><span class="m">64</span><span class="w"> </span>-DUSE_OPENMP<span class="o">=</span><span class="m">0</span><span class="w"> </span>-DCMAKE_SYSTEM_PROCESSOR<span class="o">=</span>ARM64<span class="w"> </span>-DCMAKE_CROSSCOMPILING<span class="o">=</span><span class="m">1</span><span class="w"> </span>-DCMAKE_SYSTEM_NAME<span class="o">=</span>Windows
  844. $<span class="w"> </span>cmake<span class="w"> </span>--build<span class="w"> </span>.<span class="w"> </span>--config<span class="w"> </span>Release
  845. </code></pre></div>
  846. <h6 id="getarchexe-execution-error"><code>getarch.exe</code> execution error</h6>
  847. <p>If you notice that platform-specific headers by <code>getarch.exe</code> are not generated correctly, It could be due to a known debug runtime DLL issue for arm64 platforms. Please check out <a href="https://linaro.atlassian.net/wiki/spaces/WOAR/pages/28677636097/Debug+run-time+DLL+issue#Workaround">link</a> for the workaround.</p>
  848. <h4 id="mingw-import-library">MinGW import library</h4>
  849. <p>Microsoft Windows has this thing called "import libraries". You don't need it in MinGW because the <code>ld</code> linker from GNU Binutils is smart, but you may still want it for whatever reason.</p>
  850. <h5 id="make-the-def">Make the <code>.def</code></h5>
  851. <p>Import libraries are compiled from a list of what symbols to use, <code>.def</code>. This should be already in your <code>exports</code> directory: <code>cd OPENBLAS_TOP_DIR/exports</code>.</p>
  852. <h5 id="making-a-mingw-import-library">Making a MinGW import library</h5>
  853. <p>MinGW import libraries have the suffix <code>.a</code>, same as static libraries. (It's actually more common to do <code>.dll.a</code>...)</p>
  854. <p>You need to first prepend <code>libopenblas.def</code> with a line <code>LIBRARY libopenblas.dll</code>:</p>
  855. <pre><code>cat &lt;(echo "LIBRARY libopenblas.dll") libopenblas.def &gt; libopenblas.def.1
  856. mv libopenblas.def.1 libopenblas.def
  857. </code></pre>
  858. <p>Now it probably looks like:</p>
  859. <pre><code>LIBRARY libopenblas.dll
  860. EXPORTS
  861. caxpy=caxpy_ @1
  862. caxpy_=caxpy_ @2
  863. ...
  864. </code></pre>
  865. <p>Then, generate the import library: <code>dlltool -d libopenblas.def -l libopenblas.a</code></p>
  866. <p>Again, there is basically <strong>no point</strong> in making an import library for use in MinGW. It actually slows down linking.</p>
  867. <h5 id="making-a-msvc-import-library">Making a MSVC import library</h5>
  868. <p>Unlike MinGW, MSVC absolutely requires an import library. Now the C ABI of MSVC and MinGW are actually identical, so linking is actually okay. (Any incompatibility in the C ABI would be a bug.)</p>
  869. <p>The import libraries of MSVC have the suffix <code>.lib</code>. They are generated from a <code>.def</code> file using MSVC's <code>lib.exe</code>. See <a href="use_visual_studio.md#generate-import-library-before-0210-version">the MSVC instructions</a>.</p>
  870. <h5 id="notes">Notes</h5>
  871. <ul>
  872. <li>Always remember that MinGW is <strong>not the same</strong> as MSYS2 or Cygwin. MSYS2 and Cygwin are full POSIX environments with a lot of magic such as <code>fork()</code> and its own <code>malloc()</code>. MinGW, which builds on the normal Microsoft C Runtime, has none of that. Be clear about which one you are building for.</li>
  873. </ul>
  874. <h3 id="mac-osx">Mac OSX</h3>
  875. <p>If your CPU is Sandy Bridge, please use Clang version 3.1 and above. The Clang 3.0 will generate the wrong AVX binary code of OpenBLAS.</p>
  876. <h4 id="precompiled-packages_2">Precompiled packages</h4>
  877. <p><a href="https://www.macports.org/ports.php?by=name&amp;substr=openblas">https://www.macports.org/ports.php?by=name&amp;substr=openblas</a></p>
  878. <p><code>brew install openblas</code></p>
  879. <p>or using the conda package manager from
  880. <a href="https://github.com/conda-forge/miniforge#download">https://github.com/conda-forge/miniforge#download</a>
  881. (which also has packages for the new M1 cpu)</p>
  882. <p><code>conda install openblas</code></p>
  883. <h4 id="build-on-apple-m1">Build on Apple M1</h4>
  884. <p>On newer versions of Xcode and on arm64, you might need to compile with a newer macOS target (11.0) than the default (10.8) with <code>MACOSX_DEPLOYMENT_TARGET=11.0</code>, or switch your command-line tools to use an older SDK (e.g., <a href="https://developer.apple.com/download/all/?q=Xcode%2013">13.1</a>).</p>
  885. <ul>
  886. <li>without Fortran compiler (cannot build LAPACK)
  887. <div class="highlight"><pre><span></span><code>$<span class="w"> </span>make<span class="w"> </span><span class="nv">CC</span><span class="o">=</span>cc<span class="w"> </span><span class="nv">NOFORTRAN</span><span class="o">=</span><span class="m">1</span>
  888. </code></pre></div></li>
  889. <li>with Fortran compiler (you could <code>brew install gfortran</code>) https://github.com/xianyi/OpenBLAS/issues/3032
  890. <div class="highlight"><pre><span></span><code>$<span class="w"> </span><span class="nb">export</span><span class="w"> </span><span class="nv">MACOSX_DEPLOYMENT_TARGET</span><span class="o">=</span><span class="m">11</span>.0
  891. $<span class="w"> </span>make<span class="w"> </span><span class="nv">CC</span><span class="o">=</span>cc<span class="w"> </span><span class="nv">FC</span><span class="o">=</span>gfortran
  892. </code></pre></div></li>
  893. </ul>
  894. <h3 id="android">Android</h3>
  895. <h4 id="prerequisites_1">Prerequisites</h4>
  896. <p>In addition to the Android NDK, you will need both Perl and a C compiler on the build host as these are currently
  897. required by the OpenBLAS build environment.</p>
  898. <h4 id="building-with-android-ndk-using-clang-compiler">Building with android NDK using clang compiler</h4>
  899. <p>Around version 11 Android NDKs stopped supporting gcc, so you would need to use clang to compile OpenBLAS. clang is supported from OpenBLAS 0.2.20 version onwards. See below sections on how to build with clang for ARMV7 and ARMV8 targets. The same basic principles as described below for ARMV8 should also apply to building an x86 or x86_64 version (substitute something like NEHALEM for the target instead of ARMV8 and replace all the aarch64 in the toolchain paths obviously)
  900. "Historic" notes:
  901. Since version 19 the default toolchain is provided as a standalone toolchain, so building one yourself following <a href="http://developer.android.com/ndk/guides/standalone_toolchain.html">building a standalone toolchain</a> should no longer be necessary.
  902. If you want to use static linking with an old NDK version older than about r17, you need to choose an API level below 23 currently due to NDK bug 272 (https://github.com/android-ndk/ndk/issues/272 , the libc.a lacks a definition of stderr) that will probably be fixed in r17 of the NDK.</p>
  903. <h4 id="build-armv7-with-clang">Build ARMV7 with clang</h4>
  904. <p><div class="highlight"><pre><span></span><code>## Set path to ndk-bundle
  905. export NDK_BUNDLE_DIR=/path/to/ndk-bundle
  906. ## Set the PATH to contain paths to clang and arm-linux-androideabi-* utilities
  907. export PATH=${NDK_BUNDLE_DIR}/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:${NDK_BUNDLE_DIR}/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
  908. ## Set LDFLAGS so that the linker finds the appropriate libgcc
  909. export LDFLAGS=&quot;-L${NDK_BUNDLE_DIR}/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x&quot;
  910. ## Set the clang cross compile flags
  911. export CLANG_FLAGS=&quot;-target arm-linux-androideabi -marm -mfpu=vfp -mfloat-abi=softfp --sysroot ${NDK_BUNDLE_DIR}/platforms/android-23/arch-arm -gcc-toolchain ${NDK_BUNDLE_DIR}/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/&quot;
  912. #OpenBLAS Compile
  913. make TARGET=ARMV7 ONLY_CBLAS=1 AR=ar CC=&quot;clang ${CLANG_FLAGS}&quot; HOSTCC=gcc ARM_SOFTFP_ABI=1 -j4
  914. </code></pre></div>
  915. On a Mac, it may also be necessary to give the complete path to the <code>ar</code> utility in the make command above, like so:
  916. <div class="highlight"><pre><span></span><code>AR=${NDK_BUNDLE_DIR}/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc-ar
  917. </code></pre></div>
  918. otherwise you may get a linker error complaining about a "malformed archive header name at 8" when the native OSX ar command was invoked instead.</p>
  919. <h4 id="build-armv8-with-clang">Build ARMV8 with clang</h4>
  920. <p><div class="highlight"><pre><span></span><code>## Set path to ndk-bundle
  921. export NDK_BUNDLE_DIR=/path/to/ndk-bundle/
  922. ## Export PATH to contain directories of clang and aarch64-linux-android-* utilities
  923. export PATH=${NDK_BUNDLE_DIR}/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/:${NDK_BUNDLE_DIR}/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
  924. ## Setup LDFLAGS so that loader can find libgcc and pass -lm for sqrt
  925. export LDFLAGS=&quot;-L${NDK_BUNDLE_DIR}/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x -lm&quot;
  926. ## Setup the clang cross compile options
  927. export CLANG_FLAGS=&quot;-target aarch64-linux-android --sysroot ${NDK_BUNDLE_DIR}/platforms/android-23/arch-arm64 -gcc-toolchain ${NDK_BUNDLE_DIR}/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/&quot;
  928. ## Compile
  929. make TARGET=ARMV8 ONLY_CBLAS=1 AR=ar CC=&quot;clang ${CLANG_FLAGS}&quot; HOSTCC=gcc -j4
  930. </code></pre></div>
  931. Note: Using TARGET=CORTEXA57 in place of ARMV8 will pick up better optimized routines. Implementations for CORTEXA57 target is compatible with all other armv8 targets.</p>
  932. <p>Note: For NDK 23b, something as simple as
  933. <div class="highlight"><pre><span></span><code>export PATH=/opt/android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/bin/:$PATH
  934. make HOSTCC=gcc CC=/opt/android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android31-clang ONLY_CBLAS=1 TARGET=ARMV8
  935. </code></pre></div>
  936. appears to be sufficient on Linux.</p>
  937. <h4 id="alternative-script-which-was-tested-on-osx-with-ndk2136528147">Alternative script which was tested on OSX with NDK(21.3.6528147)</h4>
  938. <p>This script will build openblas for 3 architecture (ARMV7,ARMV8,X86) and put them with <code>sudo make install</code> to <code>/opt/OpenBLAS/lib</code>
  939. <div class="highlight"><pre><span></span><code>export NDK=YOUR_PATH_TO_SDK/Android/sdk/ndk/21.3.6528147
  940. export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/darwin-x86_64
  941. make clean
  942. make \
  943. TARGET=ARMV7 \
  944. ONLY_CBLAS=1 \
  945. CC=&quot;$TOOLCHAIN&quot;/bin/armv7a-linux-androideabi21-clang \
  946. AR=&quot;$TOOLCHAIN&quot;/bin/arm-linux-androideabi-ar \
  947. HOSTCC=gcc \
  948. ARM_SOFTFP_ABI=1 \
  949. -j4
  950. sudo make install
  951. make clean
  952. make \
  953. TARGET=CORTEXA57 \
  954. ONLY_CBLAS=1 \
  955. CC=$TOOLCHAIN/bin/aarch64-linux-android21-clang \
  956. AR=$TOOLCHAIN/bin/aarch64-linux-android-ar \
  957. HOSTCC=gcc \
  958. -j4
  959. sudo make install
  960. make clean
  961. make \
  962. TARGET=ATOM \
  963. ONLY_CBLAS=1 \
  964. CC=&quot;$TOOLCHAIN&quot;/bin/i686-linux-android21-clang \
  965. AR=&quot;$TOOLCHAIN&quot;/bin/i686-linux-android-ar \
  966. HOSTCC=gcc \
  967. ARM_SOFTFP_ABI=1 \
  968. -j4
  969. sudo make install
  970. ## This will build for x86_64
  971. make clean
  972. make \
  973. TARGET=ATOM BINARY=64\
  974. ONLY_CBLAS=1 \
  975. CC=&quot;$TOOLCHAIN&quot;/bin/x86_64-linux-android21-clang \
  976. AR=&quot;$TOOLCHAIN&quot;/bin/x86_64-linux-android-ar \
  977. HOSTCC=gcc \
  978. ARM_SOFTFP_ABI=1 \
  979. -j4
  980. sudo make install
  981. </code></pre></div>
  982. Also you can find full list of target architectures in <a href="https://github.com/xianyi/OpenBLAS/blob/develop/TargetList.txt">TargetsList.txt</a></p>
  983. <hr />
  984. <p>anything below this line should be irrelevant nowadays unless you need to perform software archeology</p>
  985. <hr />
  986. <h4 id="building-openblas-with-very-old-gcc-based-versions-of-the-ndk-without-fortran">Building OpenBLAS with very old gcc-based versions of the NDK, without Fortran</h4>
  987. <p>The prebuilt Android NDK toolchains do not include Fortran, hence parts like LAPACK cannot be built. You can still build OpenBLAS without it. For instructions on how to build OpenBLAS with Fortran, see the <a href="#building-openblas-with-fortran">next section</a>.</p>
  988. <p>To use easily the prebuilt toolchains, follow <a href="http://developer.android.com/ndk/guides/standalone_toolchain.html">building a standalone toolchain</a> for your desired architecture.
  989. This would be <code>arm-linux-androideabi-gcc-4.9</code> for ARMV7 and <code>aarch64-linux-android-gcc-4.9</code> for ARMV8.</p>
  990. <p>You can build OpenBLAS (0.2.19 and earlier) with:
  991. <div class="highlight"><pre><span></span><code>## Add the toolchain to your path
  992. export PATH=/path/to/standalone-toolchain/bin:$PATH
  993. ## Build without Fortran for ARMV7
  994. make TARGET=ARMV7 HOSTCC=gcc CC=arm-linux-androideabi-gcc NOFORTRAN=1 libs
  995. ## Build without Fortran for ARMV8
  996. make TARGET=ARMV8 BINARY=64 HOSTCC=gcc CC=aarch64-linux-android-gcc NOFORTRAN=1 libs
  997. </code></pre></div></p>
  998. <p>Since we are cross-compiling, we make the <code>libs</code> recipe, not <code>all</code>. Otherwise you will get errors when trying to link/run tests as versions up to and including 0.2.19 cannot build a shared library for Android. </p>
  999. <p>From 0.2.20 on, you should leave off the "libs" to get a full build, and you may want to use the softfp ABI instead of the deprecated hardfp one on ARMV7 so you would use
  1000. <div class="highlight"><pre><span></span><code>## Add the toolchain to your path
  1001. export PATH=/path/to/standalone-toolchain/bin:$PATH
  1002. ## Build without Fortran for ARMV7
  1003. make TARGET=ARMV7 ARM_SOFTFP_ABI=1 HOSTCC=gcc CC=arm-linux-androideabi-gcc NOFORTRAN=1
  1004. ## Build without Fortran for ARMV8
  1005. make TARGET=ARMV8 BINARY=64 HOSTCC=gcc CC=aarch64-linux-android-gcc NOFORTRAN=1
  1006. </code></pre></div></p>
  1007. <p>If you get an error about stdio.h not being found, you need to specify your sysroot in the CFLAGS argument to <code>make</code> like
  1008. <code>CFLAGS=--sysroot=$NDK/platforms/android-16/arch-arm</code>
  1009. When you are done, install OpenBLAS into the desired directory. Be sure to also use all command line options
  1010. here that you specified for building, otherwise errors may occur as it tries to install things you did not build:
  1011. <div class="highlight"><pre><span></span><code>make PREFIX=/path/to/install-dir TARGET=... install
  1012. </code></pre></div></p>
  1013. <h4 id="building-openblas-with-fortran">Building OpenBLAS with Fortran</h4>
  1014. <p>Instructions on how to build the GNU toolchains with Fortran can be found <a href="https://github.com/buffer51/android-gfortran">here</a>. The <a href="https://github.com/buffer51/android-gfortran/releases">Releases section</a> provides prebuilt versions, use the standalone one.</p>
  1015. <p>You can build OpenBLAS with:
  1016. <div class="highlight"><pre><span></span><code>## Add the toolchain to your path
  1017. export PATH=/path/to/standalone-toolchain-with-fortran/bin:$PATH
  1018. ## Build with Fortran for ARMV7
  1019. make TARGET=ARMV7 HOSTCC=gcc CC=arm-linux-androideabi-gcc FC=arm-linux-androideabi-gfortran libs
  1020. ## Build with LAPACK for ARMV8
  1021. make TARGET=ARMV8 BINARY=64 HOSTCC=gcc CC=aarch64-linux-android-gcc FC=aarch64-linux-android-gfortran libs
  1022. </code></pre></div></p>
  1023. <p>As mentioned above you can leave off the <code>libs</code> argument here when building 0.2.20 and later, and you may want to add ARM_SOFTFP_ABI=1 when building for ARMV7.</p>
  1024. <h4 id="linking-openblas-0219-and-earlier-for-armv7">Linking OpenBLAS (0.2.19 and earlier) for ARMV7</h4>
  1025. <p>If you are using <code>ndk-build</code>, you need to set the ABI to hard floating points in your Application.mk:
  1026. <div class="highlight"><pre><span></span><code>APP_ABI := armeabi-v7a-hard
  1027. </code></pre></div></p>
  1028. <p>This will set the appropriate flags for you. If you are not using <code>ndk-build</code>, you will want to add the following flags:
  1029. <div class="highlight"><pre><span></span><code>TARGET_CFLAGS += -mhard-float -D_NDK_MATH_NO_SOFTFP=1
  1030. TARGET_LDFLAGS += -Wl,--no-warn-mismatch -lm_hard
  1031. </code></pre></div></p>
  1032. <p>From 0.2.20 on, it is also possible to build for the softfp ABI by specifying ARM_SOFTFP_ABI=1 during the build.
  1033. In that case, also make sure that all your dependencies are compiled with -mfloat-abi=softfp as well, as mixing
  1034. "hard" and "soft" floating point ABIs in a program will make it crash.</p>
  1035. <h3 id="iphoneios">iPhone/iOS</h3>
  1036. <p>As none of the current developers uses iOS, the following instructions are what was found to work in our Azure CI setup, but as far as we know this builds a fully working OpenBLAS for this platform.</p>
  1037. <p>Go to the directory where you unpacked OpenBLAS,and enter the following commands:
  1038. <div class="highlight"><pre><span></span><code> CC=/Applications/Xcode_12.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
  1039. CFLAGS= -O2 -Wno-macro-redefined -isysroot /Applications/Xcode_12.4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.4.sdk -arch arm64 -miphoneos-version-min=10.0
  1040. make TARGET=ARMV8 DYNAMIC_ARCH=1 NUM_THREADS=32 HOSTCC=clang NOFORTRAN=1
  1041. </code></pre></div>
  1042. Adjust MIN_IOS_VERSION as necessary for your installation, e.g. change the version number
  1043. to the minimum iOS version you want to target and execute this file to build the library.</p>
  1044. <h3 id="mips">MIPS</h3>
  1045. <p>For mips targets you will need latest toolchains
  1046. P5600 - MTI GNU/Linux Toolchain
  1047. I6400, P6600 - IMG GNU/Linux Toolchain</p>
  1048. <p>The download link is below
  1049. (http://codescape-mips-sdk.imgtec.com/components/toolchain/2016.05-03/downloads.html)</p>
  1050. <p>You can use following commandlines for builds</p>
  1051. <pre><code>IMG_TOOLCHAIN_DIR={full IMG GNU/Linux Toolchain path including "bin" directory -- for example, /opt/linux_toolchain/bin}
  1052. IMG_GCC_PREFIX=mips-img-linux-gnu
  1053. IMG_TOOLCHAIN=${IMG_TOOLCHAIN_DIR}/${IMG_GCC_PREFIX}
  1054. I6400 Build (n32):
  1055. make BINARY=32 BINARY32=1 CC=$IMG_TOOLCHAIN-gcc AR=$IMG_TOOLCHAIN-ar FC="$IMG_TOOLCHAIN-gfortran -EL -mabi=n32" RANLIB=$IMG_TOOLCHAIN-ranlib HOSTCC=gcc CFLAGS="-EL" FFLAGS=$CFLAGS LDFLAGS=$CFLAGS TARGET=I6400
  1056. I6400 Build (n64):
  1057. make BINARY=64 BINARY64=1 CC=$IMG_TOOLCHAIN-gcc AR=$IMG_TOOLCHAIN-ar FC="$IMG_TOOLCHAIN-gfortran -EL" RANLIB=$IMG_TOOLCHAIN-ranlib HOSTCC=gcc CFLAGS="-EL" FFLAGS=$CFLAGS LDFLAGS=$CFLAGS TARGET=I6400
  1058. P6600 Build (n32):
  1059. make BINARY=32 BINARY32=1 CC=$IMG_TOOLCHAIN-gcc AR=$IMG_TOOLCHAIN-ar FC="$IMG_TOOLCHAIN-gfortran -EL -mabi=n32" RANLIB=$IMG_TOOLCHAIN-ranlib HOSTCC=gcc CFLAGS="-EL" FFLAGS=$CFLAGS LDFLAGS=$CFLAGS TARGET=P6600
  1060. P6600 Build (n64):
  1061. make BINARY=64 BINARY64=1 CC=$IMG_TOOLCHAIN-gcc AR=$IMG_TOOLCHAIN-ar FC="$IMG_TOOLCHAIN-gfortran -EL" RANLIB=$IMG_TOOLCHAIN-ranlib HOSTCC=gcc CFLAGS="-EL" FFLAGS="$CFLAGS" LDFLAGS="$CFLAGS" TARGET=P6600
  1062. MTI_TOOLCHAIN_DIR={full MTI GNU/Linux Toolchain path including "bin" directory -- for example, /opt/linux_toolchain/bin}
  1063. MTI_GCC_PREFIX=mips-mti-linux-gnu
  1064. MTI_TOOLCHAIN=${IMG_TOOLCHAIN_DIR}/${IMG_GCC_PREFIX}
  1065. P5600 Build:
  1066. make BINARY=32 BINARY32=1 CC=$MTI_TOOLCHAIN-gcc AR=$MTI_TOOLCHAIN-ar FC="$MTI_TOOLCHAIN-gfortran -EL" RANLIB=$MTI_TOOLCHAIN-ranlib HOSTCC=gcc CFLAGS="-EL" FFLAGS=$CFLAGS LDFLAGS=$CFLAGS TARGET=P5600
  1067. </code></pre>
  1068. <h3 id="freebsd">FreeBSD</h3>
  1069. <p>You will need to install the following tools from the FreeBSD ports tree:
  1070. * lang/gcc [1]
  1071. * lang/perl5.12
  1072. * ftp/curl
  1073. * devel/gmake
  1074. * devel/patch</p>
  1075. <p>To compile run the command:</p>
  1076. <pre><code>$ gmake CC=gcc46 FC=gfortran46
  1077. </code></pre>
  1078. <p>Note that you need to build with GNU make and manually specify the compiler, otherwhise gcc 4.2 from the base system would be used.</p>
  1079. <p>[1]: <a href="http://www.bsdunix.ch/serendipity/index.php?/archives/345-Removal-of-Fortran-from-the-FreeBSD-base-system.html">Removal of Fortran from the FreeBSD base system</a></p>
  1080. <div class="highlight"><pre><span></span><code>pkg install openblas
  1081. </code></pre></div>
  1082. <p>see <a href="https://www.freebsd.org/ports/index.html">https://www.freebsd.org/ports/index.html</a></p>
  1083. <h3 id="cortex-m">Cortex-M</h3>
  1084. <p>Cortex-M is a widely used microcontroller that is present in a variety of industrial and consumer electronics.
  1085. A common variant of the Cortex-M is the STM32F4xx series. Here, we will give instructions for building for
  1086. the STM32F4xx.</p>
  1087. <p>First, install the embedded arm gcc compiler from the arm website. Then, create the following toolchain file and build as follows.</p>
  1088. <div class="highlight"><pre><span></span><code><span class="c"># cmake .. -G Ninja -DCMAKE_C_COMPILER=arm-none-eabi-gcc -DCMAKE_TOOLCHAIN_FILE:PATH=&quot;toolchain.cmake&quot; -DNOFORTRAN=1 -DTARGET=ARMV5 -DEMBEDDED=1</span>
  1089. <span class="nb">set</span><span class="p">(</span><span class="s">CMAKE_SYSTEM_NAME</span><span class="w"> </span><span class="s">Generic</span><span class="p">)</span>
  1090. <span class="nb">set</span><span class="p">(</span><span class="s">CMAKE_SYSTEM_PROCESSOR</span><span class="w"> </span><span class="s">arm</span><span class="p">)</span>
  1091. <span class="nb">set</span><span class="p">(</span><span class="s">CMAKE_C_COMPILER</span><span class="w"> </span><span class="s2">&quot;arm-none-eabi-gcc.exe&quot;</span><span class="p">)</span>
  1092. <span class="nb">set</span><span class="p">(</span><span class="s">CMAKE_CXX_COMPILER</span><span class="w"> </span><span class="s2">&quot;arm-none-eabi-g++.exe&quot;</span><span class="p">)</span>
  1093. <span class="nb">set</span><span class="p">(</span><span class="s">CMAKE_EXE_LINKER_FLAGS</span><span class="w"> </span><span class="s2">&quot;--specs=nosys.specs&quot;</span><span class="w"> </span><span class="s">CACHE</span><span class="w"> </span><span class="s">INTERNAL</span><span class="w"> </span><span class="s2">&quot;&quot;</span><span class="p">)</span>
  1094. <span class="nb">set</span><span class="p">(</span><span class="s">CMAKE_FIND_ROOT_PATH_MODE_PROGRAM</span><span class="w"> </span><span class="s">NEVER</span><span class="p">)</span>
  1095. <span class="nb">set</span><span class="p">(</span><span class="s">CMAKE_FIND_ROOT_PATH_MODE_LIBRARY</span><span class="w"> </span><span class="s">ONLY</span><span class="p">)</span>
  1096. <span class="nb">set</span><span class="p">(</span><span class="s">CMAKE_FIND_ROOT_PATH_MODE_INCLUDE</span><span class="w"> </span><span class="s">ONLY</span><span class="p">)</span>
  1097. <span class="nb">set</span><span class="p">(</span><span class="s">CMAKE_FIND_ROOT_PATH_MODE_PACKAGE</span><span class="w"> </span><span class="s">ONLY</span><span class="p">)</span>
  1098. </code></pre></div>
  1099. <p>In your embedded application, the following functions need to be provided for OpenBLAS to work correctly:</p>
  1100. <div class="highlight"><pre><span></span><code><span class="kt">void</span><span class="w"> </span><span class="nf">free</span><span class="p">(</span><span class="kt">void</span><span class="o">*</span><span class="w"> </span><span class="n">ptr</span><span class="p">);</span>
  1101. <span class="kt">void</span><span class="o">*</span><span class="w"> </span><span class="nf">malloc</span><span class="p">(</span><span class="kt">size_t</span><span class="w"> </span><span class="n">size</span><span class="p">);</span>
  1102. </code></pre></div>
  1103. <div class="admonition note">
  1104. <p class="admonition-title">Note</p>
  1105. <p>If you are developing for an embedded platform, it is your responsibility to make sure that the device has sufficient memory for malloc calls. <a href="https://github.com/embeddedartistry/libmemory">Libmemory</a> provides one implementation of malloc for embedded platforms.</p>
  1106. </div>
  1107. </article>
  1108. </div>
  1109. <script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script>
  1110. </div>
  1111. </main>
  1112. <footer class="md-footer">
  1113. <div class="md-footer-meta md-typeset">
  1114. <div class="md-footer-meta__inner md-grid">
  1115. <div class="md-copyright">
  1116. Made with
  1117. <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
  1118. Material for MkDocs
  1119. </a>
  1120. </div>
  1121. </div>
  1122. </div>
  1123. </footer>
  1124. </div>
  1125. <div class="md-dialog" data-md-component="dialog">
  1126. <div class="md-dialog__inner md-typeset"></div>
  1127. </div>
  1128. <script id="__config" type="application/json">{"base": "..", "features": [], "search": "../assets/javascripts/workers/search.b8dbb3d2.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}}</script>
  1129. <script src="../assets/javascripts/bundle.ad660dcc.min.js"></script>
  1130. </body>
  1131. </html>

OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.