Azure / azure-iot-sdk-c

A C99 SDK for connecting devices to Microsoft Azure IoT services
https://azure.github.io/azure-iot-sdk-c
Other
587 stars 739 forks source link

In function ‘get_target_mac_address’ error: storage size of ‘ifr’ isn’t known struct ifreq ifr; #206

Closed taroyutao closed 7 years ago

taroyutao commented 7 years ago

https://github.com/Azure/azure-iot-device-ecosystem/blob/master/iotcertification/iot_certification_linux_c/iot_certification_linux_c.md

step by stey ,but when i run:sudo ./azure-iot-sdk-c/build_all/linux/build.sh --run-e2e-tests | tee LogFile.txt

Ubuntu14.04 gcc 4.9.4

git clone -b 2017-06-30 --recursive https://github.com/Azure/azure-iot-sdk-c.git

Description of the issue:

Code sample exhibiting the issue:

Console log of the issue:

[ 85%] Building C object iothub_client/tests/iothubclient_mqtt_e2e/CMakeFiles/iothubclient_mqtt_e2e_exe.dir/__/common_e2e/iothubclient_common_e2e.c.o /root/azure-iot-sdk-c/iothub_client/tests/common_e2e/iothubclient_common_e2e.c: In function ‘get_target_mac_address’: /root/azure-iot-sdk-c/iothub_client/tests/common_e2e/iothubclient_common_e2e.c:356:22: error: storage size of ‘ifr’ isn’t known struct ifreq ifr; ^ /root/azure-iot-sdk-c/iothub_client/tests/common_e2e/iothubclient_common_e2e.c:357:23: error: storage size of ‘ifc’ isn’t known struct ifconf ifc; ^ /root/azure-iot-sdk-c/iothub_client/tests/common_e2e/iothubclient_common_e2e.c:371:72: error: invalid application of ‘sizeof’ to incomplete type ‘struct ifreq’ const struct ifreq* const end = it + (ifc.ifc_len / sizeof(struct ifreq)); ^ /root/azure-iot-sdk-c/iothub_client/tests/common_e2e/iothubclient_common_e2e.c:375:31: error: increment of pointer to unknown structure for (; it != end; ++it) ^ /root/azure-iot-sdk-c/iothub_client/tests/common_e2e/iothubclient_common_e2e.c:375:13: error: arithmetic on pointer to an incomplete type for (; it != end; ++it) ^ /root/azure-iot-sdk-c/iothub_client/tests/common_e2e/iothubclient_common_e2e.c:377:40: error: dereferencing pointer to incomplete type strcpy(ifr.ifr_name, it->ifr_name); ^ make[2]: [iothub_client/tests/iothubclient_mqtt_e2e/CMakeFiles/iothubclient_mqtt_e2e_exe.dir/__/common_e2e/iothubclient_common_e2e.c.o] Error 1 make[1]: [iothub_client/tests/iothubclient_mqtt_e2e/CMakeFiles/iothubclient_mqtt_e2e_exe.dir/all] Error 2 make: *** [all] Error 2

beyondhong commented 7 years ago

add these to fix

include <sys/socket.h>

include <linux/if.h>

taroyutao commented 7 years ago

thanks for your help. when I run Run the sample by issuing following command lonely such as:~/azure-iot-sdk-c/cmake/iotsdk_linux/iothub_client/samples/iothub_client_sample_amqp/iothub_client_sample_amqp

every this is ok.

But when I run :sudo ./azure-iot-sdk-c/build_all/linux/build.sh --run-e2e-tests | tee LogFile.txt

the error information as followers:

=== Executing test suite iothubclient_mqtt_dt_e2e === Error: Time:Thu Aug 17 05:29:04 2017 File:/root/azure-iot-sdk-c/c-utility/src/tlsio_openssl.c Func:openssl_static_locks_install Line:469 Locks already initialized Error: Time:Thu Aug 17 05:29:04 2017 File:/root/azure-iot-sdk-c/c-utility/src/tlsio_openssl.c Func:tlsio_openssl_init Line:1007 Failed to install static locks in OpenSSL! Error: Time:Thu Aug 17 05:29:04 2017 File:/root/azure-iot-sdk-c/testtools/iothub_test/src/iothub_account.c Func:IoTHubAccount_Init_With_Config Line:537 Failure retrieving x509 certificate from the environment.

Assert failed in line 150: non-NULL expected. TEST_SUITE_INITIALIZE failed - suite ending 0 tests ran, ALL failed, NONE succeeded.

3/8 Test #3: iothubclient_mqtt_e2e .................***Failed 0.03 sec === Executing test suite iothubclient_mqtt_e2e === Error: Time:Thu Aug 17 05:29:04 2017 File:/root/azure-iot-sdk-c/testtools/iothub_test/src/iothub_account.c Func:IoTHubAccount_Init_With_Config Line:537 Failure retrieving x509 certificate from the environment.

Assert failed in line 427: non-NULL expected. Could not initialize IoTHubAccount TEST_SUITE_INITIALIZE failed - suite ending 0 tests ran, ALL failed, NONE succeeded.

need for your help.

markrad commented 7 years ago

Hi @taroyutao,

Why do you want to run the e2e tests? These are designed for internal build testing. You need to set up a lot of environment variables for these to work, such as connection strings, certficates, etc. These are not publicly documented to my knowledge. You would need to examine the code.

Mark Radbourne MSFT

markrad commented 7 years ago

Hi @taroyutao,

I am mistaken. If you wish to run the e2e tests you can find documentation to set them up here: https://github.com/Azure/azure-iot-sdk-c/blob/master/doc/run_end_to_end_tests.md. Typically however, only customers that are certifying their device for Azure IoT Hub would need to run these tests.

Please let me know if you have further questions.

Mark Radbourne MSFT

markrad commented 7 years ago

Hi @taroyutao,

Since I have not heard from you for some time I have closed your issue. You are welcome to reopen it should your problem still persist.

Mark Radbourne MSFT