Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build C compiler errors when building from source on RHEL v8.9 #108

Open
hhue13 opened this issue Jan 12, 2024 · 1 comment
Open

Build C compiler errors when building from source on RHEL v8.9 #108

hhue13 opened this issue Jan 12, 2024 · 1 comment

Comments

@hhue13
Copy link

hhue13 commented Jan 12, 2024

Due to issues running switcher 0.8.1 om REL8 (see issue 104 I tried to build it from source using the 0.8.1 source package. The OS I'm running is RedHat Enterprise Linux 8.9 on x86_64.

x@y: /dev/shm/kubeswitch-0.8.1$ uname -a
Linux x.a.b 4.18.0-513.9.1.el8_9.x86_64 #1 SMP Thu Nov 16 10:29:04 EST 2023 x86_64 x86_64 x86_64 GNU/Linux

x@y: /dev/shm/kubeswitch-0.8.1$ cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.9 (Ootpa)

However when running the make all of the downloaded source package I'm running into issues with the C compiler invocation. No matter if I try to compile using clang or gcc.

Compiler versions I've tested with are:
gcc

x@y: /dev/shm/kubeswitch-0.8.1$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --disable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 8.5.0 20210514 (Red Hat 8.5.0-20) (GCC) 

clang:

c@y: /dev/shm/kubeswitch-0.8.1$ clang -v
clang version 16.0.6 (Red Hat 16.0.6-2.module+el8.9.0+19521+190d7aba)
Target: x86_64-redhat-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /opt/rh/gcc-toolset-13/root/usr/lib/gcc/x86_64-redhat-linux/13
Selected GCC installation: /opt/rh/gcc-toolset-13/root/usr/lib/gcc/x86_64-redhat-linux/13
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64

go

x@y: /dev/shm/kubeswitch-0.8.1$ go version
go version go1.21.6 linux/amd64

Building using the default C compiler (clang) it fails using the following issues:

x@y: /dev/shm/kubeswitch-0.8.1$ make all
> Format
> Test
ok  	github.com/danielfoehrkn/kubeswitch/pkg/config/migration	(cached)
ok  	github.com/danielfoehrkn/kubeswitch/pkg/config/validation	(cached)
> Check
Executing golangci-lint
/dev/shm/kubeswitch-0.8.1/hack/tools/bin/golangci-lint
INFO [config_reader] Config search paths: [./ /dev/shm/kubeswitch-0.8.1 /dev/shm /dev / /home/x] 
INFO [lintersdb] Active 7 linters: [errcheck gosimple govet ineffassign staticcheck typecheck unused] 
INFO [loader] Go packages loading at mode 575 (exports_file|files|imports|types_sizes|compiled_files|name|deps) took 369.488726ms 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 6.044975ms 
INFO [linters_context/goanalysis] analyzers took 0s with no stages 
INFO [runner] Issues before processing: 12, after processing: 0 
INFO [runner] Processors filtering stat (out/in): cgo: 12/12, skip_dirs: 12/12, exclude: 12/12, exclude-rules: 0/12, autogenerated_exclude: 12/12, filename_unadjuster: 12/12, path_prettifier: 12/12, skip_files: 12/12, identifier_marker: 12/12 
INFO [runner] processing took 348.727µs with stages: identifier_marker: 128.002µs, autogenerated_exclude: 105.193µs, path_prettifier: 56.306µs, skip_dirs: 40.314µs, exclude-rules: 12.234µs, cgo: 1.966µs, nolint: 983ns, fixer: 692ns, max_same_issues: 545ns, skip_files: 436ns, filename_unadjuster: 405ns, severity-rules: 331ns, exclude: 281ns, diff: 223ns, max_per_file_from_linter: 163ns, source_code: 150ns, max_from_linter: 127ns, sort_results: 106ns, uniq_by_line: 105ns, path_prefixer: 83ns, path_shortener: 82ns 
INFO [runner] linters took 219.884616ms with stages: goanalysis_metalinter: 219.490396ms 
INFO File cache stats: 0 entries of total size 0B 
INFO Memory: 7 samples, avg is 40.3MB, max is 67.3MB 
INFO Execution took 598.978578ms                  
Executing go vet
Executing gofmt/goimports
Check for license headers
All checks successful
# runtime/cgo
clang-16: error: argument unused during compilation: '-arch x86_64' [-Werror,-Wunused-command-line-argument]
make: *** [Makefile:34: build-switcher] Error 1

Building using the (gcc) it fails using the following issues:

x@y: /dev/shm/kubeswitch-0.8.1$ export CC="gcc"
x@y: /dev/shm/kubeswitch-0.8.1$ make all
> Format
> Test
ok  	github.com/danielfoehrkn/kubeswitch/pkg/config/migration	(cached)
ok  	github.com/danielfoehrkn/kubeswitch/pkg/config/validation	(cached)
> Check
Executing golangci-lint
/dev/shm/kubeswitch-0.8.1/hack/tools/bin/golangci-lint
INFO [config_reader] Config search paths: [./ /dev/shm/kubeswitch-0.8.1 /dev/shm /dev / /home/x] 
INFO [lintersdb] Active 7 linters: [errcheck gosimple govet ineffassign staticcheck typecheck unused] 
INFO [loader] Go packages loading at mode 575 (compiled_files|deps|exports_file|files|imports|name|types_sizes) took 364.056768ms 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 6.909621ms 
INFO [linters_context/goanalysis] analyzers took 0s with no stages 
INFO [runner] Issues before processing: 12, after processing: 0 
INFO [runner] Processors filtering stat (out/in): path_prettifier: 12/12, skip_dirs: 12/12, identifier_marker: 12/12, cgo: 12/12, autogenerated_exclude: 12/12, exclude: 12/12, filename_unadjuster: 12/12, skip_files: 12/12, exclude-rules: 0/12 
INFO [runner] processing took 338.257µs with stages: autogenerated_exclude: 114.188µs, identifier_marker: 95.274µs, path_prettifier: 62.914µs, skip_dirs: 45.893µs, exclude-rules: 13.415µs, cgo: 2.387µs, nolint: 959ns, filename_unadjuster: 637ns, max_same_issues: 479ns, skip_files: 393ns, fixer: 303ns, severity-rules: 233ns, diff: 232ns, exclude: 229ns, max_from_linter: 143ns, sort_results: 109ns, source_code: 105ns, uniq_by_line: 102ns, path_shortener: 94ns, max_per_file_from_linter: 87ns, path_prefixer: 81ns 
INFO [runner] linters took 188.482193ms with stages: goanalysis_metalinter: 188.09972ms 
INFO File cache stats: 0 entries of total size 0B 
INFO Memory: 7 samples, avg is 40.0MB, max is 66.8MB 
INFO Execution took 562.844673ms                  
Executing go vet
Executing gofmt/goimports
Check for license headers
All checks successful
# runtime/cgo
gcc: error: x86_64: No such file or directory
gcc: error: unrecognized command line option '-arch'; did you mean '-march='?
make: *** [Makefile:34: build-switcher] Error 1

The strange thing is however that the go binary is being built nevertheless as hack/switch/switcher_linux_amd64 and this still seems to work well - at least using local store.

So I'm wondering what's causing the compile error and what are the consequences of the failed compile (as the go binary is built anyhow).

@danielfoehrKn
Copy link
Owner

Thanks for the detailed report. I'll try to look into the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants