Open phuongtran7 opened 2 years ago
Update: manually cross build the Paho C library then specify the PAHO_MQTT_C_DIR
works. So I guess my issue is now resolved, this issue can be closed. However, I still don't know why when building the C library with bundled
feature, cmake just chooses Windows as build target.
Keep it open for now, and I will see if there's anything I can do in the project to make it work better. If it is a problem with the cmake crate, then there's little we can do other than raise an issue there.
But if there's something to be fixed in, say, build.rs
, then that would be great. There was a recent PR that pointed out some differences between the host and target conditional compilation flags to which I was previously unaware:
https://github.com/eclipse/paho.mqtt.rust/pull/132
Maybe that PR would help. It's been merged into this repo, but hasn't been released yet.
I think that PR did help. I'm using the latest version of the library instead of 0.9.1
. With 0.9.1
even though with the same prebuilt C library and everything, it still failed at:
D:\Projects\test_mqtt_pi>cargo build
Compiling proc-macro2 v1.0.32
Compiling unicode-xid v0.2.2
Compiling syn v1.0.82
Compiling futures-core v0.3.18
Compiling futures-task v0.3.18
Compiling memchr v2.4.1
Compiling futures-channel v0.3.18
Compiling futures-util v0.3.18
Compiling futures-sink v0.3.18
Compiling pin-utils v0.1.0
Compiling slab v0.4.5
Compiling pin-project-lite v0.2.7
Compiling futures-io v0.3.18
Compiling log v0.4.14
Compiling paho-mqtt-sys v0.5.0
Compiling libc v0.2.108
Compiling cfg-if v1.0.0
Compiling futures-timer v3.0.2
Compiling quote v1.0.10
Compiling futures-macro v0.3.18
Compiling thiserror-impl v1.0.30
Compiling thiserror v1.0.30
Compiling futures-executor v0.3.18
Compiling futures v0.3.18
Compiling paho-mqtt v0.9.1
Compiling test_mqtt_pi v0.1.0 (D:\Projects\test_mqtt_pi)
error: linking with `E:/SysGCC_Rust/bin/arm-linux-gnueabihf-gcc.exe` failed: exit code: 1
|
= note: "E:/SysGCC_Rust/bin/arm-linux-gnueabihf-gcc.exe" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\test_mqtt_pi-effdbf6f57c2c7c2.12uialtsmdjredsh.rcgu.o" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\test_mqtt_pi-effdbf6f57c2c7c2.1327j9c7fqqb4kuf.rcgu.o" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\test_mqtt_pi-effdbf6f57c2c7c2.18nkvett0tne1atk.rcgu.o" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\test_mqtt_pi-effdbf6f57c2c7c2.1huepkb4qskhd8jz.rcgu.o" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\test_mqtt_pi-effdbf6f57c2c7c2.20wyqh8mnc6ujhmp.rcgu.o" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\test_mqtt_pi-effdbf6f57c2c7c2.27sritlhc0g6i5yx.rcgu.o" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\test_mqtt_pi-effdbf6f57c2c7c2.2dmot59ic1podsew.rcgu.o" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\test_mqtt_pi-effdbf6f57c2c7c2.34mlzdgv4p1qw90u.rcgu.o" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\test_mqtt_pi-effdbf6f57c2c7c2.3bjpekr3uapk33h.rcgu.o" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\test_mqtt_pi-effdbf6f57c2c7c2.3e7wt1nueafsn8w.rcgu.o" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\test_mqtt_pi-effdbf6f57c2c7c2.433u9yc8n5flnr74.rcgu.o" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\test_mqtt_pi-effdbf6f57c2c7c2.44x1qgl5467fdxhz.rcgu.o" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\test_mqtt_pi-effdbf6f57c2c7c2.481gh9xp69db8u5w.rcgu.o" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\test_mqtt_pi-effdbf6f57c2c7c2.4ajhl6ux9jniqyzr.rcgu.o" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\test_mqtt_pi-effdbf6f57c2c7c2.4io23y1b4r7lvjrs.rcgu.o" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\test_mqtt_pi-effdbf6f57c2c7c2.4kj1fwxqfaqco7r9.rcgu.o" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\test_mqtt_pi-effdbf6f57c2c7c2.4wxvbv148k8ydr20.rcgu.o" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\test_mqtt_pi-effdbf6f57c2c7c2.57z9gido5sel7gdg.rcgu.o" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\test_mqtt_pi-effdbf6f57c2c7c2.5glrh8qaq93etktn.rcgu.o" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\test_mqtt_pi-effdbf6f57c2c7c2.lbyf5dt776hafpj.rcgu.o" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\test_mqtt_pi-effdbf6f57c2c7c2.qdlih0w3ih4ttp7.rcgu.o" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\test_mqtt_pi-effdbf6f57c2c7c2.sf8i3a7wb3hg3ws.rcgu.o" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\test_mqtt_pi-effdbf6f57c2c7c2.4wmxahbx4eq2uvx7.rcgu.o"
"-Wl,--as-needed" "-L" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps" "-L" "D:\\Projects\\test_mqtt_pi\\target\\debug\\deps" "-L" "C:\\Users\\Developer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\arm-unknown-linux-gnueabihf\\lib" "-Wl,-Bstatic" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\libpaho_mqtt-94700c1932309a33.rlib" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\libthiserror-0d4b6d018d803251.rlib" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\liblibc-e5de0aa2b62870d3.rlib" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\libfutures_timer-97708a0c50b2e549.rlib" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\libpaho_mqtt_sys-693f71945bc953cd.rlib" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\liblog-ec34688fc5833219.rlib" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\libcfg_if-98b69e9d69964be9.rlib" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\libfutures-91ef59c916501ef3.rlib" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\libfutures_executor-925a839306dd61bc.rlib" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\libfutures_util-0dda65a88e80b07f.rlib" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\libmemchr-2fb908f53ebcdcb0.rlib" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\libfutures_io-ac637835941981b3.rlib" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\libslab-0af7eb2c9c1e140a.rlib" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\libfutures_channel-889024daeac9a169.rlib" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\libpin_project_lite-a913a0b7d164344f.rlib" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\libfutures_sink-125081e99ad7c7c9.rlib" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\libfutures_task-93dc3c3a2a0ade18.rlib" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\libpin_utils-f3a049a11b87a3f5.rlib" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\libfutures_core-62b5b94beeab9f73.rlib" "-Wl,--start-group" "C:\\Users\\Developer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\arm-unknown-linux-gnueabihf\\lib\\libstd-f58fe94e9ec8d7fb.rlib" "C:\\Users\\Developer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\arm-unknown-linux-gnueabihf\\lib\\libpanic_unwind-43bc522698bd189c.rlib" "C:\\Users\\Developer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\arm-unknown-linux-gnueabihf\\lib\\libminiz_oxide-8f9850cb65949231.rlib" "C:\\Users\\Developer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\arm-unknown-linux-gnueabihf\\lib\\libadler-6cc4832b7a1eae3e.rlib" "C:\\Users\\Developer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\arm-unknown-linux-gnueabihf\\lib\\libobject-a82e5f3b2e4ca837.rlib" "C:\\Users\\Developer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\arm-unknown-linux-gnueabihf\\lib\\libmemchr-ba6dfbe7817b3573.rlib" "C:\\Users\\Developer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\arm-unknown-linux-gnueabihf\\lib\\libaddr2line-62c99721bb996733.rlib" "C:\\Users\\Developer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\arm-unknown-linux-gnueabihf\\lib\\libgimli-a1242e2ec047e5ae.rlib" "C:\\Users\\Developer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\arm-unknown-linux-gnueabihf\\lib\\libstd_detect-04794ae6f7de53ce.rlib" "C:\\Users\\Developer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\arm-unknown-linux-gnueabihf\\lib\\librustc_demangle-381557d1520525da.rlib" "C:\\Users\\Developer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\arm-unknown-linux-gnueabihf\\lib\\libhashbrown-1646840e04e6ac5f.rlib" "C:\\Users\\Developer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\arm-unknown-linux-gnueabihf\\lib\\librustc_std_workspace_alloc-a990377a4b417cc7.rlib" "C:\\Users\\Developer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\arm-unknown-linux-gnueabihf\\lib\\libunwind-f0f6877ff5c911e0.rlib" "C:\\Users\\Developer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\arm-unknown-linux-gnueabihf\\lib\\libcfg_if-d98976420142c959.rlib" "C:\\Users\\Developer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\arm-unknown-linux-gnueabihf\\lib\\liblibc-6d9d9a55243b9341.rlib" "C:\\Users\\Developer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\arm-unknown-linux-gnueabihf\\lib\\liballoc-41f94bbd9fddffcf.rlib" "C:\\Users\\Developer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\arm-unknown-linux-gnueabihf\\lib\\librustc_std_workspace_core-e1f6047e4fc2463b.rlib" "C:\\Users\\Developer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\arm-unknown-linux-gnueabihf\\lib\\libcore-8d8d4c015f5e0b13.rlib" "-Wl,--end-group" "C:\\Users\\Developer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\arm-unknown-linux-gnueabihf\\lib\\libcompiler_builtins-918b2241e6f7753d.rlib" "-Wl,-Bdynamic" "-lpaho-mqtt3a-static" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "C:\\Users\\Developer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\arm-unknown-linux-gnueabihf\\lib" "-o" "D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\deps\\test_mqtt_pi-effdbf6f57c2c7c2" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs"
= note: e:/sysgcc_rust/bin/../lib/gcc/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld.exe: cannot find -lpaho-mqtt3a-static
collect2.exe: error: ld returned 1 exit status
warning: `test_mqtt_pi` (bin "test_mqtt_pi") generated 2 warnings
error: could not compile `test_mqtt_pi` due to previous error; 2 warnings emitted
D:\Projects\test_mqtt_pi>
With latest commit, it worked. So this might be a bug in the cmake
or something it looks like.
Just to add to this - I couldn't get v0.9.1 to cross-compile on linux -> w64 even with a custom cmake toolchain file.
Changing to use paho_mqtt
from git d3280b3 solved all my problems, and no cmake toolchain file or strange environment variables were needed - I just needed to specify the --target
in the cargo build command. Easy.
Thanks!
Yeah, I wonder if this was fixed by #132
I'll mark this as "fix added," under that assumption, and look to make some tests to confirm.
Still doesn't work for me in Windows unfortunately,
This is my Cargo.toml
:
paho-mqtt = { git = "https://github.com/eclipse/paho.mqtt.rust", features = ["bundled"], default-features = false }
And the result is still the same where cmake choose MSVC instead of GCC
PS D:\Projects\test_mqtt_pi> cargo clean
PS D:\Projects\test_mqtt_pi> cargo build
Updating git repository `https://github.com/eclipse/paho.mqtt.rust`
Updating git submodule `https://github.com/eclipse/paho.mqtt.c.git`
Updating crates.io index
Compiling proc-macro2 v1.0.32
Compiling unicode-xid v0.2.2
Compiling syn v1.0.82
Compiling futures-core v0.3.18
Compiling futures-channel v0.3.18
Compiling futures-task v0.3.18
Compiling memchr v2.4.1
Compiling cc v1.0.72
Compiling futures-util v0.3.18
Compiling futures-sink v0.3.18
Compiling pin-project-lite v0.2.7
Compiling crossbeam-utils v0.8.5
Compiling slab v0.4.5
Compiling futures-io v0.3.18
Compiling cfg-if v1.0.0
Compiling pin-utils v0.1.0
Compiling log v0.4.14
Compiling libc v0.2.108
Compiling cache-padded v1.1.1
Compiling lazy_static v1.4.0
Compiling event-listener v2.5.1
Compiling futures-timer v3.0.2
Compiling concurrent-queue v1.2.2
Compiling cmake v0.1.45
Compiling async-channel v1.6.1
Compiling crossbeam-channel v0.5.1
Compiling quote v1.0.10
Compiling paho-mqtt-sys v0.5.0 (https://github.com/eclipse/paho.mqtt.rust#cb09861a)
Compiling futures-macro v0.3.18
Compiling thiserror-impl v1.0.30
Compiling thiserror v1.0.30
Compiling futures-executor v0.3.18
Compiling futures v0.3.18
error: failed to run custom build command for `paho-mqtt-sys v0.5.0 (https://github.com/eclipse/paho.mqtt.rust#cb09861a)`
Caused by:
process didn't exit successfully: `D:\Projects\test_mqtt_pi\target\debug\build\paho-mqtt-sys-c8e01c5d8c280805\build-script-build` (exit code: 103)
--- stdout
debug:Running the bundled build for Paho C
cargo:rerun-if-changed=build.rs
running: "cmake" "C:\\Users\\Developer\\.cargo\\git\\checkouts\\paho.mqtt.rust-44b07fd42c95bba6\\cb09861\\paho-mqtt-sys\\paho.mqtt.c/" "-DPAHO_BUILD_SHARED=off" "-DPAHO_BUILD_STATIC=on" "-DPAHO_ENABLE_TESTING=off" "-DPAHO_HIGH_PERFORMANCE=on" "-DPAHO_WITH_SSL=off" "-DCMAKE_INSTALL_PREFIX=D:\\Projects\\test_mqtt_pi\\target\\arm-unknown-linux-gnueabihf\\debug\\build\\paho-mqtt-sys-d8fb792bd3f40a23\\out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -march=armv6 -marm -mfpu=vfp" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -march=armv6 -marm -mfpu=vfp" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -march=armv6 -marm -mfpu=vfp" "-DCMAKE_BUILD_TYPE=Debug"
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.19042.
-- The C compiler identification is MSVC 19.29.30138.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- CMake version: 3.17.2
-- CMake system name: Windows
-- Timestamp is 2022-01-18T15:15:17Z
-- Configuring done
-- Generating done
-- Build files have been written to: D:/Projects/test_mqtt_pi/target/arm-unknown-linux-gnueabihf/debug/build/paho-mqtt-sys-d8fb792bd3f40a23/out/build
running: "cmake" "--build" "." "--target" "install" "--config" "Debug" "--"
Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Checking Build System
Building Custom Rule C:/Users/Developer/.cargo/git/checkouts/paho.mqtt.rust-44b07fd42c95bba6/cb09861/paho-mqtt-sys/paho.mqtt.c/src/CMakeLists.txt
cl : command line warning D9002: ignoring unknown option '-ffunction-sections' [D:\Projects\test_mqtt_pi\target\arm-unknown-linux-gnueabihf\debug\build\paho-mqtt-sys-d8fb792bd3f40a23\out\build\src\common_obj_static.vcxproj]
MQTTTime.c
cl : command line warning D9002: ignoring unknown option '-fdata-sections' [D:\Projects\test_mqtt_pi\target\arm-unknown-linux-gnueabihf\debug\build\paho-mqtt-sys-d8fb792bd3f40a23\out\build\src\common_obj_static.vcxproj]
cl : command line warning D9002: ignoring unknown option '-fPIC' [D:\Projects\test_mqtt_pi\target\arm-unknown-linux-gnueabihf\debug\build\paho-mqtt-sys-d8fb792bd3f40a23\out\build\src\common_obj_static.vcxproj]
cl : command line warning D9002: ignoring unknown option '-march=armv6' [D:\Projects\test_mqtt_pi\target\arm-unknown-linux-gnueabihf\debug\build\paho-mqtt-sys-d8fb792bd3f40a23\out\build\src\common_obj_static.vcxproj]
cl : command line warning D9002: ignoring unknown option '-marm' [D:\Projects\test_mqtt_pi\target\arm-unknown-linux-gnueabihf\debug\build\paho-mqtt-sys-d8fb792bd3f40a23\out\build\src\common_obj_static.vcxproj]
cl : command line warning D9002: ignoring unknown option '-mfpu=vfp' [D:\Projects\test_mqtt_pi\target\arm-unknown-linux-gnueabihf\debug\build\paho-mqtt-sys-d8fb792bd3f40a23\out\build\src\common_obj_static.vcxproj]
MQTTProtocolClient.c
Clients.c
utf-8.c
MQTTPacket.c
MQTTPacketOut.c
Messages.c
Tree.c
Socket.c
Log.c
MQTTPersistence.c
Thread.c
MQTTProtocolOut.c
MQTTPersistenceDefault.c
SocketBuffer.c
LinkedList.c
MQTTProperties.c
MQTTReasonCodes.c
Base64.c
SHA1.c
Generating Code...
Compiling...
WebSocket.c
Generating Code...
common_obj_static.vcxproj -> D:\Projects\test_mqtt_pi\target\arm-unknown-linux-gnueabihf\debug\build\paho-mqtt-sys-d8fb792bd3f40a23\out\build\src\common_obj_static.dir\Debug\common_obj_static.lib
Building Custom Rule C:/Users/Developer/.cargo/git/checkouts/paho.mqtt.rust-44b07fd42c95bba6/cb09861/paho-mqtt-sys/paho.mqtt.c/src/CMakeLists.txt
cl : command line warning D9002: ignoring unknown option '-ffunction-sections' [D:\Projects\test_mqtt_pi\target\arm-unknown-linux-gnueabihf\debug\build\paho-mqtt-sys-d8fb792bd3f40a23\out\build\src\paho-mqtt3a-static.vcxproj]
cl : command line warning D9002: ignoring unknown option '-fdata-sections' [D:\Projects\test_mqtt_pi\target\arm-unknown-linux-gnueabihf\debug\build\paho-mqtt-sys-d8fb792bd3f40a23\out\build\src\paho-mqtt3a-static.vcxproj]
cl : command line warning D9002: ignoring unknown option '-fPIC' [D:\Projects\test_mqtt_pi\target\arm-unknown-linux-gnueabihf\debug\build\paho-mqtt-sys-d8fb792bd3f40a23\out\build\src\paho-mqtt3a-static.vcxproj]
cl : command line warning D9002: ignoring unknown option '-march=armv6' [D:\Projects\test_mqtt_pi\target\arm-unknown-linux-gnueabihf\debug\build\paho-mqtt-sys-d8fb792bd3f40a23\out\build\src\paho-mqtt3a-static.vcxproj]
cl : command line warning D9002: ignoring unknown option '-marm' [D:\Projects\test_mqtt_pi\target\arm-unknown-linux-gnueabihf\debug\build\paho-mqtt-sys-d8fb792bd3f40a23\out\build\src\paho-mqtt3a-static.vcxproj]
cl : command line warning D9002: ignoring unknown option '-mfpu=vfp' [D:\Projects\test_mqtt_pi\target\arm-unknown-linux-gnueabihf\debug\build\paho-mqtt-sys-d8fb792bd3f40a23\out\build\src\paho-mqtt3a-static.vcxproj]
MQTTAsync.c
MQTTAsyncUtils.c
Generating Code...
paho-mqtt3a-static.vcxproj -> D:\Projects\test_mqtt_pi\target\arm-unknown-linux-gnueabihf\debug\build\paho-mqtt-sys-d8fb792bd3f40a23\out\build\src\Debug\paho-mqtt3a-static.lib
Building Custom Rule C:/Users/Developer/.cargo/git/checkouts/paho.mqtt.rust-44b07fd42c95bba6/cb09861/paho-mqtt-sys/paho.mqtt.c/src/CMakeLists.txt
cl : command line warning D9002: ignoring unknown option '-ffunction-sections' [D:\Projects\test_mqtt_pi\target\arm-unknown-linux-gnueabihf\debug\build\paho-mqtt-sys-d8fb792bd3f40a23\out\build\src\paho-mqtt3c-static.vcxproj]
cl : command line warning D9002: ignoring unknown option '-fdata-sections' [D:\Projects\test_mqtt_pi\target\arm-unknown-linux-gnueabihf\debug\build\paho-mqtt-sys-d8fb792bd3f40a23\out\build\src\paho-mqtt3c-static.vcxproj]
cl : command line warning D9002: ignoring unknown option '-fPIC' [D:\Projects\test_mqtt_pi\target\arm-unknown-linux-gnueabihf\debug\build\paho-mqtt-sys-d8fb792bd3f40a23\out\build\src\paho-mqtt3c-static.vcxproj]
cl : command line warning D9002: ignoring unknown option '-march=armv6' [D:\Projects\test_mqtt_pi\target\arm-unknown-linux-gnueabihf\debug\build\paho-mqtt-sys-d8fb792bd3f40a23\out\build\src\paho-mqtt3c-static.vcxproj]
cl : command line warning D9002: ignoring unknown option '-marm' [D:\Projects\test_mqtt_pi\target\arm-unknown-linux-gnueabihf\debug\build\paho-mqtt-sys-d8fb792bd3f40a23\out\build\src\paho-mqtt3c-static.vcxproj]
cl : command line warning D9002: ignoring unknown option '-mfpu=vfp' [D:\Projects\test_mqtt_pi\target\arm-unknown-linux-gnueabihf\debug\build\paho-mqtt-sys-d8fb792bd3f40a23\out\build\src\paho-mqtt3c-static.vcxproj]
MQTTClient.c
paho-mqtt3c-static.vcxproj -> D:\Projects\test_mqtt_pi\target\arm-unknown-linux-gnueabihf\debug\build\paho-mqtt-sys-d8fb792bd3f40a23\out\build\src\Debug\paho-mqtt3c-static.lib
Building Custom Rule C:/Users/Developer/.cargo/git/checkouts/paho.mqtt.rust-44b07fd42c95bba6/cb09861/paho-mqtt-sys/paho.mqtt.c/CMakeLists.txt
-- Install configuration: "Debug"
-- Installing: D:/Projects/test_mqtt_pi/target/arm-unknown-linux-gnueabihf/debug/build/paho-mqtt-sys-d8fb792bd3f40a23/out/share/doc/Eclipse Paho C/samples/MQTTAsync_publish.c
-- Installing: D:/Projects/test_mqtt_pi/target/arm-unknown-linux-gnueabihf/debug/build/paho-mqtt-sys-d8fb792bd3f40a23/out/share/doc/Eclipse Paho C/samples/MQTTAsync_publish_time.c
-- Installing: D:/Projects/test_mqtt_pi/target/arm-unknown-linux-gnueabihf/debug/build/paho-mqtt-sys-d8fb792bd3f40a23/out/share/doc/Eclipse Paho C/samples/MQTTAsync_subscribe.c
-- Installing: D:/Projects/test_mqtt_pi/target/arm-unknown-linux-gnueabihf/debug/build/paho-mqtt-sys-d8fb792bd3f40a23/out/share/doc/Eclipse Paho C/samples/MQTTClient_publish.c
-- Installing: D:/Projects/test_mqtt_pi/target/arm-unknown-linux-gnueabihf/debug/build/paho-mqtt-sys-d8fb792bd3f40a23/out/share/doc/Eclipse Paho C/samples/MQTTClient_publish_async.c
-- Installing: D:/Projects/test_mqtt_pi/target/arm-unknown-linux-gnueabihf/debug/build/paho-mqtt-sys-d8fb792bd3f40a23/out/share/doc/Eclipse Paho C/samples/MQTTClient_subscribe.c
-- Installing: D:/Projects/test_mqtt_pi/target/arm-unknown-linux-gnueabihf/debug/build/paho-mqtt-sys-d8fb792bd3f40a23/out/share/doc/Eclipse Paho C/samples/paho_c_pub.c
-- Installing: D:/Projects/test_mqtt_pi/target/arm-unknown-linux-gnueabihf/debug/build/paho-mqtt-sys-d8fb792bd3f40a23/out/share/doc/Eclipse Paho C/samples/paho_c_sub.c
-- Installing: D:/Projects/test_mqtt_pi/target/arm-unknown-linux-gnueabihf/debug/build/paho-mqtt-sys-d8fb792bd3f40a23/out/share/doc/Eclipse Paho C/samples/paho_cs_pub.c
-- Installing: D:/Projects/test_mqtt_pi/target/arm-unknown-linux-gnueabihf/debug/build/paho-mqtt-sys-d8fb792bd3f40a23/out/share/doc/Eclipse Paho C/samples/paho_cs_sub.c
-- Installing: D:/Projects/test_mqtt_pi/target/arm-unknown-linux-gnueabihf/debug/build/paho-mqtt-sys-d8fb792bd3f40a23/out/share/doc/Eclipse Paho C/samples/pubsub_opts.c
-- Installing: D:/Projects/test_mqtt_pi/target/arm-unknown-linux-gnueabihf/debug/build/paho-mqtt-sys-d8fb792bd3f40a23/out/share/doc/Eclipse Paho C/CONTRIBUTING.md
-- Installing: D:/Projects/test_mqtt_pi/target/arm-unknown-linux-gnueabihf/debug/build/paho-mqtt-sys-d8fb792bd3f40a23/out/share/doc/Eclipse Paho C/epl-v20
-- Installing: D:/Projects/test_mqtt_pi/target/arm-unknown-linux-gnueabihf/debug/build/paho-mqtt-sys-d8fb792bd3f40a23/out/share/doc/Eclipse Paho C/edl-v10
-- Installing: D:/Projects/test_mqtt_pi/target/arm-unknown-linux-gnueabihf/debug/build/paho-mqtt-sys-d8fb792bd3f40a23/out/share/doc/Eclipse Paho C/README.md
-- Installing: D:/Projects/test_mqtt_pi/target/arm-unknown-linux-gnueabihf/debug/build/paho-mqtt-sys-d8fb792bd3f40a23/out/share/doc/Eclipse Paho C/notice.html
-- Installing: D:/Projects/test_mqtt_pi/target/arm-unknown-linux-gnueabihf/debug/build/paho-mqtt-sys-d8fb792bd3f40a23/out/lib/paho-mqtt3c-static.lib
-- Installing: D:/Projects/test_mqtt_pi/target/arm-unknown-linux-gnueabihf/debug/build/paho-mqtt-sys-d8fb792bd3f40a23/out/lib/paho-mqtt3a-static.lib
-- Installing: D:/Projects/test_mqtt_pi/target/arm-unknown-linux-gnueabihf/debug/build/paho-mqtt-sys-d8fb792bd3f40a23/out/include/MQTTAsync.h
-- Installing: D:/Projects/test_mqtt_pi/target/arm-unknown-linux-gnueabihf/debug/build/paho-mqtt-sys-d8fb792bd3f40a23/out/include/MQTTClient.h
-- Installing: D:/Projects/test_mqtt_pi/target/arm-unknown-linux-gnueabihf/debug/build/paho-mqtt-sys-d8fb792bd3f40a23/out/include/MQTTClientPersistence.h
-- Installing: D:/Projects/test_mqtt_pi/target/arm-unknown-linux-gnueabihf/debug/build/paho-mqtt-sys-d8fb792bd3f40a23/out/include/MQTTProperties.h
-- Installing: D:/Projects/test_mqtt_pi/target/arm-unknown-linux-gnueabihf/debug/build/paho-mqtt-sys-d8fb792bd3f40a23/out/include/MQTTReasonCodes.h
-- Installing: D:/Projects/test_mqtt_pi/target/arm-unknown-linux-gnueabihf/debug/build/paho-mqtt-sys-d8fb792bd3f40a23/out/include/MQTTSubscribeOpts.h
-- Installing: D:/Projects/test_mqtt_pi/target/arm-unknown-linux-gnueabihf/debug/build/paho-mqtt-sys-d8fb792bd3f40a23/out/include/MQTTExportDeclarations.h
-- Installing: D:/Projects/test_mqtt_pi/target/arm-unknown-linux-gnueabihf/debug/build/paho-mqtt-sys-d8fb792bd3f40a23/out/lib/cmake/eclipse-paho-mqtt-c/eclipse-paho-mqtt-cConfig.cmake
-- Installing: D:/Projects/test_mqtt_pi/target/arm-unknown-linux-gnueabihf/debug/build/paho-mqtt-sys-d8fb792bd3f40a23/out/lib/cmake/eclipse-paho-mqtt-c/eclipse-paho-mqtt-cConfig-debug.cmake
-- Installing: D:/Projects/test_mqtt_pi/target/arm-unknown-linux-gnueabihf/debug/build/paho-mqtt-sys-d8fb792bd3f40a23/out/lib/cmake/eclipse-paho-mqtt-c/eclipse-paho-mqtt-cConfigVersion.cmake
cargo:root=D:\Projects\test_mqtt_pi\target\arm-unknown-linux-gnueabihf\debug\build\paho-mqtt-sys-d8fb792bd3f40a23\out
debug:CMake output dir: D:\Projects\test_mqtt_pi\target\arm-unknown-linux-gnueabihf\debug\build\paho-mqtt-sys-d8fb792bd3f40a23\out
debug:link Using non-SSL library
Error building Paho C library.
--- stderr
CMake Warning:
Manually-specified variables were not used by the project:
CMAKE_ASM_FLAGS
CMAKE_BUILD_TYPE
CMAKE_CXX_FLAGS
PS D:\Projects\test_mqtt_pi>
Sorry I keep pushing this back; I don't generally have a Windows machine for development. But I'm starting to wonder if there's something about the CMake crate where it doesn't recognize 'target' specified in the config file vs '--target' on the command line.
Same here, until the other week 😃 I just bought a Windows laptop for my son, so I can try to give it a spin on that one.
Maybe tonight, but more likely comming Monday (as I'm home alone then anyway 😉)
I did have a look, but didn't have enough time to find a working solution. Will continue with it later this week...
Hi,
I'm trying to cross-compile the library from Windows to a Raspberry Pi Zero W. I can't use
cross
as there are currently some problem targeting the Zero (https://github.com/rust-embedded/cross/issues/426). So I'm using a prebuilt toolchain from GNU Toolchain and a simple.cargo/config
file like this:Everything works great until it needs to compile the Paho MQTT C library. It seems that CMake for some reason, chooses Windows as target instead of the one specified in the config file. And that makes the whole build failed.
I'm thinking about cross-compiling the C library manually then set the
PAHO_MQTT_C_DIR
to the directory where the C library. Would that work?Thank you so much for your time and help.