# I broke the base clang (3.4.1) with upgrading



## InvaderZim (May 24, 2015)

I had an motd which displayed the current version of FreeBSD running on the server. After running 
`freebsd-update fetch
freebsd-update install
freebsd-update upgrade -r 10.1-RELEASE`
and rebooting I saw 9.2 being displayed as the version number. I was angry at myself for having rebooted the server for nothing because obviously I forgot to do 'upgrade'. 

So, just to be sure everything was done I did
`freebsd-update fetch
freebsd-update install
freebsd-update upgrade -r 10.1-RELEASE`
again, only to be surprised by getting the message that FreeBSD could not be upgraded to itself. 

I checked with `uname -a` and, you guessed it, it was already 10.1.  So apart from time lost all was well. 

Or was it?

When compiling a new version of mysql we got the following messages:


```
Extracting mysql-5.5.43.tar.gz ...
-- Running cmake version 3.1.3
-- Could NOT find Git (missing:  GIT_EXECUTABLE)
-- The C compiler identification is Clang 3.4.1
-- The CXX compiler identification is Clang 3.4.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/CC
-- Check for working CXX compiler: /usr/bin/CC -- broken
CMake Error at /usr/local/share/cmake/Modules/CMakeTestCXXCompiler.cmake:54 (message):
  The C++ compiler "/usr/bin/CC" is not able to compile a simple test
  program.
```

  It fails with the following output:


```
Change Dir: /workdir//mysql-5.5.43/CMakeFiles/CMakeTmp



  Run Build Command:"/usr/local/bin/gmake" "cmTryCompileExec3773362340/fast"

  /usr/local/bin/gmake -f
  CMakeFiles/cmTryCompileExec3773362340.dir/build.make
  CMakeFiles/cmTryCompileExec3773362340.dir/build

  gmake[1]: Entering directory
  '/workdir//mysql-5.5.43/CMakeFiles/CMakeTmp'

  /usr/local/bin/cmake -E cmake_progress_report
  /workdir//mysql-5.5.43/CMakeFiles/CMakeTmp/CMakeFiles
  1

  Building CXX object
  CMakeFiles/cmTryCompileExec3773362340.dir/testCXXCompiler.cxx.o

  /usr/bin/CC -o
  CMakeFiles/cmTryCompileExec3773362340.dir/testCXXCompiler.cxx.o -c
  /workdir//mysql-5.5.43/CMakeFiles/CMakeTmp/testCXXCompiler.cxx


  Linking CXX executable cmTryCompileExec3773362340

  /usr/local/bin/cmake -E cmake_link_script
  CMakeFiles/cmTryCompileExec3773362340.dir/link.txt --verbose=1

  /usr/bin/CC CMakeFiles/cmTryCompileExec3773362340.dir/testCXXCompiler.cxx.o
  -o cmTryCompileExec3773362340

  /usr/bin/ld: cannot find -lc++

  CC: error: linker command failed with exit code 1 (use -v to see
  invocation)

  CMakeFiles/cmTryCompileExec3773362340.dir/build.make:88: recipe for target
  'cmTryCompileExec3773362340' failed

  gmake[1]: *** [cmTryCompileExec3773362340] Error 1

  gmake[1]: Leaving directory
  '/workdir//mysql-5.5.43/CMakeFiles/CMakeTmp'

  Makefile:118: recipe for target 'cmTryCompileExec3773362340/fast' failed

  gmake: *** [cmTryCompileExec3773362340/fast] Error 2





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:111 (PROJECT)


-- Configuring incomplete, errors occurred!
```

`CC --version` states:


```
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
Target: x86_64-unknown-freebsd10.1
Thread model: posix
```

which is as it should be. The two other servers we upgraded work just fine and also have this version of clang. Installing lang/clang34 and editing /etc/make.conf /etc/src.conf to point to clang doesn't help at all. 

I have no idea how to fix this. Is it possible to force FreeBSD to reinstall the base clang version? Is there some other way to fix this?


----------



## tobik@ (May 24, 2015)

You did the upgrade wrong. The correct order for upgrading is:

```
freebsd-update -r 10.1-RELEASE upgrade
freebsd-update install
shutdown -r now  # boot the new kernel
freebsd-update install
# Reinstall third party applications, see handbook
freebsd-update install
```
Relevant documentation:
Handbook section about upgrading and FreeBSD 10.1 Installation Instructions

Can you try this again? Let's hope that this still works.


----------



## SirDice (May 26, 2015)

InvaderZim said:


> `freebsd-update upgrade -r 10.1-RELEASE`


This command only _downloads_ the upgrade, it doesn't _install_ it.


----------



## InvaderZim (May 26, 2015)

We're upgrading servers that spent way too much time on 8.2 because the system we run on it did not support anything higher. We do

`freebsd-update fetch
freebsd-update install
freebsd-update upgrade -r 8.4-RELEASE
freebsd-update install
and then reboot followed by
freebsd-update install`

It has worked 15 times so far.

Then we update everything and start over, but then with 10.1-RELEASE


----------

