Olej писал(а):
Подсказали, что этот баг отмечен для Fedora 22 :
Red Hat Bugzilla – Bug 1192716 (неправильная расстановка
приоритетов альтернатив: для go.gcc стоит приоритет
92, а для golang —
90).
Свеже (для страховки) устанавливаем для страховки gcc-go:
Код: Выделить всё
[olej@dell tasks]$ sudo dnf install gcc-go
...
Установлено:
gcc-go.x86_64 5.3.1-6.fc23 libgo.x86_64 5.3.1-6.fc23 libgo-devel.x86_64 5.3.1-6.fc23
Выполнено!
Проверяем:
Код: Выделить всё
[olej@dell tasks]$ alternatives --list
...
go auto /usr/bin/go.gcc
[olej@dell tasks]$ alternatives --display go
go - статус "авто".
ссылка сейчас указывает на /usr/bin/go.gcc
/usr/lib/golang/bin/go - priority 90
slave gofmt: /usr/lib/golang/bin/gofmt
/usr/bin/go.gcc - priority 92
slave gofmt: /usr/bin/gofmt.gcc
Текущая `лучшая' версия - /usr/bin/go.gcc.
Меняем версию Go по умолчанию:
Код: Выделить всё
[olej@dell tasks]$ alternatives --config go
Имеется 2 программ, которые предоставляют 'go'.
Выбор Команда
-----------------------------------------------
1 /usr/lib/golang/bin/go
*+ 2 /usr/bin/go.gcc
Enter - сохранить текущий выбор[+], или укажите номер: 1
не удается создать /var/lib/alternatives/go.new: Отказано в доступе
Только от
суперпользователя! :
Код: Выделить всё
[olej@dell tasks]$ sudo alternatives --config go
[sudo] пароль для olej:
Имеется 2 программ, которые предоставляют 'go'.
Выбор Команда
-----------------------------------------------
1 /usr/lib/golang/bin/go
*+ 2 /usr/bin/go.gcc
Enter - сохранить текущий выбор[+], или укажите номер: 1
[olej@dell tasks]$ alternatives --display go
go - статус "вручную"
ссылка сейчас указывает на /usr/lib/golang/bin/go
/usr/lib/golang/bin/go - priority 90
slave gofmt: /usr/lib/golang/bin/gofmt
/usr/bin/go.gcc - priority 92
slave gofmt: /usr/bin/gofmt.gcc
Текущая `лучшая' версия - /usr/bin/go.gcc.
3 разные сборки тестовой задачи 1). golang статическая, 2). golang динамическая, 3). GCC динамическая:
Код: Выделить всё
[olej@dell tasks]$ go build -compiler gc -o hellols hello.go
[olej@dell tasks]$ go build -compiler gc -linkshared -o hellold hello.go
[olej@dell tasks]$ go build -compiler gccgo -o hellog hello.go
# command-line-arguments
ar: `u' modifier ignored since `D' is the default (see `U')
[olej@dell tasks]$ ls -l hello*
-rwxr-xr-x. 1 olej olej 32400 июн 3 12:18 hellog
-rw-rw-r--. 1 olej olej 266 май 31 11:05 hello.go
-rwxr-xr-x. 1 olej olej 15816 июн 3 12:18 hellold
-rwxr-xr-x. 1 olej olej 2367424 июн 3 12:17 hellols
[olej@dell tasks]$ file hello*
hellog: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=24bd1519714ce69e26d279a1bbf35ddcf2de8021, not stripped
hello.go: C source, UTF-8 Unicode text
hellold: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=ecbaadbe3483b60da122274f34abadf78d68b236, not stripped
hellols: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped