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

Compilation error on NetBSD aarch64 #2

Open
lpvm opened this issue Jun 3, 2021 · 2 comments
Open

Compilation error on NetBSD aarch64 #2

lpvm opened this issue Jun 3, 2021 · 2 comments

Comments

@lpvm
Copy link

lpvm commented Jun 3, 2021

When trying to compile on a NetBSD aarch64 system, the compilation stops with an error.

warning: In file included from /usr/include/arm/bswap.h:13,
warning:                  from /usr/include/machine/bswap.h:3,
warning:                  from src/c/common.h:38,
warning:                  from src/c/common.c:1:
warning: /usr/include/sys/bswap.h:19:10: error: conflicting types for 'bswap16'
warning:    19 | uint16_t bswap16(uint16_t) __RENAME(__bswap16) __constfunc;
warning:       |          ^~~~~~~
warning: In file included from /usr/include/machine/endian.h:3,
warning:                  from /usr/include/sys/types.h:98,
warning:                  from /usr/include/aarch64/byte_swap.h:49,
warning:                  from /usr/include/arm/bswap.h:7,
warning:                  from /usr/include/machine/bswap.h:3,
warning:                  from src/c/common.h:38,
warning:                  from src/c/common.c:1:
warning: /usr/include/sys/endian.h:203:1: note: previous implicit declaration of 'bswap16' was here
warning:   203 | __GEN_ENDIAN_ENC(16, be)
warning:       | ^~~~~~~~~~~~~~~~
warning: In file included from /usr/include/arm/bswap.h:13,
warning:                  from /usr/include/machine/bswap.h:3,
warning:                  from src/c/common.h:38,
warning:                  from src/c/common.c:1:
warning: /usr/include/sys/bswap.h:20:10: error: conflicting types for 'bswap32'
warning:    20 | uint32_t bswap32(uint32_t) __RENAME(__bswap32) __constfunc;
warning:       |          ^~~~~~~
warning: In file included from /usr/include/machine/endian.h:3,
warning:                  from /usr/include/sys/types.h:98,
warning:                  from /usr/include/aarch64/byte_swap.h:49,
warning:                  from /usr/include/arm/bswap.h:7,
warning:                  from /usr/include/machine/bswap.h:3,
warning:                  from src/c/common.h:38,
warning:                  from src/c/common.c:1:
warning: /usr/include/sys/endian.h:204:1: note: previous implicit declaration of 'bswap32' was here
warning:   204 | __GEN_ENDIAN_ENC(32, be)
warning:       | ^~~~~~~~~~~~~~~~
warning: In file included from /usr/include/arm/bswap.h:13,
warning:                  from /usr/include/machine/bswap.h:3,
warning:                  from src/c/common.h:38,
warning:                  from src/c/common.c:1:
warning: /usr/include/sys/bswap.h:22:10: error: conflicting types for 'bswap64'
warning:    22 | uint64_t bswap64(uint64_t) __constfunc;
warning:       |          ^~~~~~~
warning: In file included from /usr/include/machine/endian.h:3,
warning:                  from /usr/include/sys/types.h:98,
warning:                  from /usr/include/aarch64/byte_swap.h:49,
warning:                  from /usr/include/arm/bswap.h:7,
warning:                  from /usr/include/machine/bswap.h:3,
warning:                  from src/c/common.h:38,
warning:                  from src/c/common.c:1:
warning: /usr/include/sys/endian.h:205:1: note: previous implicit declaration of 'bswap64' was here
warning:   205 | __GEN_ENDIAN_ENC(64, be)
warning:       | ^~~~~~~~~~~~~~~~

error: failed to run custom build command for `signum-miner v1.8.0 (/root/bin/signum-miner-1.8.0)`

Caused by:
  process didn't exit successfully: `/root/bin/signum-miner-1.8.0/target/release/build/signum-miner-d90679db5e2ded24/build-script-build` (exit code: 1)
  --- stdout
  TARGET = Some("aarch64-unknown-netbsd")
  OPT_LEVEL = Some("3")
  HOST = Some("aarch64-unknown-netbsd")
  CC_aarch64-unknown-netbsd = None
  CC_aarch64_unknown_netbsd = None
  HOST_CC = None
  CC = None
  CFLAGS_aarch64-unknown-netbsd = None
  CFLAGS_aarch64_unknown_netbsd = None
  HOST_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  CARGO_CFG_TARGET_FEATURE = None
  running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-Wall" "-Wextra" "-std=c99" "-mtune=native" "-o" "/root/bin/signum-miner-1.8.0/target/release/build/signum-miner-0ca3530d0b31a71f/out/src/c/sph_shabal.o" "-c" "src/c/sph_shabal.c"
  exit code: 0
  running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-Wall" "-Wextra" "-std=c99" "-mtune=native" "-o" "/root/bin/signum-miner-1.8.0/target/release/build/signum-miner-0ca3530d0b31a71f/out/src/c/shabal.o" "-c" "src/c/shabal.c"
  exit code: 0
  running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-Wall" "-Wextra" "-std=c99" "-mtune=native" "-o" "/root/bin/signum-miner-1.8.0/target/release/build/signum-miner-0ca3530d0b31a71f/out/src/c/common.o" "-c" "src/c/common.c"
  cargo:warning=In file included from /usr/include/arm/bswap.h:13,
  cargo:warning=                 from /usr/include/machine/bswap.h:3,
  cargo:warning=                 from src/c/common.h:38,
  cargo:warning=                 from src/c/common.c:1:
  cargo:warning=/usr/include/sys/bswap.h:19:10: error: conflicting types for 'bswap16'
  cargo:warning=   19 | uint16_t bswap16(uint16_t) __RENAME(__bswap16) __constfunc;
  cargo:warning=      |          ^~~~~~~
  cargo:warning=In file included from /usr/include/machine/endian.h:3,
  cargo:warning=             

Maybe this helps.
In the netbsd irc channel, some developer said that:

don't mix sys/endian.h and sys/bswap.h
but that's probably a bug that this case isn't protected.

In the rust irc channel, another developer said:

looks like duplicate declarations
duplicating but conflicting
you might be running in to this: http://gnats.netbsd.org/49696
I'm not an expert but looking at NetBSD source it looks that if __BSWAP_RENAME is defined somewhere
then it may conflict with the default aarch64 implementation.
Oh wait it's more complicated than that. Looks like a nasty bug.
Looks like that __BSWA_RENAME was put there as a workaround. Maybe you have older source?
there's a workaround in the link [code] posted maybe that needs to be used in common.c

@jjos2372
Copy link

jjos2372 commented Jun 3, 2021

Thanks for reporting. With Ubuntu aarch64 I get no issues. I might try to cross-compile it in the future.

If someone else finds the solution, probably just some tweaks around src/c/common.h:38, a PR would be very welcome.

@lpvm
Copy link
Author

lpvm commented Jun 3, 2021

I may make available a ready to use aarch64 NetBSD qemu image if you'd like not to have to waste time preparing one.

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