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

packed type cannot transitively contain a #[repr(align)] type #2179

Open
ic3man5 opened this issue Mar 21, 2022 · 8 comments
Open

packed type cannot transitively contain a #[repr(align)] type #2179

ic3man5 opened this issue Mar 21, 2022 · 8 comments
Labels
rust-for-linux Issues relevant to the Rust for Linux project

Comments

@ic3man5
Copy link

ic3man5 commented Mar 21, 2022

Input C/C++ Header

#include <stdint.h>

#pragma pack(push, 2)

typedef struct _UART_SETTINGS
{
	uint16_t Baudrate;
	uint16_t spbrg;
	uint16_t brgh;
	uint16_t parity;
	uint16_t stop_bits;
	uint8_t flow_control; /* 0- off, 1 - Simple CTS RTS */
	uint8_t reserved_1;
	union {
		uint32_t bOptions;
		struct
		{
			unsigned invert_tx : 1;
			unsigned invert_rx : 1;
			unsigned half_duplex : 1;
			unsigned reserved_bits : 13;
			unsigned reserved_bits2 : 16;
		} opts;
	} options;
} UART_SETTINGS;

#pragma pack(pop)

Bindgen Invocation

$ bindgen test.h >> test.rs

Actual Results

error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
   --> src\main.rs:149:1
    |
149 | / pub union _UART_SETTINGS__bindgen_ty_1 {
150 | |     pub bOptions: u32,
151 | |     pub opts: _UART_SETTINGS__bindgen_ty_1__bindgen_ty_1,
152 | | }
    | |_^
    |
note: `_UART_SETTINGS__bindgen_ty_1__bindgen_ty_1` has a `#[repr(align)]` attribute
   --> src\main.rs:156:1
    |
156 | / pub struct _UART_SETTINGS__bindgen_ty_1__bindgen_ty_1 {
157 | |     pub _bitfield_align_1: [u8; 0],
158 | |     pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize]>,
159 | | }
    | |_^

Expected Results

compile successfully. If bitfields are removed and or packed is removed this work.

@kpishere
Copy link

kpishere commented Aug 12, 2022

I'm getting a similar error when trying to build https://github.com/nviennot/tinyusb-sys-rs.git

I'm building with: cargo build --verbose --features device,cdc,rp2040 --target thumbv6m-none-eabi

I get these errors

Running `rustc --crate-name tinyusb_sys --edition=2021 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="cdc"' --cfg 'feature="device"' --cfg 'feature="rp2040"' -C metadata=222396e23cc7c407 -C extra-filename=-222396e23cc7c407 --out-dir /Users/kevinpeck/Desktop/RepRap-RatRigVCore3/tinyusb-sys-rs/target/thumbv6m-none-eabi/debug/deps --target thumbv6m-none-eabi -C incremental=/Users/kevinpeck/Desktop/RepRap-RatRigVCore3/tinyusb-sys-rs/target/thumbv6m-none-eabi/debug/incremental -L dependency=/Users/kevinpeck/Desktop/RepRap-RatRigVCore3/tinyusb-sys-rs/target/thumbv6m-none-eabi/debug/deps -L dependency=/Users/kevinpeck/Desktop/RepRap-RatRigVCore3/tinyusb-sys-rs/target/debug/deps --extern cty=/Users/kevinpeck/Desktop/RepRap-RatRigVCore3/tinyusb-sys-rs/target/thumbv6m-none-eabi/debug/deps/libcty-539500295d24c90b.rmeta -L native=/Users/kevinpeck/Desktop/RepRap-RatRigVCore3/tinyusb-sys-rs/target/thumbv6m-none-eabi/debug/build/tinyusb-sys-d484e22ceeda2732/out -l static=tinyusb`
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
    --> /Users/kevinpeck/Desktop/RepRap-RatRigVCore3/tinyusb-sys-rs/target/thumbv6m-none-eabi/debug/build/tinyusb-sys-d484e22ceeda2732/out/bindings.rs:3910:1
     |
