https://github.com/fuuzetsu/broken-nix-openblas
https://github.com/fuuzetsu/broken-nix-openblas
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/fuuzetsu/broken-nix-openblas
- Owner: Fuuzetsu
- Created: 2021-02-23T01:34:08.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-02-23T01:35:00.000Z (about 5 years ago)
- Last Synced: 2026-01-20T20:49:57.273Z (about 1 month ago)
- Language: Fortran
- Size: 1000 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Simply run
```console
$ nix-shell
$ gfortran main.f90 -lblas && ./a.out
```
You should see a segfault:
```console
$ gfortran main.f90 -lblas && ./a.out
f951: Warning: command line option ‘-Wformat=1’ is valid for C/C++/ObjC/ObjC++ but not for Fortran
f951: Warning: command line option ‘-Wformat-security’ is valid for C/C++/ObjC/ObjC++ but not for Fortran
f951: Warning: ‘-Werror=’ argument ‘-Werror=format-security’ is not valid for Fortran
a = 5.0
X = [ 5.0 6.0 7.0 ]
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
Backtrace for this error:
#0 0x7f7ea902eb90 in ???
#1 0x7f7ea902ddc5 in ???
#2 0x7f7ea8cdf39f in ???
#3 0x7f7eaa0db328 in ???
Segmentation fault (core dumped)
```
However, you can check out OpenBLAS in a different directory and build it:
```console
$ cd /tmp
$ git clone git@github.com:xianyi/OpenBLAS.git
$ nix-shell '' -A openblas
$ make
```
Now you can run the program we built earlier with the self-built OpenBLAS and it
should mysteriously just work.
```console
$ LD_LIBRARY_PATH=/tmp/OpenBlas:$LD_LIBRARY_PATH ./a.out
a = 5.0
X = [ 5.0 6.0 7.0 ]
X = a * X
X = [ 25.0 30.0 35.0 ]
```