Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Help needed] How to properly link gfortran to build openblas? #3662

Closed
Ykid opened this issue Jun 22, 2022 · 13 comments
Closed

[Help needed] How to properly link gfortran to build openblas? #3662

Ykid opened this issue Jun 22, 2022 · 13 comments
Labels

Comments

@Ykid
Copy link

Ykid commented Jun 22, 2022

Hi guys, I am running into an issue when building a rust library which uses openblas underneath. I don't know how to get compilation work, so any help/advice will be appreciated!

Related issue is here

@martin-frbg
Copy link
Collaborator

I have no idea what commands you are running to build OpenBLAS in that rust/cargo/? environment, but you'll need -lgfortran among the libraries (where you probably have something like -lpthread -lm already). Normally the OpenBLAS build scripts (cmake or Makefiles) should do that for you automatically, perhaps cargo provides its own mechanism and there is an error in the build script that comes with their openblas package. Probably a question for whoever provided and maintains the package ?

@Ykid
Copy link
Author

Ykid commented Jun 22, 2022

The linked issue above is created for the maintainer of the package. In case you've got a few minutes/you are interested, here's the build command. Great thanks in advance!

error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-m64" "-arch" "x86_64" "/var/folders/08/1sjbkbp51zb53_rppsnfpxcc0000gp/T/rustch5cs1W/symbols.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.12g7nxgai8sd487.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.12kz0kyjk7itrldt.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.12stx1kaiocoymjo.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.15o7pwfji93fzocr.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.15yjeyp369k8dhxg.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.169cdkbikcra82ts.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.18272zur4siw7v8i.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.185wtdheg6jtynog.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.18sx08rfdmysikys.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.1eopim3co7aw6kbz.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.1h4mbaritkr0wv1k.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.1hfikhz7wo7z26iz.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.1j6p9vakpvqxfeas.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.1lajiocz6gwqxi2n.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.1o5hd2n1703wmlp9.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.1o9d0ivkdlwtelzl.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.1qz3cj3akftuzuk4.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.1r3tt4sb4ybgcosy.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.1um7xfi40pd3omtf.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.1ux5sg33jomhm5g0.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.1v08jus7ija9xky7.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.1v3ytd7yvvg9cd68.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.1vr49gkixols3npz.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.1ysen6y2w6dy3emg.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.1zfkdlfrnjlz7t6q.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.23iusi31ik006562.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.251hr9n12jq0vql7.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.29asfg790zhut5mw.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.2eqbao82mlegxn4v.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.2mgmd6nsaynarsnv.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.2ospobqaqdihygvw.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.2qqe82qkmtfm39po.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.2rcnjrhcnnmu4zxb.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.2ve8sgrw3owebe55.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.2vtj58sqj8v221y4.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.2x6ze3g607exdwnj.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.2xuxlu5x6i0hi4bf.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.2xx6714w2avmh36d.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.31axn4e5wlr52ixs.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.33z6zxrzybgrpyg7.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.368peojetpia9ggh.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.36ct6ellfzjunob8.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.3bmigm6uordx8ch1.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.3bsvtr0luu2a7hig.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.3e2v14fhxw8f5osy.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.3f5cyo4r73wwpe4e.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.3i799eflnqgfjk9r.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.3in3ql6v1pevopnp.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.3k15ov06qj9uh2ie.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.3k8ke8tfxu34y6fp.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.3mo8ofdfnvczxwxm.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.3q226c9qohw6rr91.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.3quhs1ixbdsrk4hb.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.3ueesthqksdbtozj.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.3uthbgaef8tk9dv8.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.3y25e69ub50bp7ri.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.3zmz5mdanpjspuzz.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.413hwetwsmchflft.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.4225e2cfcjounmku.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.42txrmkreja30yiq.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.45fdxzu0ba0f3bs4.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.480acyvxzn4vxzrj.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.486mis9y2d6exh2j.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.4a406spajmbvvuic.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.4d9px32phd7zf5iu.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.4g34kiht6uct6xtd.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.4ia3u0ahqer4a5oq.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.4iwmgx1gyhmcytll.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.4np6auh6kkxdl50c.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.4oee84y66ia6jnqv.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.4pat4svqw0tbypyy.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.4qijlej8xuoxatsb.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.4s2zmn1is26i382n.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.4uj222or5xcudn4j.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.4vgyba8ntrr5e3gb.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.4w0792ucvvit0gy4.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.4z6g41hfz0jvozwg.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.512leie1bx6xc3jj.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.51alccayci5xoq0n.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.52rfq07te5pjkf7z.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.537rtvbrhvuptl98.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.53v8yianqb1t632i.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.5577j1c7bes6n9ls.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.55xzryztb1g4ofck.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.57zk5fbj2t6md9y4.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.57zp28lkzi72leq1.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.582ofnx3n12lb7s4.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.58nj4s8wasvqfpzq.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.5e408tov6trw0xte.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.5ws63dayyoa3l0l.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.727zy1xg9istqeu.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.7exb0k0c44rkjx2.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.7ilxru373ry65wz.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.8ad8fffv3rt06p8.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.9vkn3qulddatypl.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.aop24fbzx2znse.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.aq2osdfl4kuzfh1.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.fq87cinvfq0c6j.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.iwo6x924jsafz0x.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.pg3ckunlmsbvk92.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.pt5oo70mzpmrxyp.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.rby10zmp4640tlq.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.trph18gsfcei4c0.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.vl4717hmx79wqym.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.ww37z9ef00ea2in.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.xxd6kfk5ksu8yj3.rcgu.o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d.143g68q7jvv82krd.rcgu.o" "-L" "/Users/user1/Desktop/code/example/target/debug/deps" "-L" "/Users/user1/Desktop/code/example/target/debug/build/openblas-src-24e5b6ea9b6680a3/out/opt/OpenBLAS/lib" "-L" "/Users/user1/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/user1/Desktop/code/example/target/debug/deps/libndarray_linalg-387192749548cace.rlib" "/Users/user1/Desktop/code/example/target/debug/deps/liblax-5f0efc3165c42cd4.rlib" "/Users/user1/Desktop/code/example/target/debug/deps/liblapack-e10154ec99b1d810.rlib" "/Users/user1/Desktop/code/example/target/debug/deps/liblapack_sys-614af5cc32c1dd50.rlib" "/Users/user1/Desktop/code/example/target/debug/deps/libcauchy-0e7f22703334f021.rlib" "/Users/user1/Desktop/code/example/target/debug/deps/libthiserror-6dfc2e40f9d4128c.rlib" "/Users/user1/Desktop/code/example/target/debug/deps/libopenblas_src-4151971bd483fad6.rlib" "/Users/user1/Desktop/code/example/target/debug/deps/libndarray-bee006d102fba9e8.rlib" "/Users/user1/Desktop/code/example/target/debug/deps/libmatrixmultiply-bde5eec8850d9250.rlib" "/Users/user1/Desktop/code/example/target/debug/deps/libapprox-a6d0a79d71034408.rlib" "/Users/user1/Desktop/code/example/target/debug/deps/libnum_complex-8be0fe33ed718ee8.rlib" "/Users/user1/Desktop/code/example/target/debug/deps/libserde-23077ece19507d60.rlib" "/Users/user1/Desktop/code/example/target/debug/deps/librand-c81fccd424a189b8.rlib" "/Users/user1/Desktop/code/example/target/debug/deps/librand_chacha-a851f77739ab9762.rlib" "/Users/user1/Desktop/code/example/target/debug/deps/libppv_lite86-3a6a2f22f18e6b9f.rlib" "/Users/user1/Desktop/code/example/target/debug/deps/librand_core-73f31cade16ac748.rlib" "/Users/user1/Desktop/code/example/target/debug/deps/libgetrandom-0c2a388d9b67ec91.rlib" "/Users/user1/Desktop/code/example/target/debug/deps/libcfg_if-89cb16fc176d2309.rlib" "/Users/user1/Desktop/code/example/target/debug/deps/libnum_integer-c3b88f9a640a8d62.rlib" "/Users/user1/Desktop/code/example/target/debug/deps/libnum_traits-81780d6695143c97.rlib" "/Users/user1/Desktop/code/example/target/debug/deps/librawpointer-71d5365f62f69659.rlib" "/Users/user1/Desktop/code/example/target/debug/deps/libcblas_sys-1eb97c4cba3aa18c.rlib" "/Users/user1/Desktop/code/example/target/debug/deps/liblibc-a260893d35b1eb39.rlib" "/Users/user1/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-3e211bf35d2fae95.rlib" "/Users/user1/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-a70c76b109552842.rlib" "/Users/user1/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libobject-92620712fd821ea7.rlib" "/Users/user1/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libmemchr-dcd5b68e42622fe5.rlib" "/Users/user1/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libaddr2line-ccd159a5d99fe24d.rlib" "/Users/user1/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libgimli-3368de1865855063.rlib" "/Users/user1/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-6c7314e635d02a14.rlib" "/Users/user1/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd_detect-19edb9fef9bffc47.rlib" "/Users/user1/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libhashbrown-24ded86409c0de1c.rlib" "/Users/user1/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libminiz_oxide-dbb71b942bbda574.rlib" "/Users/user1/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libadler-58e3840221c1a6a4.rlib" "/Users/user1/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_alloc-7ebed84e33ad834a.rlib" "/Users/user1/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-a0d412c3ee597b96.rlib" "/Users/user1/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcfg_if-09d95f956d337a84.rlib" "/Users/user1/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-4baca41b40f09a1f.rlib" "/Users/user1/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-77012243ddb833e8.rlib" "/Users/user1/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-7454d006639b0b9c.rlib" "/Users/user1/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-07b1a016408f5808.rlib" "/Users/user1/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-ff0e8884ef5b55d4.rlib" "-liconv" "-lSystem" "-lresolv" "-lc" "-lm" "-liconv" "-L" "/Users/user1/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "-o" "/Users/user1/Desktop/code/example/target/debug/deps/example-039627de79682f6d" "-Wl,-dead_strip" "-nodefaultlibs"
  = note: ld: warning: could not create compact unwind for _chseqr_: stack subq instruction is too different from dwarf stack size
          ld: warning: could not create compact unwind for _dhseqr_: stack subq instruction is too different from dwarf stack size
          ld: warning: could not create compact unwind for _shseqr_: stack subq instruction is too different from dwarf stack size
          ld: warning: could not create compact unwind for _zhseqr_: stack subq instruction is too different from dwarf stack size
          Undefined symbols for architecture x86_64:
            "__gfortran_concat_string", referenced from:
                _dormbr_ in libopenblas_src-4151971bd483fad6.rlib(dormbr.o)
                _dormlq_ in libopenblas_src-4151971bd483fad6.rlib(dormlq.o)
                _dormqr_ in libopenblas_src-4151971bd483fad6.rlib(dormqr.o)
          ld: symbol(s) not found for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)
          

warning: `example` (bin "example") generated 1 warning
error: could not compile `example` due to previous error; 1 warning emitted

@martin-frbg
Copy link
Collaborator

Hm, thats the build output that you showed earlier, not the command you used ? But if you can change the "cc" used for linking here to gfortran it would probably link in its library automatically. Otherwise you'll need to add -lgfortran where you apparently have -liconv -lSystem -lresolv -lc -lm already

@brada4
Copy link
Contributor

brada4 commented Jun 22, 2022

stack subq instruction is too different from dwarf stack size

Architecture mixup most likely. Do a fresh openblas checkout, or run make clean in existing one then re-run make DYNAMIC_ARCH=1

@martin-frbg
Copy link
Collaborator

@brada4 that's on a Mac, I believe this warning is quite common there (and harmless).

@brada4
Copy link
Contributor

brada4 commented Jun 22, 2022

Error after says something is worng with object format. Might be radically aged gfortran, or even gfortran for different arch.
ld: symbol(s) not found for architecture x86_64

@martin-frbg
Copy link
Collaborator

@brada4 no it does not, the symbol is specified a few lines above as gfortran_concat_string which Ykid has already identified correctly as needing to link to gfortran. As it is clang that is used here for linking, libgfortran is not included automatically.

@Ykid
Copy link
Author