3910 | / pub struct cdc_desc_func_telephone_call_state_reporting_capabilities_t {
3911 | |     #[doc = "< Size of this descriptor in bytes."]
3912 | |     pub bLength: u8,
3913 | |     #[doc = "< Descriptor Type, must be Class-Specific"]
...    |
3917 | |     pub bmCapabilities: cdc_desc_func_telephone_call_state_reporting_capabilities_t__bindgen_ty_1,
3918 | | }
     | |_^
     |
note: `cdc_desc_func_telephone_call_state_reporting_capabilities_t__bindgen_ty_1` has a `#[repr(align)]` attribute
    --> /Users/kevinpeck/Desktop/RepRap-RatRigVCore3/tinyusb-sys-rs/target/thumbv6m-none-eabi/debug/build/tinyusb-sys-d484e22ceeda2732/out/bindings.rs:3922:1
     |
3922 | / pub struct cdc_desc_func_telephone_call_state_reporting_capabilities_t__bindgen_ty_1 {
3923 | |     pub _bitfield_align_1: [u32; 0],
3924 | |     pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize]>,
3925 | | }
     | |_^

For more information about this error, try `rustc --explain E0588`.
error: could not compile `tinyusb-sys` due to previous error

Caused by:
  process didn't exit successfully: `rustc --crate-name tinyusb_sys --edition=2021 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="cdc"' --cfg 'feature="device"' --cfg 'feature="rp2040"' -C metadata=222396e23cc7c407 -C extra-filename=-222396e23cc7c407 --out-dir /Users/kevinpeck/Desktop/RepRap-RatRigVCore3/tinyusb-sys-rs/target/thumbv6m-none-eabi/debug/deps --target thumbv6m-none-eabi -C incremental=/Users/kevinpeck/Desktop/RepRap-RatRigVCore3/tinyusb-sys-rs/target/thumbv6m-none-eabi/debug/incremental -L dependency=/Users/kevinpeck/Desktop/RepRap-RatRigVCore3/tinyusb-sys-rs/target/thumbv6m-none-eabi/debug/deps -L dependency=/Users/kevinpeck/Desktop/RepRap-RatRigVCore3/tinyusb-sys-rs/target/debug/deps --extern cty=/Users/kevinpeck/Desktop/RepRap-RatRigVCore3/tinyusb-sys-rs/target/thumbv6m-none-eabi/debug/deps/libcty-539500295d24c90b.rmeta -L native=/Users/kevinpeck/Desktop/RepRap-RatRigVCore3/tinyusb-sys-rs/target/thumbv6m-none-eabi/debug/build/tinyusb-sys-d484e22ceeda2732/out -l static=tinyusb` (exit status: 1)

Where the source looks like


/// \brief Telephone Call and Line State Reporting Capabilities Descriptor
/// \details The Telephone Call and Line State Reporting Capabilities functional descriptor describes the abilities of a
/// telephone device to report optional call and line states.
typedef struct TU_ATTR_PACKED
{
  uint8_t bLength            ; ///< Size of this descriptor in bytes.
  uint8_t bDescriptorType    ; ///< Descriptor Type, must be Class-Specific
  uint8_t bDescriptorSubType ; ///< Descriptor SubType one of above CDC_FUCN_DESC_
  struct {
    uint32_t interrupted_dialtone   : 1; ///< 0 : Reports only dialtone (does not differentiate between normal and interrupted dialtone). 1 : R
eports interrupted dialtone in addition to normal dialtone
    uint32_t ringback_busy_fastbusy : 1; ///< 0 : Reports only dialing state. 1 : Reports ringback, busy, and fast busy states.
    uint32_t caller_id              : 1; ///< 0 : Does not report caller ID. 1 : Reports caller ID information.
    uint32_t incoming_distinctive   : 1; ///< 0 : Reports only incoming ringing. 1 : Reports incoming distinctive ringing patterns.
    uint32_t dual_tone_multi_freq   : 1; ///< 0 : Cannot report dual tone multi-frequency (DTMF) digits input remotely over the telephone line.
 1 : Can report DTMF digits input remotely over the telephone line.
    uint32_t line_state_change      : 1; ///< 0 : Does not support line state change notification. 1 : Does support line state change notificat
ion
    uint32_t TU_RESERVED            : 26;
  } bmCapabilities;
}cdc_desc_func_telephone_call_state_reporting_capabilities_t;

@ojeda
Copy link
Contributor

ojeda commented Jan 6, 2023

Seen by the kernel as well at: https://lore.kernel.org/all/[email protected]/

struct alt_instr {
	s32 instr_offset;	/* original instruction */
	s32 repl_offset;	/* offset to replacement instruction */

	union {
		struct {
			u32 cpuid: 16;	/* CPUID bit set for replacement */
			u32 flags: 16;	/* patching control flags */
		};
		u32 ft_flgs;
	};

	u8  instrlen;		/* length of original instruction */
	u8  replacementlen;	/* length of new instruction */
} __packed;

@0x5459
Copy link

0x5459 commented Apr 26, 2023

Encountered the same problem when binding spdk.

#include <stdint.h>

struct __attribute__((packed)) spdk_nvme_sgl_descriptor {
	uint64_t address;
	union {
		struct {
			uint8_t reserved[7];
			uint8_t subtype	: 4;
			uint8_t type	: 4;
		} generic;

		struct {
			uint32_t length;
			uint8_t reserved[3];
			uint8_t subtype	: 4;
			uint8_t type	: 4;
		} unkeyed;

		struct {
			uint64_t length		: 24;
			uint64_t key		: 32;
			uint64_t subtype	: 4;
			uint64_t type		: 4;
		} keyed;
	};
};

@tomDev5
Copy link

tomDev5 commented Oct 28, 2023

Any solution?

@ic3man5
Copy link
Author

ic3man5 commented Dec 12, 2023

Here is a simple breakdown of the actual issue at hand. It looks the rust compiler can't align and pack at the same time which is causing the issue.

#[derive(Debug, Clone, Copy)]
#[repr(C, packed(2))]
struct PackedAlignedTest {
    a: u32,
    b: u16,
    inner: PackedAlignedInnerTest,
}

#[derive(Debug, Clone, Copy)]
#[repr(C, align(2))]
struct PackedAlignedInnerTest {
    c: u32,
    d: u16,
}

fn main() {
    let packed_aligned_test = PackedAlignedTest { 
        a: 0, 
        b: 1, 
        inner: PackedAlignedInnerTest { 
            c: 2, 
            d: 3 
        }
    };
    println!("{packed_aligned_test:#?}");
}
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
  --> src/main.rs:3:1
   |
3  | struct PackedAlignedTest {
   | ^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: `PackedAlignedInnerTest` has a `#[repr(align)]` attribute
  --> src/main.rs:11:1
   |
11 | struct PackedAlignedInnerTest {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0588`.
error: could not compile `playground` (bin "playground") due to previous error

From what I can tell there was an oversight in this issue: rust-lang/rust#33158

Currently #[repr(packed())] structs cannot transitively contain #[repr(align())] structs due to differing behavior between msvc and gcc. Do we want to keep this a hard error, pick one behavior over the other, or provide some way to choose which behavior is desired?

This was never resolved and missed in review.

@ojeda ojeda added the rust-for-linux Issues relevant to the Rust for Linux project label Feb 3, 2024
@nanakura
Copy link

Encountered the same problem when binding spdk.

error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
     --> /home/vagrant/workspace/async-spdk/target/debug/build/spdk-sys-ffa6f23ced34b9c1/out/bindings.rs:48397:1
      |
48397 | pub struct spdk_bdev_ext_io_opts {
      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      |
note: `spdk_bdev_nvme_cdw13__bindgen_ty_1` has a `#[repr(align)]` attribute
     --> /home/vagrant/workspace/async-spdk/target/debug/build/spdk-sys-ffa6f23ced34b9c1/out/bindings.rs:48302:1
      |
48302 | pub struct spdk_bdev_nvme_cdw13__bindgen_ty_1 {
      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: `spdk_bdev_ext_io_opts` contains a field of type `spdk_bdev_nvme_cdw13`
     --> /home/vagrant/workspace/async-spdk/target/debug/build/spdk-sys-ffa6f23ced34b9c1/out/bindings.rs:48413:9
      |
48413 |     pub nvme_cdw13: spdk_bdev_nvme_cdw13,
      |         ^^^^^^^^^^
note: ...which contains a field of type `spdk_bdev_nvme_cdw13__bindgen_ty_1`
     --> /home/vagrant/workspace/async-spdk/target/debug/build/spdk-sys-ffa6f23ced34b9c1/out/bindings.rs:48297:9
      |
48297 |     pub write: spdk_bdev_nvme_cdw13__bindgen_ty_1,
      |         ^^^^^

For more information about this error, try `rustc --explain E0588`.
error: could not compile `spdk-sys` (lib) due to 1 previous error

@xxxmailk
Copy link

o(╥﹏╥)o same problem when binding spdk, and another problem: error[E0428]: the name FP_NAN is defined multiple times

  Compiling spdk-rs v0.1.0 (/data/rust/ystor/spdk-rs) error[E0428]: the nameFP_NANis defined multiple times --> /data/rust/ystor/target/debug/build/spdk-rs-d170b11ac1537d9e/out/bindings.rs:4415:1 | 659  | pub const FP_NAN: u32 = 0; | -------------------------- previous definition of the valueFP_NANhere ... 4415 | pub const FP_NAN: _bindgen_ty_2 = 0; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^FP_NANredefined here | = note:FP_NAN` must be defined only once in the value namespace of this module

error[E0428]: the name FP_INFINITE is defined multiple times
--> /data/rust/ystor/target/debug/build/spdk-rs-d170b11ac1537d9e/out/bindings.rs:4416:1
|
660 | pub const FP_INFINITE: u32 = 1;
| ------------------------------- previous definition of the value FP_INFINITE here
...
4416 | pub const FP_INFINITE: _bindgen_ty_2 = 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FP_INFINITE redefined here
|
= note: FP_INFINITE must be defined only once in the value namespace of this module

error[E0428]: the name FP_ZERO is defined multiple times
--> /data/rust/ystor/target/debug/build/spdk-rs-d170b11ac1537d9e/out/bindings.rs:4417:1
|
661 | pub const FP_ZERO: u32 = 2;
| --------------------------- previous definition of the value FP_ZERO here
...
4417 | pub const FP_ZERO: _bindgen_ty_2 = 2;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FP_ZERO redefined here
|
= note: FP_ZERO must be defined only once in the value namespace of this module

error[E0428]: the name FP_SUBNORMAL is defined multiple times
--> /data/rust/ystor/target/debug/build/spdk-rs-d170b11ac1537d9e/out/bindings.rs:4418:1
|
662 | pub const FP_SUBNORMAL: u32 = 3;
| -------------------------------- previous definition of the value FP_SUBNORMAL here
...
4418 | pub const FP_SUBNORMAL: _bindgen_ty_2 = 3;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FP_SUBNORMAL redefined here
|
= note: FP_SUBNORMAL must be defined only once in the value namespace of this module

error[E0428]: the name FP_NORMAL is defined multiple times
--> /data/rust/ystor/target/debug/build/spdk-rs-d170b11ac1537d9e/out/bindings.rs:4419:1
|
663 | pub const FP_NORMAL: u32 = 4;
| ----------------------------- previous definition of the value FP_NORMAL here
...
4419 | pub const FP_NORMAL: _bindgen_ty_2 = 4;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FP_NORMAL redefined here
|
= note: FP_NORMAL must be defined only once in the value namespace of this module

error[E0428]: the name IPPORT_RESERVED is defined multiple times
--> /data/rust/ystor/target/debug/build/spdk-rs-d170b11ac1537d9e/out/bindings.rs:8894:1
|
1328 | pub const IPPORT_RESERVED: u32 = 1024;
| -------------------------------------- previous definition of the value IPPORT_RESERVED here
...
8894 | pub const IPPORT_RESERVED: _bindgen_ty_8 = 1024;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ IPPORT_RESERVED redefined here
|
= note: IPPORT_RESERVED must be defined only once in the value namespace of this module

error[E0588]: packed type cannot transitively contain a #[repr(align)] type
--> /data/rust/ystor/target/debug/build/spdk-rs-d170b11ac1537d9e/out/bindings.rs:39112:1
|
39112 | pub struct spdk_nvme_ctrlr_data {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: spdk_nvme_vs_register__bindgen_ty_1 has a #[repr(align)] attribute
--> /data/rust/ystor/target/debug/build/spdk-rs-d170b11ac1537d9e/out/bindings.rs:26763:1
|
26763 | pub struct spdk_nvme_vs_register__bindgen_ty_1 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: spdk_nvme_ctrlr_data contains a field of type spdk_nvme_vs_register
--> /data/rust/ystor/target/debug/build/spdk-rs-d170b11ac1537d9e/out/bindings.rs:39123:9
|
39123 | pub ver: spdk_nvme_vs_register,
| ^^^
note: ...which contains a field of type spdk_nvme_vs_register__bindgen_ty_1
--> /data/rust/ystor/target/debug/build/spdk-rs-d170b11ac1537d9e/out/bindings.rs:26758:9
|
26758 | pub bits: spdk_nvme_vs_register__bindgen_ty_1,
| ^^^^

error[E0588]: packed type cannot transitively contain a #[repr(align)] type
--> /data/rust/ystor/target/debug/build/spdk-rs-d170b11ac1537d9e/out/bindings.rs:51029:1
|
51029 | pub struct spdk_bdev_ext_io_opts {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: spdk_bdev_nvme_cdw13__bindgen_ty_1 has a #[repr(align)] attribute
--> /data/rust/ystor/target/debug/build/spdk-rs-d170b11ac1537d9e/out/bindings.rs:50934:1
|
50934 | pub struct spdk_bdev_nvme_cdw13__bindgen_ty_1 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: spdk_bdev_ext_io_opts contains a field of type spdk_bdev_nvme_cdw13
--> /data/rust/ystor/target/debug/build/spdk-rs-d170b11ac1537d9e/out/bindings.rs:51045:9
|
51045 | pub nvme_cdw13: spdk_bdev_nvme_cdw13,
| ^^^^^^^^^^
note: ...which contains a field of type spdk_bdev_nvme_cdw13__bindgen_ty_1
--> /data/rust/ystor/target/debug/build/spdk-rs-d170b11ac1537d9e/out/bindings.rs:50929:9
|
50929 | pub write: spdk_bdev_nvme_cdw13__bindgen_ty_1,
| ^^^^^

error[E0588]: packed type cannot transitively contain a #[repr(align)] type
--> /data/rust/ystor/target/debug/build/spdk-rs-d170b11ac1537d9e/out/bindings.rs:79290:1
|
79290 | pub struct spdk_nvmf_fabric_connect_rsp {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: spdk_nvme_status has a #[repr(align)] attribute
--> /data/rust/ystor/target/debug/build/spdk-rs-d170b11ac1537d9e/out/bindings.rs:35898:1
|
35898 | pub struct spdk_nvme_status {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0588]: packed type cannot transitively contain a #[repr(align)] type
--> /data/rust/ystor/target/debug/build/spdk-rs-d170b11ac1537d9e/out/bindings.rs:79825:1
|
79825 | pub struct spdk_nvmf_fabric_prop_get_rsp {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: spdk_nvme_status has a #[repr(align)] attribute
--> /data/rust/ystor/target/debug/build/spdk-rs-d170b11ac1537d9e/out/bindings.rs:35898:1
|
35898 | pub struct spdk_nvme_status {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0588]: packed type cannot transitively contain a #[repr(align)] type
--> /data/rust/ystor/target/debug/build/spdk-rs-d170b11ac1537d9e/out/bindings.rs:82432:1
|
82432 | pub struct spdk_nvme_tcp_cmd {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: spdk_nvme_cmd_cdw10__bindgen_ty_1 has a #[repr(align)] attribute
--> /data/rust/ystor/target/debug/build/spdk-rs-d170b11ac1537d9e/out/bindings.rs:32524:1
|
32524 | pub struct spdk_nvme_cmd_cdw10__bindgen_ty_1 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: spdk_nvme_tcp_cmd contains a field of type spdk_nvme_cmd
--> /data/rust/ystor/target/debug/build/spdk-rs-d170b11ac1537d9e/out/bindings.rs:82434:9
|
82434 | pub ccsqe: spdk_nvme_cmd,
| ^^^^^
note: ...which contains a field of type spdk_nvme_cmd__bindgen_ty_2
--> /data/rust/ystor/target/debug/build/spdk-rs-d170b11ac1537d9e/out/bindings.rs:35463:9
|
35463 | pub __bindgen_anon_1: spdk_nvme_cmd__bindgen_ty_2,
| ^^^^^^^^^^^^^^^^
note: ...which contains a field of type spdk_nvme_cmd_cdw10
--> /data/rust/ystor/target/debug/build/spdk-rs-d170b11ac1537d9e/out/bindings.rs:35564:9
|
35564 | pub cdw10_bits: spdk_nvme_cmd_cdw10,
| ^^^^^^^^^^
note: ...which contains a field of type spdk_nvme_cmd_cdw10__bindgen_ty_1
--> /data/rust/ystor/target/debug/build/spdk-rs-d170b11ac1537d9e/out/bindings.rs:32505:9
|
32505 | pub identify: spdk_nvme_cmd_cdw10__bindgen_ty_1,
| ^^^^^^^^

error[E0588]: packed type cannot transitively contain a #[repr(align)] type
--> /data/rust/ystor/target/debug/build/spdk-rs-d170b11ac1537d9e/out/bindings.rs:82473:1
|
82473 | pub struct spdk_nvme_tcp_rsp {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: spdk_nvme_status has a #[repr(align)] attribute
--> /data/rust/ystor/target/debug/build/spdk-rs-d170b11ac1537d9e/out/bindings.rs:35898:1
|
35898 | pub struct spdk_nvme_status {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: spdk_nvme_tcp_rsp contains a field of type spdk_nvme_cpl
--> /data/rust/ystor/target/debug/build/spdk-rs-d170b11ac1537d9e/out/bindings.rs:82475:9
|
82475 | pub rccqe: spdk_nvme_cpl,
| ^^^^^
note: ...which contains a field of type spdk_nvme_cpl__bindgen_ty_1
--> /data/rust/ystor/target/debug/build/spdk-rs-d170b11ac1537d9e/out/bindings.rs:36027:9
|
36027 | pub __bindgen_anon_1: spdk_nvme_cpl__bindgen_ty_1,
| ^^^^^^^^^^^^^^^^
note: ...which contains a field of type spdk_nvme_status
--> /data/rust/ystor/target/debug/build/spdk-rs-d170b11ac1537d9e/out/bindings.rs:36033:9
|
36033 | pub status: spdk_nvme_status,
| ^^^^^^

Some errors have detailed explanations: E0428, E0588.
For more information about an error, try rustc --explain E0428.
error: could not compile spdk-rs (lib) due to 12 previous errors



@pvdrz
Copy link
Contributor

pvdrz commented Aug 6, 2024

@xxxmailk the multiple FP_.* constants is because you're including math.h which contains code that's effectively translated into actually duplicated constants. The easiest way to avoid this is to denylist math.h or just allowlist the files for which you actually want to generate bindings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rust-for-linux Issues relevant to the Rust for Linux project
Projects
None yet
Development

No branches or pull requests

8 participants