eclipse / paho.mqtt.rust

paho.mqtt.rust
Other
516 stars 102 forks source link

Failing to cross-compile to Window target x86_64-pc-windows-gnu #161

Open brunoluizkatz-NETZSCH opened 2 years ago

brunoluizkatz-NETZSCH commented 2 years ago

Before

My Cargo.toml

[package]
name = "mqtt_explorer_lib"
version = "0.1.0"
edition = "2021"

[dependencies]
egui = { version = "0.18.0" }
egui_extras = { version = "0.18.0" }
paho-mqtt = { version = "0.11", default-features = false, features = ["bundled"] }
serde = { version = "1.0.104", features = ["derive"] }
serde_json = "1.0.48"
regex = "1"
chrono = "0.4.11"

My ./.cargo/config file

[target.x86_64-pc-windows-gnu]
linker = "x86_64-w64-mingw32-gcc"
ar = "x86_64-w64-mingw32-gcc-ar"

Output Errors:

With cargo build

sudo apt-get install gcc-mingw-w64-x86-64 -y
cargo build --target x86_64-pc-windows-gnu --release
Error output with cargo build --target ... ```shell Updating crates.io index Compiling cmake v0.1.45 Compiling idna v0.2.3 Compiling parking_lot_core v0.9.3 Compiling parking_lot_core v0.8.5 Compiling glutin_wgl_sys v0.1.5 Compiling clipboard-win v4.4.1 Compiling time v0.1.44 Compiling num-integer v0.1.45 Compiling libloading v0.7.3 Compiling bytemuck_derive v1.1.0 Compiling tracing-attributes v0.1.21 Compiling thiserror-impl v1.0.31 Compiling futures-macro v0.3.21 Compiling serde_derive v1.0.137 Compiling glutin_egl_sys v0.1.5 Compiling regex v1.5.6 Compiling parking_lot v0.12.1 Compiling parking_lot v0.11.2 Compiling chrono v0.4.19 Compiling paho-mqtt-sys v0.7.0 Compiling url v2.2.2 Compiling winit v0.26.1 Compiling bytemuck v1.9.1 Compiling webbrowser v0.7.1 Compiling futures-util v0.3.21 Compiling emath v0.18.0 Compiling thiserror v1.0.31 Compiling glutin v0.28.0 Compiling tracing v0.1.35 Compiling epaint v0.18.1 Compiling arboard v2.1.1 Compiling egui v0.18.1 Compiling serde v1.0.137 error: failed to run custom build command for `paho-mqtt-sys v0.7.0` Caused by: process didn't exit successfully: `/home/my_user/Documentos/mqtt-explorer/target/release/build/paho-mqtt-sys-9b3aea11c9bec0db/build-script-build` (exit status: 101) --- stdout debug:Running the bundled build for Paho C debug:Building for Windows cargo:rerun-if-changed=build.rs detected home dir change, cleaning out entire build directory running: "cmake" "/home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/" "-DCMAKE_SYSTEM_NAME=Windows" "-DCMAKE_RC_COMPILER=/usr/bin/x86_64-w64-mingw32-windres" "-DPAHO_BUILD_SHARED=off" "-DPAHO_BUILD_STATIC=on" "-DPAHO_ENABLE_TESTING=off" "-DPAHO_HIGH_PERFORMANCE=on" "-DPAHO_WITH_SSL=off" "-DCMAKE_INSTALL_PREFIX=/home/my_user/Documentos/mqtt-explorer/target/x86_64-pc-windows-gnu/release/build/paho-mqtt-sys-f4a6b903351f2e74/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -m64" "-DCMAKE_C_COMPILER=/usr/bin/x86_64-w64-mingw32-gcc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -m64" "-DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -m64" "-DCMAKE_ASM_COMPILER=/usr/bin/x86_64-w64-mingw32-gcc" "-DCMAKE_BUILD_TYPE=Release" -- The C compiler identification is GNU 9.3.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/x86_64-w64-mingw32-gcc - skipped -- Detecting C compile features -- Detecting C compile features - done -- CMake version: 3.21.20210814-g688b647 -- CMake system name: Windows -- Timestamp is 2022-08-12T21:05:14Z -- Configuring done -- Generating done -- Build files have been written to: /home/my_user/Documentos/mqtt-explorer/target/x86_64-pc-windows-gnu/release/build/paho-mqtt-sys-f4a6b903351f2e74/out/build running: "cmake" "--build" "." "--target" "install" "--config" "Release" "--" [ 3%] Building C object src/CMakeFiles/common_obj_static.dir/MQTTTime.c.obj [ 7%] Building C object src/CMakeFiles/common_obj_static.dir/MQTTProtocolClient.c.obj [ 11%] Building C object src/CMakeFiles/common_obj_static.dir/Clients.c.obj [ 14%] Building C object src/CMakeFiles/common_obj_static.dir/utf-8.c.obj [ 18%] Building C object src/CMakeFiles/common_obj_static.dir/MQTTPacket.c.obj [ 22%] Building C object src/CMakeFiles/common_obj_static.dir/MQTTPacketOut.c.obj [ 25%] Building C object src/CMakeFiles/common_obj_static.dir/Messages.c.obj [ 29%] Building C object src/CMakeFiles/common_obj_static.dir/Tree.c.obj [ 40%] Building C object src/CMakeFiles/common_obj_static.dir/MQTTPersistence.c.obj [ 40%] Building C object src/CMakeFiles/common_obj_static.dir/Socket.c.obj [ 40%] Building C object src/CMakeFiles/common_obj_static.dir/Log.c.obj [ 44%] Building C object src/CMakeFiles/common_obj_static.dir/Thread.c.obj [ 48%] Building C object src/CMakeFiles/common_obj_static.dir/MQTTProtocolOut.c.obj --- stderr CMake Warning: Manually-specified variables were not used by the project: CMAKE_ASM_COMPILER CMAKE_ASM_FLAGS CMAKE_CXX_COMPILER CMAKE_CXX_FLAGS /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c: In function ‘cmpfds’: /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:240:38: error: dereferencing pointer to incomplete type ‘struct pollfd’ 240 | SOCKET key1 = ((struct pollfd*)p1)->fd; | ^~ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c: In function ‘Socket_addSocket’: /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:267:63: error: invalid use of undefined type ‘struct pollfd’ 267 | mod_s.fds = realloc(mod_s.fds, mod_s.nfds * sizeof(mod_s.fds[0])); | ^ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:269:51: error: invalid use of undefined type ‘struct pollfd’ 269 | mod_s.fds = malloc(mod_s.nfds * sizeof(mod_s.fds[0])); | ^ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:276:11: error: invalid use of undefined type ‘struct pollfd’ 276 | mod_s.fds[mod_s.nfds - 1].fd = newSd; | ^ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:278:11: error: invalid use of undefined type ‘struct pollfd’ 278 | mod_s.fds[mod_s.nfds - 1].events = POLLIN | POLLOUT; | ^ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:278:37: error: ‘POLLIN’ undeclared (first use in this function) 278 | mod_s.fds[mod_s.nfds - 1].events = POLLIN | POLLOUT; | ^~~~~~ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:278:37: note: each undeclared identifier is reported only once for each function it appears in /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:278:46: error: ‘POLLOUT’ undeclared (first use in this function) 278 | mod_s.fds[mod_s.nfds - 1].events = POLLIN | POLLOUT; | ^~~~~~~ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:284:55: error: invalid use of undefined type ‘struct pollfd’ 284 | qsort(mod_s.fds, (size_t)mod_s.nfds, sizeof(mod_s.fds[0]), cmpfds); | ^ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c: In function ‘isReady’: /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:328:35: error: invalid use of undefined type ‘struct pollfd’ 328 | SOCKET* socket = &mod_s.saved.fds[index].fd; | ^ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:332:22: error: invalid use of undefined type ‘struct pollfd’ 332 | if ((mod_s.saved.fds[index].revents & POLLHUP) || (mod_s.saved.fds[index].revents & POLLNVAL)) | ^ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:332:40: error: ‘POLLHUP’ undeclared (first use in this function) 332 | if ((mod_s.saved.fds[index].revents & POLLHUP) || (mod_s.saved.fds[index].revents & POLLNVAL)) | ^~~~~~~ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:332:68: error: invalid use of undefined type ‘struct pollfd’ 332 | if ((mod_s.saved.fds[index].revents & POLLHUP) || (mod_s.saved.fds[index].revents & POLLNVAL)) | ^ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:332:86: error: ‘POLLNVAL’ undeclared (first use in this function) 332 | if ((mod_s.saved.fds[index].revents & POLLHUP) || (mod_s.saved.fds[index].revents & POLLNVAL)) | ^~~~~~~~ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:335:20: error: invalid use of undefined type ‘struct pollfd’ 335 | (mod_s.saved.fds[index].revents & POLLOUT)) | ^ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:335:38: error: ‘POLLOUT’ undeclared (first use in this function) 335 | (mod_s.saved.fds[index].revents & POLLOUT)) | ^~~~~~~ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:338:24: error: invalid use of undefined type ‘struct pollfd’ 338 | rc = (mod_s.saved.fds[index].revents & POLLIN) && | ^ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:338:42: error: ‘POLLIN’ undeclared (first use in this function) 338 | rc = (mod_s.saved.fds[index].revents & POLLIN) && | ^~~~~~ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:339:21: error: invalid use of undefined type ‘struct pollfd’ 339 | (mod_s.saved.fds[index].revents & POLLOUT) && | ^ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c: In function ‘Socket_getReadySocket’: /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:494:68: error: invalid application of ‘sizeof’ to incomplete type ‘struct pollfd’ 494 | mod_s.saved.fds = realloc(mod_s.saved.fds, mod_s.nfds * sizeof(struct pollfd)); | ^~~~~~ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:496:50: error: invalid application of ‘sizeof’ to incomplete type ‘struct pollfd’ 496 | mod_s.saved.fds = malloc(mod_s.nfds * sizeof(struct pollfd)); | ^~~~~~ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:498:58: error: invalid application of ‘sizeof’ to incomplete type ‘struct pollfd’ 498 | memcpy(mod_s.saved.fds, mod_s.fds, mod_s.nfds * sizeof(struct pollfd)); | ^~~~~~ In file included from /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:31: /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.h:29:14: warning: implicit declaration of function ‘WSAPoll’ [-Wimplicit-function-declaration] 29 | #define poll WSAPoll | ^~~~~~~ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:508:9: note: in expansion of macro ‘poll’ 508 | *rc = poll(mod_s.saved.fds, mod_s.saved.nfds, timeout_ms); | ^~~~ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:543:25: error: invalid use of undefined type ‘struct pollfd’ 543 | sock = mod_s.saved.fds[mod_s.saved.cur_fd].fd; | ^ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c: In function ‘Socket_close’: /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:918:71: error: invalid use of undefined type ‘struct pollfd’ 918 | fd = bsearch(&socket, mod_s.fds, (size_t)mod_s.nfds, sizeof(mod_s.fds[0]), cmpsockfds); | ^ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:921:38: error: invalid use of undefined type ‘struct pollfd’ 921 | struct pollfd* last_fd = &mod_s.fds[mod_s.nfds - 1]; | ^ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:933:20: error: invalid use of undefined type ‘struct pollfd’ 933 | memmove(fd, fd + 1, (mod_s.nfds - (fd - mod_s.fds)) * sizeof(mod_s.fds[0])); | ^ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:933:43: error: arithmetic on pointer to an incomplete type 933 | memmove(fd, fd + 1, (mod_s.nfds - (fd - mod_s.fds)) * sizeof(mod_s.fds[0])); | ^ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:933:75: error: invalid use of undefined type ‘struct pollfd’ 933 | memmove(fd, fd + 1, (mod_s.nfds - (fd - mod_s.fds)) * sizeof(mod_s.fds[0])); | ^ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:935:51: error: invalid use of undefined type ‘struct pollfd’ 935 | mod_s.fds = realloc(mod_s.fds, sizeof(mod_s.fds[0]) * mod_s.nfds); | ^ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c: In function ‘Socket_continueWrites’: /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:1314:90: error: invalid use of undefined type ‘struct pollfd’ 1314 | fd = bsearch(&socket, mod_s.saved.fds, (size_t)mod_s.saved.nfds, sizeof(mod_s.saved.fds[0]), cmpsockfds); | ^ /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:1316:22: error: ‘POLLOUT’ undeclared (first use in this function) 1316 | if ((fd->revents & POLLOUT) && ((rc = Socket_continueWrite(socket)) != 0)) | ^~~~~~~ make[2]: *** [src/CMakeFiles/common_obj_static.dir/build.make:188: src/CMakeFiles/common_obj_static.dir/Socket.c.obj] Erro 1 make[2]: ** Esperando que outros processos terminem. make[1]: *** [CMakeFiles/Makefile2:104: src/CMakeFiles/common_obj_static.dir/all] Erro 2 make: *** [Makefile:156: all] Erro 2 thread 'main' panicked at ' command did not execute successfully, got: exit status: 2 build script failed, must exit now', /home/my_user/.asdf/installs/rust/1.60.0/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.45/src/lib.rs:894:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace warning: build failed, waiting for other jobs to finish... error: build failed ```

With cargo build

~/.asdf/installs/rust/1.60.0/bin/cross build --target x86_64-pc-windows-gnu --release
Error output with cross ```shell Compiling proc-macro2 v1.0.39 Compiling unicode-ident v1.0.1 Compiling syn v1.0.96 Compiling autocfg v1.1.0 Compiling cfg-if v1.0.0 Compiling log v0.4.17 Compiling winapi-x86_64-pc-windows-gnu v0.4.0 Compiling winapi v0.3.9 Compiling smallvec v1.8.0 Compiling windows_x86_64_gnu v0.36.1 Compiling scopeguard v1.1.0 Compiling pin-project-lite v0.2.9 Compiling libc v0.2.126 Compiling khronos_api v3.1.0 Compiling version_check v0.9.4 Compiling parking_lot_core v0.9.3 Compiling once_cell v1.12.0 Compiling ttf-parser v0.15.1 Compiling memchr v2.5.0 Compiling futures-core v0.3.21 Compiling xml-rs v0.8.4 Compiling ab_glyph_rasterizer v0.1.5 Compiling lazy_static v1.4.0 Compiling futures-task v0.3.21 Compiling parking_lot_core v0.8.5 Compiling tinyvec_macros v0.1.0 Compiling futures-channel v0.3.21 Compiling nohash-hasher v0.2.0 Compiling futures-sink v0.3.21 Compiling cc v1.0.73 Compiling matches v0.1.9 Compiling futures-util v0.3.21 Compiling pin-utils v0.1.0 Compiling percent-encoding v2.1.0 Compiling str-buf v1.0.6 Compiling cty v0.2.2 Compiling winit v0.26.1 Compiling slab v0.4.6 Compiling futures-io v0.3.21 Compiling crossbeam-utils v0.8.8 Compiling serde_derive v1.0.137 Compiling unicode-bidi v0.3.8 Compiling cache-padded v1.2.0 Compiling serde v1.0.137 Compiling bitflags v1.3.2 Compiling serde_json v1.0.81 Compiling event-listener v2.5.2 Compiling widestring v0.5.1 Compiling regex-syntax v0.6.26 Compiling glow v0.11.2 Compiling itoa v1.0.2 Compiling futures-timer v3.0.2 Compiling ryu v1.0.10 Compiling getrandom v0.2.7 Compiling instant v0.1.12 Compiling tracing-core v0.1.27 Compiling lock_api v0.4.7 Compiling num-traits v0.2.15 Compiling memoffset v0.6.5 Compiling num-integer v0.1.45 Compiling ahash v0.7.6 Compiling tinyvec v1.6.0 Compiling raw-window-handle v0.4.3 Compiling form_urlencoded v1.0.1 Compiling concurrent-queue v1.2.2 Compiling cmake v0.1.45 Compiling owned_ttf_parser v0.15.0 Compiling windows-sys v0.36.1 Compiling gl_generator v0.14.0 Compiling error-code v2.3.1 Compiling unicode-normalization v0.1.19 Compiling quote v1.0.18 Compiling paho-mqtt-sys v0.7.0 Compiling async-channel v1.6.1 Compiling ab_glyph v0.2.15 Compiling crossbeam-channel v0.5.4 Compiling aho-corasick v0.7.18 Compiling idna v0.2.3 Compiling regex v1.5.6 Compiling parking_lot v0.12.1 Compiling glutin_egl_sys v0.1.5 Compiling glutin_wgl_sys v0.1.5 Compiling url v2.2.2 Compiling clipboard-win v4.4.1 Compiling libloading v0.7.3 Compiling webbrowser v0.7.1 error: failed to run custom build command for `paho-mqtt-sys v0.7.0` Caused by: process didn't exit successfully: `/target/release/build/paho-mqtt-sys-9b3aea11c9bec0db/build-script-build` (exit status: 101) --- stdout debug:Running the bundled build for Paho C debug:Building for Windows cargo:rerun-if-changed=build.rs detected home dir change, cleaning out entire build directory running: "cmake" "/cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/" "-DCMAKE_SYSTEM_NAME=Windows" "-DPAHO_BUILD_SHARED=off" "-DPAHO_BUILD_STATIC=on" "-DPAHO_ENABLE_TESTING=off" "-DPAHO_HIGH_PERFORMANCE=on" "-DPAHO_WITH_SSL=off" "-DCMAKE_INSTALL_PREFIX=/target/x86_64-pc-windows-gnu/release/build/paho-mqtt-sys-f4a6b903351f2e74/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -m64" "-DCMAKE_C_COMPILER=/usr/bin/x86_64-w64-mingw32-gcc-posix" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -m64" "-DCMAKE_CXX_COMPILER=/usr/bin/x86_64-w64-mingw32-g++-posix" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -m64" "-DCMAKE_ASM_COMPILER=/usr/bin/x86_64-w64-mingw32-gcc-posix" "-DCMAKE_BUILD_TYPE=Release" -- The C compiler identification is GNU 7.3.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/x86_64-w64-mingw32-gcc-posix - skipped -- Detecting C compile features -- Detecting C compile features - done -- CMake version: 3.23.1 -- CMake system name: Windows -- Timestamp is 2022-08-12T21:13:11Z -- Configuring done -- Generating done -- Build files have been written to: /target/x86_64-pc-windows-gnu/release/build/paho-mqtt-sys-f4a6b903351f2e74/out/build running: "cmake" "--build" "." "--target" "install" "--config" "Release" "--" [ 3%] Building C object src/CMakeFiles/common_obj_static.dir/MQTTTime.c.obj [ 7%] Building C object src/CMakeFiles/common_obj_static.dir/MQTTProtocolClient.c.obj [ 11%] Building C object src/CMakeFiles/common_obj_static.dir/Clients.c.obj [ 14%] Building C object src/CMakeFiles/common_obj_static.dir/utf-8.c.obj [ 18%] Building C object src/CMakeFiles/common_obj_static.dir/MQTTPacket.c.obj [ 22%] Building C object src/CMakeFiles/common_obj_static.dir/MQTTPacketOut.c.obj [ 25%] Building C object src/CMakeFiles/common_obj_static.dir/Messages.c.obj [ 29%] Building C object src/CMakeFiles/common_obj_static.dir/Tree.c.obj [ 33%] Building C object src/CMakeFiles/common_obj_static.dir/Socket.c.obj src/CMakeFiles/common_obj_static.dir/build.make:187: recipe for target 'src/CMakeFiles/common_obj_static.dir/Socket.c.obj' failed CMakeFiles/Makefile2:103: recipe for target 'src/CMakeFiles/common_obj_static.dir/all' failed Makefile:155: recipe for target 'all' failed --- stderr fatal: not a git repository (or any parent up to mount point /) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set). CMake Warning: Manually-specified variables were not used by the project: CMAKE_ASM_COMPILER CMAKE_ASM_FLAGS CMAKE_CXX_COMPILER CMAKE_CXX_FLAGS /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c: In function 'cmpfds': /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:240:38: error: dereferencing pointer to incomplete type 'struct pollfd' SOCKET key1 = ((struct pollfd*)p1)->fd; ^~ /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c: In function 'Socket_addSocket': /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:267:63: error: invalid use of undefined type 'struct pollfd' mod_s.fds = realloc(mod_s.fds, mod_s.nfds * sizeof(mod_s.fds[0])); ^ /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:269:51: error: invalid use of undefined type 'struct pollfd' mod_s.fds = malloc(mod_s.nfds * sizeof(mod_s.fds[0])); ^ /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:276:11: error: invalid use of undefined type 'struct pollfd' mod_s.fds[mod_s.nfds - 1].fd = newSd; ^ /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:278:11: error: invalid use of undefined type 'struct pollfd' mod_s.fds[mod_s.nfds - 1].events = POLLIN | POLLOUT; ^ /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:278:37: error: 'POLLIN' undeclared (first use in this function); did you mean 'POINT'? mod_s.fds[mod_s.nfds - 1].events = POLLIN | POLLOUT; ^~~~~~ POINT /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:278:37: note: each undeclared identifier is reported only once for each function it appears in /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:278:46: error: 'POLLOUT' undeclared (first use in this function); did you mean 'POLLIN'? mod_s.fds[mod_s.nfds - 1].events = POLLIN | POLLOUT; ^~~~~~~ POLLIN /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:284:55: error: invalid use of undefined type 'struct pollfd' qsort(mod_s.fds, (size_t)mod_s.nfds, sizeof(mod_s.fds[0]), cmpfds); ^ /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c: In function 'isReady': /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:328:35: error: invalid use of undefined type 'struct pollfd' SOCKET* socket = &mod_s.saved.fds[index].fd; ^ /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:332:22: error: invalid use of undefined type 'struct pollfd' if ((mod_s.saved.fds[index].revents & POLLHUP) || (mod_s.saved.fds[index].revents & POLLNVAL)) ^ /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:332:40: error: 'POLLHUP' undeclared (first use in this function) if ((mod_s.saved.fds[index].revents & POLLHUP) || (mod_s.saved.fds[index].revents & POLLNVAL)) ^~~~~~~ /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:332:68: error: invalid use of undefined type 'struct pollfd' if ((mod_s.saved.fds[index].revents & POLLHUP) || (mod_s.saved.fds[index].revents & POLLNVAL)) ^ /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:332:86: error: 'POLLNVAL' undeclared (first use in this function); did you mean 'POLLHUP'? if ((mod_s.saved.fds[index].revents & POLLHUP) || (mod_s.saved.fds[index].revents & POLLNVAL)) ^~~~~~~~ POLLHUP /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:335:20: error: invalid use of undefined type 'struct pollfd' (mod_s.saved.fds[index].revents & POLLOUT)) ^ /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:335:38: error: 'POLLOUT' undeclared (first use in this function); did you mean 'POLLHUP'? (mod_s.saved.fds[index].revents & POLLOUT)) ^~~~~~~ POLLHUP /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:338:24: error: invalid use of undefined type 'struct pollfd' rc = (mod_s.saved.fds[index].revents & POLLIN) && ^ /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:338:42: error: 'POLLIN' undeclared (first use in this function); did you mean 'POLLOUT'? rc = (mod_s.saved.fds[index].revents & POLLIN) && ^~~~~~ POLLOUT /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:339:21: error: invalid use of undefined type 'struct pollfd' (mod_s.saved.fds[index].revents & POLLOUT) && ^ /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c: In function 'Socket_getReadySocket': /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:494:68: error: invalid application of 'sizeof' to incomplete type 'struct pollfd' mod_s.saved.fds = realloc(mod_s.saved.fds, mod_s.nfds * sizeof(struct pollfd)); ^~~~~~ /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:496:50: error: invalid application of 'sizeof' to incomplete type 'struct pollfd' mod_s.saved.fds = malloc(mod_s.nfds * sizeof(struct pollfd)); ^~~~~~ /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:498:58: error: invalid application of 'sizeof' to incomplete type 'struct pollfd' memcpy(mod_s.saved.fds, mod_s.fds, mod_s.nfds * sizeof(struct pollfd)); ^~~~~~ In file included from /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:31:0: /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.h:29:14: warning: implicit declaration of function 'WSAPoll'; did you mean 'WSANtohl'? [-Wimplicit-function-declaration] #define poll WSAPoll ^ /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:508:9: note: in expansion of macro 'poll' *rc = poll(mod_s.saved.fds, mod_s.saved.nfds, timeout_ms); ^~~~ /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:543:25: error: invalid use of undefined type 'struct pollfd' sock = mod_s.saved.fds[mod_s.saved.cur_fd].fd; ^ /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c: In function 'Socket_close': /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:918:71: error: invalid use of undefined type 'struct pollfd' fd = bsearch(&socket, mod_s.fds, (size_t)mod_s.nfds, sizeof(mod_s.fds[0]), cmpsockfds); ^ /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:921:38: error: invalid use of undefined type 'struct pollfd' struct pollfd* last_fd = &mod_s.fds[mod_s.nfds - 1]; ^ /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:933:20: error: invalid use of undefined type 'struct pollfd' memmove(fd, fd + 1, (mod_s.nfds - (fd - mod_s.fds)) * sizeof(mod_s.fds[0])); ^ /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:933:43: error: arithmetic on pointer to an incomplete type memmove(fd, fd + 1, (mod_s.nfds - (fd - mod_s.fds)) * sizeof(mod_s.fds[0])); ^ /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:933:75: error: invalid use of undefined type 'struct pollfd' memmove(fd, fd + 1, (mod_s.nfds - (fd - mod_s.fds)) * sizeof(mod_s.fds[0])); ^ /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:935:51: error: invalid use of undefined type 'struct pollfd' mod_s.fds = realloc(mod_s.fds, sizeof(mod_s.fds[0]) * mod_s.nfds); ^ /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c: In function 'Socket_continueWrites': /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:1314:90: error: invalid use of undefined type 'struct pollfd' fd = bsearch(&socket, mod_s.saved.fds, (size_t)mod_s.saved.nfds, sizeof(mod_s.saved.fds[0]), cmpsockfds); ^ /cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.0/paho.mqtt.c/src/Socket.c:1316:22: error: 'POLLOUT' undeclared (first use in this function); did you mean 'PFLOAT'? if ((fd->revents & POLLOUT) && ((rc = Socket_continueWrite(socket)) != 0)) ^~~~~~~ PFLOAT make[2]: *** [src/CMakeFiles/common_obj_static.dir/Socket.c.obj] Error 1 make[1]: *** [src/CMakeFiles/common_obj_static.dir/all] Error 2 make: *** [all] Error 2 thread 'main' panicked at ' command did not execute successfully, got: exit status: 2 build script failed, must exit now', /cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.45/src/lib.rs:894:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace warning: build failed, waiting for other jobs to finish... error: build failed ```
myhrmans commented 1 year ago