Ykid commented Jun 23, 2022

@martin-frbg I'm sorry. This should be the command cargo issued to build the project. Let me try out your suggestions these days. Thanks for the pointer!

rustc --crate-name example --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C metadata=039627de79682f6d -C extra-filename=-039627de79682f6d --out-dir /Users/user1/Desktop/code/example/target/debug/deps -C incremental=/Users/user1/Desktop/code/example/target/debug/incremental -L dependency=/Users/user1/Desktop/code/example/target/debug/deps --extern ndarray=/Users/user1/Desktop/code/example/target/debug/deps/libndarray-bee006d102fba9e8.rlib --extern ndarray_linalg=/Users/user1/Desktop/code/example/target/debug/deps/libndarray_linalg-387192749548cace.rlib --extern ndarray_stats=/Users/user1/Desktop/code/example/target/debug/deps/libndarray_stats-e53f61ffeab434f4.rlib -L /Users/user1/Desktop/code/example/target/debug/build/openblas-src-24e5b6ea9b6680a3/out/opt/OpenBLAS/lib

@brada4
Copy link
Contributor

brada4 commented Jun 23, 2022

You can build OpenBLAS independently from ndarray and import resulting dylib. It says it uses only BLAS functions, so NO_FORTRAN=1 build serves it sufficiently.
Among alternatives is Apple Accelerate framework or Intel MKL. Those you can link only as external libs, no need to wildly complicate build for OpenBLAS.

@brada4
Copy link
Contributor

brada4 commented Jun 23, 2022

blas-src "crate" is actually documented here: https://docs.rs/blas-src/latest/blas_src/ ,sorry for reinventing the wheel.

@martin-frbg could it link with $FC on osx with gfortran?

@martin-frbg
Copy link
Collaborator

Why wouldn't OpenBLAS compile and link with gfortran on OSX, especially as this appears to be x86_64, not one of the new ARM macs ? I assume the crate provides for that if it has . (or at worst, installing gfortran from e.g. homebrew would be needed)
I must say that it is not entirely clear to me what's in the package - I'm assuming a prebuilt libopenblas that someone assumed to be readily installable on other Macs ? (Or if it is a recipe for building from source, clearly it must have seen gfortran for long enough to build the library)

@martin-frbg
Copy link
Collaborator

And if it is a prebuilt libopenblas, getting the user code to link against libgfortran as well is probably easier than building OpenBLAS or any other replacement BLAS from source

@brada4
Copy link
Contributor

brada4 commented Jun 23, 2022

I was a bit confused CC is being used there, I will try to dig to the source of grief.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants