Azure / azure-event-hubs-c

C client library for Azure Event Hubs https://azure.microsoft.com/services/event-hubs
Other
7 stars 17 forks source link

Building with MinGW on windows #20

Open celsium opened 6 years ago

celsium commented 6 years ago

Hi guys! Building with MinGW on windows will fail with error, because of this code in azure-uamqp-c\CMakeLists.txt: IF(WIN32)

windows needs this define

add_definitions(-D_CRT_SECURE_NO_WARNINGS)
# Make warning as error
add_definitions(/WX)

ELSE()

Make warning as error

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")

ENDIF(WIN32)

And this code in azure-c-shared-utility\CMakeLists.txt: IF(WIN32)

windows needs this define

add_definitions(-D_CRT_SECURE_NO_WARNINGS)
IF(WINCE)
# Don't treat warning as errors for WEC 2013. WEC 2013 uses older compiler version
add_definitions(/WX-)
ELSE()
# Make warning as error
add_definitions(/WX)
ENDIF()

ELSE()

Make warning as error

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")

ENDIF(WIN32)

In both cases you add "/WX" flag to gcc call which is not defined there. I guess there should be one more check for MinGW compiler.

dcristoloveanu commented 6 years ago

Hi @celsium

Thanks for the report. I'll have a look at this and update the CMakelists as needed.

Cheers, /Dan

celsium commented 6 years ago

Hi Dan, can you also take a look on this error. I created handle from 2 strings (eventHubPath is empty string): eventHubClientHandle = EventHubClient_CreateFromConnectionString(connectionString.c_str(), eventHubPath.c_str()); No errors. But when I am trying to send, i have: Error: Time:Tue Oct 17 16:46:59 2017 File:C:\Users\Anton\Downloads\bacnet-stack-master\ports\win32\VS2017\azure-event-hubs-c\eventhub_client\src\eventhubclient.c Func:_EventHubClient_Send Line:444 result = EVENTHUBCLIENT_ERROR Application controller destructor. Error: Time:Tue Oct 17 16:47:00 2017 File:C:\Users\Anton\Downloads\bacnet-stack-master\ports\win32\VS2017\azure-event-hubs-c\azure-uamqp-c\src\amqp_management.c Func:_amqp_management_close Line:885 AMQP management instance not open Error: Time:Tue Oct 17 16:47:00 2017 File:C:\Users\Anton\Downloads\bacnet-stack-master\ports\win32\VS2017\azure-event-hubs-c\eventhub_client\src\eventhubauth.c Func:_OnCBSPutTokenOperationComplete Line:513 CBS reported status code 0, error: (null) for put token operation

Error: Time:Tue Oct 17 16:47:00 2017 File:C:\Users\Anton\Downloads\bacnet-stack-master\ports\win32\VS2017\azure-event-hubs-c\azure-uamqp-c\src\saslclientio.c Func:_saslclientio_send Line:1131 send called while not open Error: Time:Tue Oct 17 16:47:00 2017 File:C:\Users\Anton\Downloads\bacnet-stack-master\ports\win32\VS2017\azure-event-hubs-c\azure-uamqp-c\src\saslclientio.c Func:_saslclientio_close Line:1081 saslclientio_close called while not open Error. Failed to send event data.

What is the reason of this issue?

dcristoloveanu commented 6 years ago

Hi @celsium,

Sorry for the delay. I opened the PR to fix the mingw /Wx issue here: https://github.com/Azure/azure-c-shared-utility/pull/122. This should get in very soon and then I'll update eventhubs-c to use the new build rules.

I'm looking now at your other question on why you would not be able to send.

Cheers, /Dan

dcristoloveanu commented 6 years ago

Hi @celsium

You need to have an eventhub name specified. I quickly ran through the send sample myself now and seems to work as expected when an eventhubname is specified.

image

Is there any reason why you are not passing an eventhubname in the _Create?

Hope this helps, /Dan

celsium commented 6 years ago

Hi Dan! Thank you for reply, yes, its working now with event hub path.

Regards, Anton Kabatskiy.

2017-10-21 7:10 GMT+03:00 Dan Cristoloveanu notifications@github.com:

Hi @celsium https://github.com/celsium

You need to have an eventhub name specified. I quickly ran through the send sample myself now and seems to work as expected when an eventhubname is specified.

[image: Uploading image.png…]

Is there any reason why you are not passing an eventhubname in the _Create?

Hope this helps, /Dan

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Azure/azure-event-hubs-c/issues/20#issuecomment-338362395, or mute the thread https://github.com/notifications/unsubscribe-auth/AHv2CF_OrQmd61Zw_YyjigviBDq79uELks5suW7FgaJpZM4P4joS .