# How to update C compilers



## fredvs (Mar 3, 2016)

Hello.

I have a distro done from the excellent mfsBSD of Martin Matuska.

It is working like charm.

But this distro does not integrate the (lot of identical with different names)) C compilers of the official version of FreeBSD.

Sadly, it does not exist `pkg install clang` (or other compilers).

So I have copy clang (and cc, CC, c++, ...) into /usr/local/bin/.

OK, each compiler works.

Now the question: what must be updated for using `./configure` command of package.

I have done `freebsd-update`, but still error message from `./configure` (cc not found...).

Thanks.

Fre;D


----------



## tobik@ (Mar 3, 2016)

fredvs said:


> Sadly, it does not exist  pkg install clang (or other compilers).


lang/clang38 or 35,36,37
lang/gcc{46,47,48,49,5,5-devel,6-devel}



fredvs said:


> Now the question: what must be updated for using  ./configure command of package.


What package? faad? Usually `env CC=whatever-compiler-you-want-here ./configure` assuming it's an autotools generated configure script.


----------



## fredvs (Mar 3, 2016)

tobik said:


> lang/clang38 or 35,36,37
> lang/gcc{46,47,48,49,5,5-devel,6-devel}



Ooops, did not see this...
`pkg install clang[COLOR=#ff0000][B]38[/B][/COLOR]`
-> It works !

I was a little disappointed that gcc has his package and clang not...

OK, clang -> clang38 -> package solved (huh -> required more than 1 giga more space!!!).

Many thanks.



tobik said:


> What package? faad? Usually  env CC=whatever-compiler-you-want-here ./configure assuming it's an autotools generated configure script.



No, I mean, what must be configured in FreeBSD system, changing /etc/make.conf or something else.
Because many configure-files need cc or CC or cpp.
But, maybe, `pkg install clang38` will do that job (create symlink to clang38)...

Thanks.

Fre;D


----------



## fredvs (Mar 3, 2016)

Hello.

OK, installed clang with pkg install clang38 -> Installed ok.

Then
`enc CC=clang38 ./configure`

->

```
...
lot of ok
...
Checking how to run the C preprocessor.../lib/cpp
configure: error: C preprocessor ".../lib/cpp" fails sanity check.
```



cpp must be installed too ?

Fre;D


----------



## fredvs (Oct 2, 2016)

Hello.

OK, I found the guilty: /sys

That symlink linked to... something that does not exist (/usr/src/sys) !
The trick was to link /sys to /usr/include/sys.
Do you have a idea what package created the wrong broken-link /sys?

Thanks.


----------



## kpa (Oct 2, 2016)

fredvs said:


> Hello.
> 
> OK, I found the guilty: /sys
> 
> ...



Don't do that, you're supposed to install the system sources in /usr/src and then the /sys symlink will point to the correct target /usr/src/sys.


----------



## fredvs (Oct 3, 2016)

kpa thanks for your answer.

If I may, it is extremely difficult to make FreeBSD work, and this mainly because of strange way to manage your ports.
I use msfBSD.iso as base FreeBSD for polYdev disto.
In that base system, the sources are in /usr/include/sys and the directory /usr/src/sys is empty.

It was a hell to do gcc work, even using official FreeBSD package.
One of the reason was that broken link /sys.

Other example extremely disagreeable: last libiconv-1.14_9.txz package FreeBSD 64.
You keep the same name for the same library : libiconv.so.2.5.1 and for the same package :libiconv-1.14_9.txz
but, without to prevent anybody, you deleted the declared method `iconv_open` and change it for `libiconv_open`.

So, when update to new libiconv-1.14_9.txz (that has the same name than old one), all the applications that use libiconv.so.2.5.1 and `iconv_open` do not work anymore.
Sorry but that is not serious way to manage your packages, it is even worse than Linux does.

I permit myself to give that criticism because I think that, after spend lot of hours and loosing all my hair, I have te right to do it.

