Emerentius / sudoku-gui

Sudoku GUI in QT, using the Rust sudoku library for logic
GNU Affero General Public License v3.0
1 stars 1 forks source link

Build error "conflicting representation hints" #1

Open koutheir opened 4 years ago

koutheir commented 4 years ago

Attempting to build the master results in the following error:

Scanning dependencies of target sudoku_ffi
[  6%] Creating directories for 'sudoku_ffi'
[ 13%] Performing download step (git clone) for 'sudoku_ffi'
Cloning into 'sudoku_ffi'...
Note: switching to '600a1c9a251062a9f4293741bfe0bea255d98e64'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 600a1c9 bump dependency and version
[ 20%] No patch step for 'sudoku_ffi'
[ 26%] Performing update step for 'sudoku_ffi'
[ 33%] No configure step for 'sudoku_ffi'
[ 40%] Performing build step for 'sudoku_ffi'
    Updating crates.io index
  Downloaded crunchy v0.2.2
  Downloaded sudoku v0.7.0
  Downloaded 2 crates (79.8 KB) in 1.21s
   Compiling libc v0.2.71
   Compiling rand_core v0.4.2
   Compiling crunchy v0.2.2
   Compiling rand_core v0.3.1
   Compiling rand v0.5.6
   Compiling sudoku v0.7.0
   Compiling sudoku-ffi v0.3.0 (/home/koutheir/sudoku-gui/sudoku_ffi/src/sudoku_ffi)
error[E0566]: conflicting representation hints
 --> src/strategy/strategies.rs:3:8
  |
3 | #[repr(C, u8)]
  |        ^  ^^
  |
  = note: `#[deny(conflicting_repr_hints)]` on by default
  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
  = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>

error: aborting due to previous error

For more information about this error, try `rustc --explain E0566`.
error: could not compile `sudoku-ffi`.

To learn more, run the command again with --verbose.
make[2]: *** [CMakeFiles/sudoku_ffi.dir/build.make:112: sudoku_ffi/src/sudoku_ffi-stamp/sudoku_ffi-build] Error 101
make[1]: *** [CMakeFiles/Makefile2:107: CMakeFiles/sudoku_ffi.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
koutheir commented 4 years ago

Replacing #[repr(C, u8)] by either #[repr(C)] or #[repr(u8)] in sudoku_ffi/src/sudoku_ffi/src/strategy/strategies.rs:3 results in a successful build. However, running the executable sudoku-gui immediately causes a segmentation fault. If reproducing this issue is tricky, then I can attach a core dump.

koutheir commented 4 years ago

For reference:

$ rustc --version
rustc 1.44.0 (49cae5576 2020-06-01)

$ g++ --version
g++ (Debian 9.3.0-13) 9.3.0
...

$ cmake --version
cmake version 3.16.3
...

Also, I configured a Release build.

Emerentius commented 4 years ago

You're right that the ffi bindings are broken with newer rustc versions, but when that is fixed, the GUI compiles and runs fine for me. The issue must therefore lie somewhere on the C++ side, possibly with Qt.

My own versions are a bit older

rustc 1.45.0-nightly (7ced01a73 2020-04-30)
g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
cmake version 3.10.2
koutheir commented 4 years ago

Did you also build a release build?

Emerentius commented 4 years ago

If you mean a release build of sudoku-ffi, yes. it's the default.