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!
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:
Here is the link to the manual for packets and ports and all I can tell you is read the manual... regards..
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.