Also, never answers or help from FreeBSD forum is sad.

Fre;D


----------



## SirDice (Oct 3, 2016)

Please note that mfsBSD is not an officially supported derivative. Any issues with it should be reported to its creator.


----------



## fredvs (Oct 4, 2016)

SirDice said:


> Please note that mfsBSD is not an officially supported derivative. Any issues with it should be reported to its creator.



Hum, same broken link /sys with PC-BSD, GhostBSD and... official FreeBSD 10.3 disto !

Fre;D


----------



## kpa (Oct 4, 2016)

fredvs said:


> Hum, same broken link /sys with PC-BSD, GhostBSD and... official FreeBSD 10.3 disto !
> 
> Fre;D



It's not broken if you use the system as intended and install the system sources.


----------



## SirDice (Oct 4, 2016)

Indeed:

```
root@molly:~ # ls -ld /sys
lrwxr-xr-x  1 root  wheel  11 Oct  3 08:31 /sys -> usr/src/sys
root@molly:~ # ll /sys/
total 156
-rw-r--r--    1 root  wheel  2648 Jul 15 00:28 Makefile
drwxr-xr-x   13 root  wheel    14 Jul 15 00:28 amd64/
drwxr-xr-x   24 root  wheel    24 Mar 17  2016 arm/
drwxr-xr-x    8 root  wheel     8 Oct 26  2015 arm64/
drwxr-xr-x   23 root  wheel    34 Jul 15 00:28 boot/
drwxr-xr-x    2 root  wheel    10 Jul 15 00:28 bsm/
drwxr-xr-x    6 root  wheel    26 Oct  3 00:32 cam/
drwxr-xr-x    6 root  wheel     6 Jul 24  2013 cddl/
drwxr-xr-x   14 root  wheel    14 Oct 26  2015 compat/
drwxr-xr-x    2 root  wheel    59 Oct  3 00:32 conf/
drwxr-xr-x   16 root  wheel    16 Mar  6  2016 contrib/
drwxr-xr-x   12 root  wheel    14 Jul 15 00:29 crypto/
drwxr-xr-x    2 root  wheel    31 Sep  1 10:59 ddb/
drwxr-xr-x  303 root  wheel   303 Jun  9 15:16 dev/
drwxr-xr-x   23 root  wheel    23 Jul 17  2015 fs/
drwxr-xr-x    2 root  wheel     7 Jul 15 00:30 gdb/
drwxr-xr-x   24 root  wheel    56 Oct  3 00:32 geom/
drwxr-xr-x    4 root  wheel     4 May 24 08:21 gnu/
drwxr-xr-x   14 root  wheel    15 Jul 15 00:30 i386/
drwxr-xr-x    2 root  wheel    16 Jul 15 00:30 isa/
drwxr-xr-x    2 root  wheel   217 Oct  3 00:32 kern/
drwxr-xr-x    3 root  wheel    33 Jul 15 00:30 kgssapi/
drwxr-xr-x    3 root  wheel    76 Jul 15 00:30 libkern/
drwxr-xr-x   21 root  wheel    21 May 24 08:21 mips/
drwxr-xr-x  423 root  wheel   425 Aug  6 18:30 modules/
drwxr-xr-x    3 root  wheel   120 Oct  3 00:32 net/
drwxr-xr-x    2 root  wheel    73 Sep 18 19:25 net80211/
drwxr-xr-x    5 root  wheel   104 Jul 15 00:30 netgraph/
drwxr-xr-x    6 root  wheel   141 Oct  3 00:32 netinet/
drwxr-xr-x    2 root  wheel    58 Oct  3 00:32 netinet6/
drwxr-xr-x    2 root  wheel    27 Jul 15 00:30 netipsec/
drwxr-xr-x    2 root  wheel     6 Jul 15 00:30 netnatm/
drwxr-xr-x    4 root  wheel     4 Oct 23  2013 netpfil/
drwxr-xr-x    2 root  wheel    19 Jul 15 00:30 netsmb/
drwxr-xr-x    2 root  wheel    18 Sep  1 10:59 nfs/
drwxr-xr-x    2 root  wheel     9 Jul 15 00:30 nfsclient/
drwxr-xr-x    2 root  wheel     7 Jul 15 00:30 nfsserver/
drwxr-xr-x    2 root  wheel    12 Jul 15 00:30 nlm/
drwxr-xr-x    4 root  wheel     4 Jul 24  2013 ofed/
drwxr-xr-x    2 root  wheel    44 Sep  1 10:59 opencrypto/
drwxr-xr-x    9 root  wheel     9 Jul 24  2013 pc98/
drwxr-xr-x   18 root  wheel    18 Sep  8  2015 powerpc/
drwxr-xr-x    6 root  wheel     6 Jan 31  2016 riscv/
drwxr-xr-x    3 root  wheel    42 Aug  6 18:30 rpc/
drwxr-xr-x   15 root  wheel    15 Jul 24  2013 security/
drwxr-xr-x   12 root  wheel    12 Jul 24  2013 sparc64/
drwxr-xr-x    2 root  wheel   310 Oct  3 00:32 sys/
drwxr-xr-x    5 root  wheel    13 Jul 15 00:30 teken/
drwxr-xr-x    4 root  wheel     6 Jul 15 00:30 tests/
drwxr-xr-x    4 root  wheel    13 Jul 15 00:30 tools/
drwxr-xr-x    4 root  wheel     4 Jul 24  2013 ufs/
drwxr-xr-x    2 root  wheel    51 Oct  3 00:32 vm/
drwxr-xr-x   11 root  wheel    11 Dec 23  2013 x86/
drwxr-xr-x    2 root  wheel     8 Jul 15 00:30 xdr/
drwxr-xr-x    7 root  wheel    21 Jul 15 00:30 xen/
```


