Am on Raspberry PI (Latest version)
Am trying to compile the custom hsm sample.
Running into an issue recognizing libcustom_hsm_example.a
[Command]---------------------------------------------------------
cmake -Duse_prov_client:BOOL=ON -Dhsm_custom_lib="~/azure-iot-sdk-c/cmake/provisioning_client/samples/custom_hsm_example/libcustom_hsm_example.a" .
cmake --build .
[Errror]---------------------------------------------------------
[ 74%] Building C object iothub_client/CMakeFiles/iothub_client.dir/src/blob.c.o
[ 75%] Linking C static library libiothub_client.a
[ 75%] Built target iothub_client
Scanning dependencies of target iothub_convenience_sample
[ 75%] Building C object iothub_client/samples/iothub_convenience_sample/CMakeFiles/iothub_convenience_sample.dir/iothub_convenience_sample.c.o
make[2]: * No rule to make target '/root/azure-iot-sdk-c/cmake/provisioning_client/samples/custom_hsm_example/libcustom_hsm_example.a', needed by 'iothub_client/samples/iothub_convenience_sample/iothub_convenience_sample'. Stop.
make[1]: [CMakeFiles/Makefile2:2201: iothub_client/samples/iothub_convenience_sample/CMakeFiles/iothub_convenience_sample.dir/all] Error 2
make: ** [Makefile:141: all] Error 2
Hi @qzzf1w can you try adding this -> -Dhsm_type_custom=ON to your cmake command?
Same issue
sudo cmake -Duse_prov_client:BOOL=ON -Dhsm_type_custom=ON -Dhsm_custom_lib="~/azure-iot-sdk-c/cmake/provisioning_client/samples/custom_hsm_example/libcustom_hsm_example.a" .
sudo cmake --build .
Running from
pi@raspberrypi:~/azure-iot-sdk-c/cmake
[Error]--------------------
make[2]: * No rule to make target '/root/azure-iot-sdk-c/cmake/provisioning_client/samples/custom_hsm_example/libcustom_hsm_example.a', needed by 'iothub_client/samples/iothub_convenience_sample/iothub_convenience_sample'. Stop.
And one more thing.
All of this works on windows
Okay yea so unfortunately I think the CMake situation could be better here.
TLDR to get you unblocked:
cmake -Duse_prov_client=ON ..
cmake --build .
cmake -Duse_prov_client:BOOL=ON -Dhsm_type_custom=ON -Dhsm_custom_lib="~/azure-iot-sdk-c/cmake/provisioning_client/samples/custom_hsm_example/libcustom_hsm_example.a" .
cmake --build .
Reasoning being the first pass, it will build the custom lib and then the second pass it will link that newly built lib in your solution.
Let me know if that works. I can look to get this to work better on a first pass only but for now that's how it'll work.
EDIT: I ran this on Linux Ubuntu 18.04 and it seemed to work.
I beleive I did two pass but will try again
Stay posted
Here is what I am using (Latest Raspbian build)
Operating System: Raspbian GNU/Linux 10 (buster)
Kernel: Linux 5.4.51+
My precise steps to repro as follows
Same results
[Error]------------------------
[ 74%] Building C object iothub_client/CMakeFiles/iothub_client.dir/src/blob.c.o
[ 75%] Linking C static library libiothub_client.a
[ 75%] Built target iothub_client
Scanning dependencies of target iothub_convenience_sample
[ 75%] Building C object iothub_client/samples/iothub_convenience_sample/CMakeFiles/iothub_convenience_sample.dir/iothub_convenience_sample.c.o
make[2]: * No rule to make target '/root/azure-iot-sdk-c/cmake/provisioning_client/samples/custom_hsm_example/libcustom_hsm_example.a', needed by 'iothub_client/samples/iothub_convenience_sample/iothub_convenience_sample'. Stop.
make[1]: [CMakeFiles/Makefile2:2201: iothub_client/samples/iothub_convenience_sample/CMakeFiles/iothub_convenience_sample.dir/all] Error 2
make: ** [Makefile:141: all] Error 2
Interesting just tried it on a raspberry pi following your exact steps and it worked. One caveat on your list of commands above. What you have as
sudo cmake -Duse_prov_client:BOOL=ON -Dhsm_type_custom=ON -Dhsm_custom_lib="~/azure-iot-sdk-c/cmake/provisioning_client/samples/custom_hsm_example/libcustom_hsm_example.a" .
It's missing a . at the end. It should be ... But otherwise I ran exactly the same thing and it worked.
actually maybe try expanding out the relative path of the custom lib?
That is it ~ resolves to "root" I wanted "home/pi"
Nice! Alright so I'll go ahead and close this for now. Let me know if you want it reopened for any reason.
@danewalton, @qzzf1w, thank you for your contribution to our open-sourced project! Please help us improve by filling out this 2-minute customer satisfaction survey
Great support Dane!
Most helpful comment
Great support Dane!