# Unable to install flang from ports FreeBSD-11.2



## runix (Dec 28, 2018)

I am not able to compile 'flang' via ports. The log is as follows,


```
root@electron:/usr/ports/devel/flang # make install clean

===>  License APACHE20 accepted by the user
===>   flang-6.0.g20180904_2 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by flang-6.0.g20180904_2 for building
===>  Extracting for flang-6.0.g20180904_2
=> SHA256 Checksum OK for flang-compiler-flang-6.0-g20180904-53e368b_GH0.tar.gz.
===>  Patching for flang-6.0.g20180904_2
===>  Applying FreeBSD patches for flang-6.0.g20180904_2
===>   flang-6.0.g20180904_2 depends on package: llvm60>=0 - found
===>   flang-6.0.g20180904_2 depends on package: flang-clang>=0 - found
===>   flang-6.0.g20180904_2 depends on file: /usr/local/bin/cmake - found
===>   flang-6.0.g20180904_2 depends on file: /usr/local/bin/python3.6 - found
===>   flang-6.0.g20180904_2 depends on package: perl5>=5.28.r1<5.29 - found
===>   flang-6.0.g20180904_2 depends on shared library: libpgmath.so - not found
===>  libpgmath-g20180904_1 not supported on older than 12.0, no cpuid bit
support.
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/math/libpgmath
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/devel/flang
*** Error code 1

Stop.
make: stopped in /usr/ports/devel/flang
```

It looks like an issue with *libpgmath* which simply fails under FreeBSD11.2 via ports. Could someone shed some light on this.

*EDIT:*

I tried compiling libpgmath. However, it fails saying the following:


```
root@electron:/usr/ports/math/libpgmath # make install clean
===>  libpgmath-g20180904_1 not supported on older than 12.0, no cpuid bit
support.
*** Error code 1

Stop.
make: stopped in /usr/ports/math/libpgmath
```

Looks like, the port version that I have, doesn't support FreeBSD 11.2. Is it true? If so, what is the alternative?

Any help would be much appreciated.


----------



## SirDice (Dec 28, 2018)

The support for anything below 11.2 was removed due to this: https://reviews.freebsd.org/D17724

But the math/libpgmath port was never able to build on 10 or 11. It has required 12.0 since it was added to the ports tree. Because one of it's dependencies requires 12.0 the lang/flang port should probably also be restricted to 12.0 or higher.


----------



## runix (Dec 28, 2018)

Thank you SirDice. I needed "flang" because I was getting the following error, when trying to `pip3 install -v scipy`


```
running build_clib
    customize UnixCCompiler
    C compiler: cc -Wno-unused-result -Wsign-compare -O2 -pipe -fstack-protector -fno-strict-aliasing -fPIC
    
    creating /tmp/tmp_r1rtzvl/tmp
    creating /tmp/tmp_r1rtzvl/tmp/tmp_r1rtzvl
    compile options: '-MMD -MF /tmp/tmp_r1rtzvl/file.c.d -c'
    cc: /tmp/tmp_r1rtzvl/file.c
    customize UnixCCompiler using build_clib
    building 'dfftpack' library
    error: library dfftpack has Fortran sources but no Fortran compiler found
    
    ----------------------------------------
Command "/home/russellb/py_devel/pyPlay/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-2dd4ht3h/scipy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-0l2xmcpc/install-record.txt --single-version-externally-managed --compile --install-headers /home/russellb/py_devel/pyPlay/include/site/python3.6/scipy" failed with error code 1 in /tmp/pip-install-2dd4ht3h/scipy/
```

I tried setting `set CC=gcc8` but to no avail. Do I need to start a new  thread?


----------



## SirDice (Dec 28, 2018)

runix said:


> I tried setting  set CC=gcc8 but to no avail.


It's not a compiler issue, it's the kernel that's missing certain functionality that prevents it from building on anything below 12.0.


----------



## runix (Dec 28, 2018)

SirDice said:


> It's not a compiler issue, it's the kernel that's missing certain functionality that prevents it from building on anything below 12.0.


You mean this for `pip3 install -v scipy`. I am wondering, how could that be when the error says, 
	
	



```
error: library dfftpack has Fortran sources but no Fortran compiler found
```

Or I am mistaken your advice. Thank you for your kindness.


----------



## SirDice (Dec 28, 2018)

Oh, right. No, I was only referring to devel/flang and math/libpgmath. 

Regarding SciPy, have you tried science/py-scipy?


----------



## runix (Dec 29, 2018)

Yes did try that. But Ithought it would be nice to have things under local virtual environment than global installation. That's why I was trying to install with `pip[CMD]. Ihave upgraded my  system to 12.0 and going to try with [CMD]flang` installed. Let me post back. Thank you.[/CMD][/CMD]


----------



## mfoacs (May 24, 2019)

runix said:


> Yes did try that. But Ithought it would be nice to have things under local virtual environment than global installation. That's why I was trying to install with `pip[CMD]. Ihave upgraded my  system to 12.0 and going to try with [CMD]flang` installed. Let me post back. Thank you.[/CMD][/CMD]



I had the same issue. I solved it by installing the default gcc meta port:
`pkg install gcc` or `cd /usr/ports/lang/gcc/ && make install clean`


----------



## Alain De Vos (Jun 30, 2019)

py-scipy  does not compile on 12.0 . Looks like some weird py-numpy,multiarray,cblas,F77 dependency ?


----------