----------



## tobik@ (Oct 4, 2016)

Why is the /sys symlink needed in the first place? Where does it come from? When was it added and why? I know that OpenBSD has it too, so it's probably ancient from 4.4BSD or earlier.



fredvs said:


> The trick was to link /sys to /usr/include/sys.


This seems incidental to me. If you create an empty directory with `mkdir -p /usr/src/sys` and link /sys back to it will it work too? I'm asking because /usr/src/sys contains very different files (the kernel sources, see SirDice's last post) than /usr/include/sys (system headers).


----------



## SirDice (Oct 4, 2016)

I think it's more about legacy than functionality. I don't think anything from FreeBSD uses it directly.


----------



## fredvs (Oct 4, 2016)

SirDice said:


> I think it's more about legacy than functionality. I don't think anything from FreeBSD uses it directly.



Hum, depend of what you call functionality.

If you want to use gcc, trust me,  if some program need to use /sys, it will not compile (it is the case of many original sources from FreeBSD packages, like JWM for example)...


----------



## fredvs (Oct 4, 2016)

kpa said:


> It's not broken if you use the system as intended and install the system sources.



Sorry for that stupid question, but what do you mean with _use the system as intended ?
_
And how must the system sources be installed ? Is it possible to install only /usr/src/lib ?

Fre;D


----------



## SirDice (Oct 4, 2016)

fredvs said:


> If you want to use gcc, trust me, if some program need to use /sys


Sure, except nothing actually does.



fredvs said:


> (it is the case of many original sources from FreeBSD packages, like JWM for example)...


Doubtful, it would only require access to /usr/src/sys/ if it needs to build a kernel module.


----------



## fredvs (Oct 4, 2016)

Doubtful said:
			
		

> /usr/src/sys/[/file] if it needs to build a kernel module.



Ha, /usr/src/sys is only needed to build a kernel module (I did not knew this).

Pffff, this time I am completely on the ground, I do not understand anything anymore ;-(

Fre;D


----------

