5

I install gcc 4.7 on openbsd using pkg_add. after installation, I use 'gcc -v' to check, I found it is also gcc 4.2 !

how to upgrade gcc 4.2 to gcc 4.7 on openbsd? thank you!

siyuan
  • 103

3 Answers3

7

I believe it gets installed as eg++ and egcc in /usr/local/bin/.

1

Updating the compiler on a BSD is a big thing. The assumption is you may need to use the compiler to recompile the system on an update. As such, I'm sure you don't update /usr/bin/gcc on a pkgadd. It could leave you with a system that can not be updated.

The compiler is most likely installed in a different directory. Even a simple rename wouldn't help, since gcc is not just gcc, but a whole slew of libraries, headers, and other utilities. You would need to find the directory where the new gcc binary is installed, then prefix that to your PATH.

I would use the pkg_info tool to query where the package was actually installed into. Then I would find the directory where the binaries are, and set PATH=/path/to/new/gcc/bin:$PATH in the appropriate shell startup files.

Rich Homolka
  • 32,350
0

I get confused at first, but know I could give you a little help since I don't have OpenBSD installed, I thought it was a program not an OS, anyway...

as I see and reading the manual...(Have you read it?)... the correct way to do this would be:

pkg_add -u gcc in order to upgrade... not make a new installation, you could uninstall gcc and try to make a clean installation running pkg_delete gcc, but before you do something, try searching if it's true you have the two versions of gcc running pkg_info it should show you all the packages installed...

Here is the link to the manual for packets and ports and all I can tell you is read the manual... regards..

poz2k4444
  • 914