Azure / iot-edge-v1

Azure IoT Edge
http://azure.github.io/iot-edge/
Other
525 stars 257 forks source link

Build for iot-edge-v1 not able to resolve header files iothub_client_version.h, umock_c_prod.h, gballoc.h ,optimize_size.h #643

Closed amoldixit-Git closed 5 years ago

amoldixit-Git commented 5 years ago

V1 issue Ubuntu 16.04.4 X86_64 After building iot-edge-v1 , following errors are observed in error.txt

/home/ubuntu/Projects/iot-edge-v1/v1/deps/iot-sdk-c/iothub_client/src/version.c:4:0: /home/ubuntu/Projects/iot-edge-v1/v1/deps/iot-sdk-c/iothub_client/inc/iothub_client_version.h:13:49: fatal error: azure_c_shared_utility/umock_c_prod.h: No such file or directory compilation terminated. make[2]: [iothub_client/CMakeFiles/iothub_client_mqtt_ws_transport.dir/src/version.c.o] Error 1 make[1]: [iothub_client/CMakeFiles/iothub_client_mqtt_ws_transport.dir/all] Error 2 make[1]: Waiting for unfinished jobs.... /home/ubuntu/Projects/iot-edge-v1/v1/deps/iot-sdk-c/iothub_service_client/src/iothub_registrymanager.c:6:44: fatal error: azure_c_shared_utility/gballoc.h: No such file or directory compilation terminated. make[2]: [iothub_service_client/CMakeFiles/iothub_service_client.dir/src/iothub_registrymanager.c.o] Error 1 make[2]: Waiting for unfinished jobs.... In file included from /home/ubuntu/Projects/iot-edge-v1/v1/deps/iot-sdk-c/iothub_client/src/version.c:4:0: /home/ubuntu/Projects/iot-edge-v1/v1/deps/iot-sdk-c/iothub_client/inc/iothub_client_version.h:13:49: fatal error: azure_c_shared_utility/umock_c_prod.h: No such file or directory compilation terminated. make[2]: [iothub_client/CMakeFiles/iothub_client_mqtt_transport.dir/src/version.c.o] Error 1 make[2]: Waiting for unfinished jobs.... /home/ubuntu/Projects/iot-edge-v1/v1/deps/iot-sdk-c/iothub_client/src/iothub_client_authorization.c:5:44: fatal error: azure_c_shared_utility/gballoc.h: No such file or directory compilation terminated. make[2]: [iothub_client/CMakeFiles/iothub_client_mqtt_transport.dir/src/iothub_client_authorization.c.o] Error 1 make[1]: [iothub_client/CMakeFiles/iothub_client_mqtt_transport.dir/all] Error 2 In file included from /home/ubuntu/Projects/iot-edge-v1/v1/deps/iot-sdk-c/iothub_client/src/version.c:4:0: /home/ubuntu/Projects/iot-edge-v1/v1/deps/iot-sdk-c/iothub_client/inc/iothub_client_version.h:13:49: fatal error: azure_c_shared_utility/umock_c_prod.h: No such file or directory compilation terminated. /home/ubuntu/Projects/iot-edge-v1/v1/deps/iot-sdk-c/iothub_client/src/iothub_client_authorization.c:5:44: fatal error: azure_c_shared_utility/gballoc.h: No such file or directory compilation terminated. make[2]: [iothub_client/CMakeFiles/iothub_client_amqp_ws_transport.dir/src/version.c.o] Error 1 make[2]: Waiting for unfinished jobs.... make[2]: [iothub_client/CMakeFiles/iothub_client_amqp_ws_transport.dir/src/iothub_client_authorization.c.o] Error 1 /home/ubuntu/Projects/iot-edge-v1/v1/deps/iot-sdk-c/iothub_client/src/iothub_message.c:5:50: fatal error: azure_c_shared_utility/optimize_size.h: No such file or directory compilation terminated. make[2]: [iothub_client/CMakeFiles/iothub_client_amqp_ws_transport.dir/src/iothub_message.c.o] Error 1 make[1]: [iothub_client/CMakeFiles/iothub_client_amqp_ws_transport.dir/all] Error 2 make[1]: [iothub_service_client/CMakeFiles/iothub_service_client.dir/all] Error 2 make: [all] Error 2

Please help

darobs commented 5 years ago

Hello @amoldixit-Git

The most common cause of something like this are the submodules either not initialized or built incorrectly.

amoldixit-Git commented 5 years ago

Thanks @darobs

I verified that the submodules are pulled and are built correctly. But still face the same issue even after trying the --rebuild-deps option in the build.sh.

I pulled the git repo for iot-sdk-c and build it separately which was success. Now using those lib I tried building main project, I got some more errors in proxy/gateway/native

Has anyone tried building the code in ubuntu or any other linux system? Please suggest.

darobs commented 5 years ago

@amoldixit-Git

I was hoping to reproduce your problem:

I created a brand new Ubuntu 16.04 VM. and ran the following commands:

sudo apt-get update
sudo apt-get install curl build-essential libcurl4-openssl-dev git cmake pkg-config libssl-dev uuid-dev valgrind libglib2.0-dev libtool autoconf
git clone https://github.com/Azure/iot-edge-v1.git
cd iot-edge-v1/
v1/tools/build.sh --disable-native-remote-modules

It worked without error for me. :( I also ran build.sh with no arguments and had no trouble.

Are you using the latest (master or thereabouts) release from iothub to build against Gateway V1? There may have been some file reorganization which we have not made changes for.

darobs commented 5 years ago

I was also thinking that you may want to clean everything:

rm -fr iot-edge-v1/build and iot-edge-v1/install-deps git submodule foreach git clean -xdf

and try the build again.

amoldixit-Git commented 5 years ago

Thanks @darobs. We first tried building all the code & the dependent projects using CMake which created loads of header files in /usr/local/. As we faced many dependency issues we shifted to build.sh. But then build.sh was also referring to all the header files in /usr/local.

With your suggestion, we cleaned everything in usr/local, got the fresh copy of gateway code and the run build.sh and it worked well.

Thanks a lot for your help

darobs commented 5 years ago

Thank you for following up. I'm going to close this issue, but if you have additional problems, please reopen or open a new issue.