Same issue here

brunoluizkatz-NETZSCH commented 1 year ago

@fpagliughi with release v0.12.0 this was fixed?

fpagliughi commented 1 year ago

Honestly, I have no idea. I've been trying to figure out MinGW on Windows for another open-source C++ library, and am having no luck with it at all!

myhrmans commented 1 year ago

I tried the fix found here without any success. 0.12.0 till uses 0.7.0 but specifying in the cargo.toml file to use 0.7.2 result in this error:


error: failed to run custom build command for `paho-mqtt-sys v0.7.2`

Caused by:
  process didn't exit successfully: `/home/mmyhrman/repos/dd-shell-executer/target/debug/build/paho-mqtt-sys-3be531eb1a7f9d60/build-script-build` (exit status: 101)
  --- stdout
  debug:Running the bundled build for Paho C
  debug:Building for Windows
  cargo:rerun-if-changed=build.rs
  CMAKE_TOOLCHAIN_FILE_x86_64-pc-windows-gnu = None
  CMAKE_TOOLCHAIN_FILE_x86_64_pc_windows_gnu = None
  TARGET_CMAKE_TOOLCHAIN_FILE = None
  CMAKE_TOOLCHAIN_FILE = None
  CMAKE_GENERATOR_x86_64-pc-windows-gnu = None
  CMAKE_GENERATOR_x86_64_pc_windows_gnu = None
  TARGET_CMAKE_GENERATOR = None
  CMAKE_GENERATOR = None
  CMAKE_PREFIX_PATH_x86_64-pc-windows-gnu = None
  CMAKE_PREFIX_PATH_x86_64_pc_windows_gnu = None
  TARGET_CMAKE_PREFIX_PATH = None
  CMAKE_PREFIX_PATH = None
  CMAKE_x86_64-pc-windows-gnu = None
  CMAKE_x86_64_pc_windows_gnu = None
  TARGET_CMAKE = None
  CMAKE = None
  running: "cmake" "/home/mmyhrman/.cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.2/paho.mqtt.c/" "-DCMAKE_RC_COMPILER=/bin/x86_64-w64-mingw32-windres" "-DPAHO_BUILD_SHARED=off" "-DPAHO_BUILD_STATIC=on" "-DPAHO_ENABLE_TESTING=off" "-DPAHO_HIGH_PERFORMANCE=on" "-DPAHO_USE_SELECT=on" "-DPAHO_WITH_SSL=on" "-DOPENSSL_ROOT_DIR=/home/mmyhrman/repos/dd-shell-executer/target/x86_64-pc-windows-gnu/debug/build/openssl-sys-2973f7a70fe01be6/out/openssl-build/install" "-DCMAKE_SYSTEM_NAME=Windows" "-DCMAKE_SYSTEM_PROCESSOR=AMD64" "-DCMAKE_INSTALL_PREFIX=/home/mmyhrman/repos/dd-shell-executer/target/x86_64-pc-windows-gnu/debug/build/paho-mqtt-sys-6b0b6a65e2eb93ce/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -m64" "-DCMAKE_C_COMPILER=/bin/x86_64-w64-mingw32-gcc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -m64" "-DCMAKE_CXX_COMPILER=/bin/x86_64-w64-mingw32-g++" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -m64" "-DCMAKE_ASM_COMPILER=/bin/x86_64-w64-mingw32-gcc" "-DCMAKE_BUILD_TYPE=Debug"
  -- The C compiler identification is GNU 10.0.0
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /bin/x86_64-w64-mingw32-gcc - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- CMake version: 3.22.1
  -- CMake system name: Windows
  -- Timestamp is 2023-01-19T08:24:30Z
  -- Found OpenSSL: /home/mmyhrman/repos/dd-shell-executer/target/x86_64-pc-windows-gnu/debug/build/openssl-sys-2973f7a70fe01be6/out/openssl-build/install/lib/libcrypto.a (found version "1.1.1s")  
  -- Configuring done
  -- Generating done
  -- Build files have been written to: /home/mmyhrman/repos/dd-shell-executer/target/x86_64-pc-windows-gnu/debug/build/paho-mqtt-sys-6b0b6a65e2eb93ce/out/build
  running: "cmake" "--build" "." "--target" "install" "--config" "Debug"
  [  1%] Building C object src/CMakeFiles/common_ssl_obj_static.dir/MQTTTime.c.obj
  [  3%] Building C object src/CMakeFiles/common_ssl_obj_static.dir/MQTTProtocolClient.c.obj
  [  5%] Building C object src/CMakeFiles/common_ssl_obj_static.dir/utf-8.c.obj
  [  7%] Building C object src/CMakeFiles/common_ssl_obj_static.dir/Clients.c.obj
  [  8%] Building C object src/CMakeFiles/common_ssl_obj_static.dir/MQTTPacket.c.obj
  [ 10%] Building C object src/CMakeFiles/common_ssl_obj_static.dir/MQTTPacketOut.c.obj
  [ 12%] Building C object src/CMakeFiles/common_ssl_obj_static.dir/Messages.c.obj
  [ 14%] Building C object src/CMakeFiles/common_obj_static.dir/MQTTTime.c.obj
  [ 16%] Building C object src/CMakeFiles/common_obj_static.dir/MQTTProtocolClient.c.obj
  [ 17%] Building C object src/CMakeFiles/common_ssl_obj_static.dir/Tree.c.obj
  [ 19%] Building C object src/CMakeFiles/common_obj_static.dir/Clients.c.obj
  [ 21%] Building C object src/CMakeFiles/common_ssl_obj_static.dir/Log.c.obj
  [ 23%] Building C object src/CMakeFiles/common_ssl_obj_static.dir/Socket.c.obj
  [ 25%] Building C object src/CMakeFiles/common_ssl_obj_static.dir/MQTTPersistence.c.obj
  [ 26%] Building C object src/CMakeFiles/common_ssl_obj_static.dir/Thread.c.obj
  [ 28%] Building C object src/CMakeFiles/common_ssl_obj_static.dir/MQTTProtocolOut.c.obj
  [ 30%] Building C object src/CMakeFiles/common_ssl_obj_static.dir/MQTTPersistenceDefault.c.obj
  [ 32%] Building C object src/CMakeFiles/common_obj_static.dir/utf-8.c.obj
  [ 33%] Building C object src/CMakeFiles/common_ssl_obj_static.dir/SocketBuffer.c.obj
  [ 35%] Building C object src/CMakeFiles/common_obj_static.dir/MQTTPacket.c.obj
  [ 37%] Building C object src/CMakeFiles/common_ssl_obj_static.dir/LinkedList.c.obj
  [ 39%] Building C object src/CMakeFiles/common_obj_static.dir/MQTTPacketOut.c.obj
  [ 41%] Building C object src/CMakeFiles/common_obj_static.dir/Messages.c.obj
  [ 42%] Building C object src/CMakeFiles/common_obj_static.dir/Tree.c.obj
  [ 44%] Building C object src/CMakeFiles/common_obj_static.dir/Socket.c.obj
  [ 46%] Building C object src/CMakeFiles/common_obj_static.dir/MQTTPersistence.c.obj
  [ 48%] Building C object src/CMakeFiles/common_obj_static.dir/Log.c.obj
  [ 50%] Building C object src/CMakeFiles/common_obj_static.dir/Thread.c.obj
  [ 51%] Building C object src/CMakeFiles/common_obj_static.dir/MQTTProtocolOut.c.obj
  [ 53%] Building C object src/CMakeFiles/common_obj_static.dir/MQTTPersistenceDefault.c.obj
  [ 55%] Building C object src/CMakeFiles/common_obj_static.dir/SocketBuffer.c.obj
  [ 57%] Building C object src/CMakeFiles/common_obj_static.dir/LinkedList.c.obj
  [ 58%] Building C object src/CMakeFiles/common_obj_static.dir/MQTTProperties.c.obj
  [ 60%] Building C object src/CMakeFiles/common_obj_static.dir/MQTTReasonCodes.c.obj

  --- stderr
  fatal: not a git repository (or any of the parent directories): .git
  CMake Warning:
    Manually-specified variables were not used by the project:

      CMAKE_ASM_COMPILER
      CMAKE_ASM_FLAGS
      CMAKE_CXX_COMPILER
      CMAKE_CXX_FLAGS

  /home/mmyhrman/.cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.2/paho.mqtt.c/src/Socket.c:195:5: error: conflicting types for ‘Socket_addSocket’
    195 | int Socket_addSocket(int newSd)
        |     ^~~~~~~~~~~~~~~~
  /home/mmyhrman/.cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.2/paho.mqtt.c/src/Socket.c:56:5: note: previous declaration of ‘Socket_addSocket’ was here
     56 | int Socket_addSocket(SOCKET newSd);
        |     ^~~~~~~~~~~~~~~~
  /home/mmyhrman/.cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.2/paho.mqtt.c/src/Socket.c:356:5: error: conflicting types for ‘Socket_getReadySocket’
    356 | int Socket_getReadySocket(int more_work, int timeout, mutex_type mutex, int* rc)
        |     ^~~~~~~~~~~~~~~~~~~~~
  In file included from /home/mmyhrman/.cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.2/paho.mqtt.c/src/Socket.c:31:
  /home/mmyhrman/.cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.2/paho.mqtt.c/src/Socket.h:139:8: note: previous declaration of ‘Socket_getReadySocket’ was here
    139 | SOCKET Socket_getReadySocket(int more_work, int timeout, mutex_type mutex, int* rc);
        |        ^~~~~~~~~~~~~~~~~~~~~
  gmake[2]: *** [src/CMakeFiles/common_ssl_obj_static.dir/build.make:197: src/CMakeFiles/common_ssl_obj_static.dir/Socket.c.obj] Error 1
  gmake[2]: *** Waiting for unfinished jobs....
  /home/mmyhrman/.cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.2/paho.mqtt.c/src/Socket.c:195:5: error: conflicting types for ‘Socket_addSocket’
    195 | int Socket_addSocket(int newSd)
        |     ^~~~~~~~~~~~~~~~
  /home/mmyhrman/.cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.2/paho.mqtt.c/src/Socket.c:56:5: note: previous declaration of ‘Socket_addSocket’ was here
     56 | int Socket_addSocket(SOCKET newSd);
        |     ^~~~~~~~~~~~~~~~
  /home/mmyhrman/.cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.2/paho.mqtt.c/src/Socket.c:356:5: error: conflicting types for ‘Socket_getReadySocket’
    356 | int Socket_getReadySocket(int more_work, int timeout, mutex_type mutex, int* rc)
        |     ^~~~~~~~~~~~~~~~~~~~~
  In file included from /home/mmyhrman/.cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.2/paho.mqtt.c/src/Socket.c:31:
  /home/mmyhrman/.cargo/registry/src/github.com-1ecc6299db9ec823/paho-mqtt-sys-0.7.2/paho.mqtt.c/src/Socket.h:139:8: note: previous declaration of ‘Socket_getReadySocket’ was here
    139 | SOCKET Socket_getReadySocket(int more_work, int timeout, mutex_type mutex, int* rc);
        |        ^~~~~~~~~~~~~~~~~~~~~
  gmake[2]: *** [src/CMakeFiles/common_obj_static.dir/build.make:188: src/CMakeFiles/common_obj_static.dir/Socket.c.obj] Error 1
  gmake[2]: *** Waiting for unfinished jobs....
  gmake[1]: *** [CMakeFiles/Makefile2:190: src/CMakeFiles/common_ssl_obj_static.dir/all] Error 2
  gmake[1]: *** Waiting for unfinished jobs....
  gmake[1]: *** [CMakeFiles/Makefile2:112: src/CMakeFiles/common_obj_static.dir/all] Error 2
  gmake: *** [Makefile:156: all] Error 2
  thread 'main' panicked at '
  command did not execute successfully, got: exit status: 2

  build script failed, must exit now', /home/mmyhrman/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.49/src/lib.rs:1104:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace```
