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

Fails on FreeBSD armv7,i386,powerpc architectures: error: conflicting types for 'get_cpu_speed' #80

Open
yurivict opened this issue Jan 5, 2021 · 3 comments

Comments

@yurivict
Copy link

yurivict commented Jan 5, 2021

Please see a complete log: http://beefy17.nyi.freebsd.org/data/main-i386-default/p560362_s58661b3ba9/logs/starship-0.48.0.log (IPv6 URL).

warning: c/freebsd.c:31:10: error: conflicting types for 'get_cpu_speed'
warning: uint64_t get_cpu_speed(void) {
warning:          ^
warning: c/info.h:31:15: note: previous declaration is here
warning: unsigned long get_cpu_speed(void);
warning:               ^
warning: c/freebsd.c:47:10: error: conflicting types for 'get_proc_total'
warning: uint64_t get_proc_total(void) {
warning:          ^
warning: c/info.h:34:15: note: previous declaration is here
warning: unsigned long get_proc_total(void);
warning:               ^
warning: 2 errors generated.

error: failed to run custom build command for `sys-info v0.7.0`

Caused by:
  process didn't exit successfully: `/wrkdirs/usr/ports/shells/starship/work/target/release/build/sys-info-1abc58d520aeca1b/build-script-build` (exit code: 1)
  --- stdout
  cargo:rustc-flags=-l pthread
  TARGET = Some("i686-unknown-freebsd")
  OPT_LEVEL = Some("3")
  HOST = Some("i686-unknown-freebsd")
  CC_i686-unknown-freebsd = None
  CC_i686_unknown_freebsd = None
  HOST_CC = None
  CC = Some("cc")
  CFLAGS_i686-unknown-freebsd = None
  CFLAGS_i686_unknown_freebsd = None
  HOST_CFLAGS = None
  CFLAGS = Some("-O2 -pipe  -fstack-protector-strong -fno-strict-aliasing ")
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  CARGO_CFG_TARGET_FEATURE = None
  running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m32" "-O2" "-pipe" "-fstack-protector-strong" "-fno-strict-aliasing" "-o" "/wrkdirs/usr/ports/shells/starship/work/target/release/build/sys-info-112f9ce0cf325461/out/c/freebsd.o" "-c" "c/freebsd.c"
  cargo:warning=c/freebsd.c:31:10: error: conflicting types for 'get_cpu_speed'
  cargo:warning=uint64_t get_cpu_speed(void) {
  cargo:warning=         ^
  cargo:warning=c/info.h:31:15: note: previous declaration is here
  cargo:warning=unsigned long get_cpu_speed(void);
  cargo:warning=              ^
  cargo:warning=c/freebsd.c:47:10: error: conflicting types for 'get_proc_total'
  cargo:warning=uint64_t get_proc_total(void) {
  cargo:warning=         ^
  cargo:warning=c/info.h:34:15: note: previous declaration is here
  cargo:warning=unsigned long get_proc_total(void);
  cargo:warning=              ^
  cargo:warning=2 errors generated.
  exit code: 1

  --- stderr


  error occurred: Command "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m32" "-O2" "-pipe" "-fstack-protector-strong" "-fno-strict-aliasing" "-o" "/wrkdirs/usr/ports/shells/starship/work/target/release/build/sys-info-112f9ce0cf325461/out/c/freebsd.o" "-c" "c/freebsd.c" with args "cc" did not execute successfully (status code exit code: 1).


warning: build failed, waiting for other jobs to finish...
@0323pin
Copy link

0323pin commented Oct 6, 2021

It fails to build on NetBSD, 32 bits as well with a very similar output while building nushell,

The following warnings were emitted during compilation:

warning: c/netbsd.c:44:10: error: conflicting types for 'get_cpu_speed'
warning:  uint64_t get_cpu_speed(void) {
warning:           ^~~~~~~~~~~~~
warning: In file included from c/netbsd.c:18:0:
warning: c/info.h:31:15: note: previous declaration of 'get_cpu_speed' was here
warning:  unsigned long get_cpu_speed(void);
warning:                ^~~~~~~~~~~~~

error: failed to run custom build command for `sys-info v0.9.0`

Caused by:
  process didn't exit successfully: `/tmp/work/shells/nushell/work/nushell-0.37.0/target/release/build/sys-info-43fe4771b44c5a77/build-script-build` (exit status: 1)
  --- stdout
  cargo:rustc-flags=-l pthread
  TARGET = Some("i586-unknown-netbsd")
  OPT_LEVEL = Some("z")
  HOST = Some("i586-unknown-netbsd")
  CC_i586-unknown-netbsd = None
  CC_i586_unknown_netbsd = None
  HOST_CC = None
  CC = Some("gcc")
  CFLAGS_i586-unknown-netbsd = None
  CFLAGS_i586_unknown_netbsd = None
  HOST_CFLAGS = None
  CFLAGS = Some("-O2 -fPIC -D_FORTIFY_SOURCE=2 -I/usr/pkg/include -I/usr/include -I/usr/X11R7/include")
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  CARGO_CFG_TARGET_FEATURE = None
  running: "gcc" "-Os" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m32" "-O2" "-fPIC" "-D_FORTIFY_SOURCE=2" "-I/usr/pkg/include" "-I/usr/include" "-I/usr/X11R7/include" "-o" "/tmp/work/shells/nushell/work/nushell-0.37.0/target/release/build/sys-info-120d345b9c012806/out/c/netbsd.o" "-c" "c/netbsd.c"
  cargo:warning=c/netbsd.c:44:10: error: conflicting types for 'get_cpu_speed'
  cargo:warning= uint64_t get_cpu_speed(void) {
  cargo:warning=          ^~~~~~~~~~~~~
  cargo:warning=In file included from c/netbsd.c:18:0:
  cargo:warning=c/info.h:31:15: note: previous declaration of 'get_cpu_speed' was here
  cargo:warning= unsigned long get_cpu_speed(void);
  cargo:warning=               ^~~~~~~~~~~~~
  exit status: 1

  --- stderr


  error occurred: Command "gcc" "-Os" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m32" "-O2" "-fPIC" "-D_FORTIFY_SOURCE=2" "-I/usr/pkg/include" "-I/usr/include" "-I/usr/X11R7/include" "-o" "/tmp/work/shells/nushell/work/nushell-0.37.0/target/release/build/sys-info-120d345b9c012806/out/c/netbsd.o" "-c" "c/netbsd.c" with args "gcc" did not execute successfully (status code exit status: 1).


warning: build failed, waiting for other jobs to finish...
error: build failed
*** Error code 101

It builds fine on x86_64

@yurivict yurivict changed the title Fails on FreeBSD: error: conflicting types for 'get_cpu_speed' Fails on FreeBSD armv7,i386,powerpc architectures: error: conflicting types for 'get_cpu_speed' Aug 7, 2022
@danfe
Copy link

danfe commented Oct 29, 2022

Returning uint64_t from these functions looks bogus in the first place, CPU count and speed are naturally not that huge and would hardly ever overflow even a short int. :-)

@nunotexbsd
Copy link

Workaround by replacing "unsigned long" with "uint64_t" fix build/run.

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=267290

Should we wait for a better and correct fix for this or is it ok to use this workaround?

Thanks @danfe

freebsd-git pushed a commit to freebsd/freebsd-ports that referenced this issue Oct 31, 2022
 - sys-info-0.9.1 crate fix
   FillZpp/sys-info-rs#80

PR:		267290
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

4 participants