anselanza commented 1 year ago

What worked for me:

In my library Cargo.toml:

[dependencies]
paho-mqtt = { version = "0.12.1", default-features=false, features=["bundled"] }

In ./cargo/config:

[target.x86_64-pc-windows-gnu]
linker = "x86_64-w64-mingw32-gcc"
ar = "x86_64-w64-mingw32-gcc-ar"

Then cargo build --target=x86_64-pc-windows-gnu appears to succeed.

JosuGZ commented 1 year ago

I'm using cross-rs and I have the same issue.

msdrigg commented 11 months ago

Same issue for me

msdrigg commented 11 months ago

Appears to be related to these two issues.

https://github.com/eclipse/paho.mqtt.cpp/issues/123 https://github.com/eclipse/paho.mqtt.c/issues/1239

As it currently stands, there isn't a cygwin rust target (https://github.com/rust-lang/rust/issues/79854) so were stuck here until paho.mqtt.cpp or rust gets patched

msdrigg commented 11 months ago

For others finding this and not having a solution, I would recommend instead targeting x86_64-pc-window-msvc and using https://github.com/rust-cross/cargo-xwin to do it. That is how I was able to work around this problem

mati865 commented 10 months ago

This doesn't look like Rust issue. Seems like there is a bug in mqtt making it not build with MinGW.