wolfSSL / wolfMQTT

wolfMQTT is a small, fast, portable MQTT client implementation, including support for TLS 1.3.
https://www.wolfssl.com
GNU General Public License v2.0
518 stars 156 forks source link

showng header file error like no such dictionary #382

Closed Vishal-Birajdar closed 5 months ago

Vishal-Birajdar commented 7 months ago
dgarske commented 7 months ago

@lealem47 can you review this? Seems like they need the include path for Middlewares/Third_Party/wolfSSL_wolfMQTT_wolfMQTT added. In my testing the pack did this automatically.

lealem47 commented 7 months ago

Hi @Vishal-Birajdar, Can you confirm that you are using the wolfMQTT STM32Cube Pack? https://www.wolfssl.com/files/ide/I-CUBE-wolfMQTT.pack

More docs: https://github.com/wolfSSL/wolfMQTT/blob/master/IDE/STM32CUBE/README.md

Thanks, Lealem @ wolfSSL

lealem47 commented 7 months ago

Note: Duplicate of ZD#17181

Vishal-Birajdar commented 7 months ago

@lealem47 can you review this? Seems like they need the include path for Middlewares/Third_Party/wolfSSL_wolfMQTT_wolfMQTT added. In my testing the pack did this automatically.

I am giving direct folder path in library path option in stm32cube ide. this is not path issue, actually " wolfmqtt/mqtt_client.h , wolfmqtt/mqtt_sn_client.h "these three-header file defined or declared in some file but it not available in library.

Vishal-Birajdar commented 7 months ago

Hi @Vishal-Birajdar, Can you confirm that you are using the wolfMQTT STM32Cube Pack? https://www.wolfssl.com/files/ide/I-CUBE-wolfMQTT.pack

More docs: https://github.com/wolfSSL/wolfMQTT/blob/master/IDE/STM32CUBE/README.md

Thanks, Lealem @ wolfSSL

I install pack in stm32cube ide as per document but in software pack then select component there is only wolfSSl otion available not a wolf mqtt Screenshot 2023-12-13 230607

lealem47 commented 7 months ago

Looks like you only have the wolfSSL software pack installed. You can install the wolfMQTT pack following the instructions here https://github.com/wolfSSL/wolfMQTT/blob/master/IDE/STM32CUBE/README.md

Vishal-Birajdar commented 7 months ago

there is no option wolfMQTT. (In stm32cube ide -> .ioc -> software packs -> select components ) Ifollow proper root but there is only wolfssl option check below screenshoot 2023-12-13 230607

lealem47 commented 7 months ago

Vishal,

I understand that it is not listed in your locally available pack list. In order to get it installed and onto that list, follow the documentation at the link I provided. https://github.com/wolfSSL/wolfMQTT/blob/master/IDE/STM32CUBE/README.md

The first few steps are:

Vishal-Birajdar commented 7 months ago

Ok. I added pack now . I will check it tomorrow because of here is mid night now.

Thank you for support Vishal

On Wed, 13 Dec, 2023, 11:42 pm lealem47, @.***> wrote:

Vishal,

I understand that it is not listed in your locally available pack list. In order to get it installed and onto that list, follow the documentation at the link I provided. https://github.com/wolfSSL/wolfMQTT/blob/master/IDE/STM32CUBE/README.md

The first few steps are:

  • Download the pack https://www.wolfssl.com/files/ide/I-CUBE-wolfMQTT.pack.
  • Run the “STM32CubeMX” tool.
  • Under “Manage software installations” pane on the right, click “INSTALL/REMOVE” button.
  • Select From Local and choose the downloaded pack “I-CUBE-wolfMQTT.pack”.
  • Accept the GPLv2 license. Contact wolfSSL at @.*** for a commercial license and support/maintenance.

— Reply to this email directly, view it on GitHub https://github.com/wolfSSL/wolfMQTT/issues/382#issuecomment-1854474765, or unsubscribe https://github.com/notifications/unsubscribe-auth/BEC7WDFOCHLDOA3YQYY7FGTYJHVW7AVCNFSM6AAAAABASQ7MXSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJUGQ3TINZWGU . You are receiving this because you were mentioned.Message ID: @.***>

Vishal-Birajdar commented 7 months ago

Hii, I am using ethernet connetion with LWIP in stm32 and also configure the wolfmqtt with tls enable and lwip enable in IO option. and In example- simplemqtt.c file paste in my main src folder and change broker credential like host,port usename,password. but it not connected to host or broker. what is implemetation step for stm32

lealem47 commented 7 months ago

Hi @Vishal-Birajdar,

and In example- simplemqtt.c file paste in my main src folder

I'm not sure what that means. Can me you tell about your setup? Is the broker expecting TLS? When you say it can't connect, is there an error code that you are seeing?

Can you confirm that you are calling the mqttsimple_test() function?

Thanks, Lealem @ wolfSSL

Vishal-Birajdar commented 6 months ago

problem solved now .

Vishal-Birajdar commented 6 months ago

how can i use 'mqttclient_publish ,netconnect function in my main.c file.(showing error) main.c generated by HAL , if I including wolfmqtt header file in main.c sowing error

lealem47 commented 6 months ago

I'm glad you solved the initial problem. What are the new errors that you are seeing?

To call MqttClient_Publish() from your main function, just add the following include to your main.c.

#include "wolfmqtt/mqtt_client.h"

Attach any relevant logs/errors if the build still fails.

Vishal-Birajdar commented 6 months ago

main.txt Screenshot from 2023-12-23 11-17-51 Screenshot from 2023-12-23 11-18-05 I am copy mqttsimple.c in my main.c file but showing error .

lealem47 commented 6 months ago

It looks like you missed copying some of the includes from mqttsimple.c to main.c. Mainly these ones:

#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <unistd.h>

Also, in main.c you do not have to include userio_template.h if you are using lwIP

Vishal-Birajdar commented 6 months ago

I add this library and call mqttsimple_test() function in main.c . mqttsimple.h add in core-> Inc and mqttsimple.c add in core-> Src. if callin mqttsimple_test showing following error.

/opt/st/stm32cubeide_1.12.1/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.linux64_1.0.200.202301161003/tools/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld: ./Core/Src/main.o: in function main': /home/pvipl/STM32CubeIDE/workspace_1.12.1/wolfmqtt/Debug/../Core/Src/main.c:81: undefined reference tomqttsimple_test' collect2: error: ld returned 1 exit status make: *** [makefile:83: wolfmqtt.elf] Error 1 "make -j4 all" terminated with exit code 2. Build might be incomplete.

13:24:08 Build Failed. 3 errors, 1 warnings. (took 11s.713ms)

Screenshot from 2024-01-03 13-24-34 Screenshot from 2024-01-03 13-25-56 Screenshot from 2024-01-03 13-26-14

lealem47 commented 6 months ago

It looks like that the mqttsimple example is guarded by the HAVE_SOCKET macro. Try adding #define HAVE_SOCKET to the wolfSSL.I-CUBE-wolfMQTT_conf.h file and recompiling

Vishal-Birajdar commented 6 months ago

after adding #define HAVE_SOCKET showing error in mqttsimple.c -> #include <netinet/in.h> no such file error compilation terminated. make: [Core/Src/subdir.mk:37: Core/Src/mqttsimple.o] Error 1 make: Waiting for unfinished jobs.... ../Core/mqttsimple/mqttsimple.c:38:10: fatal error: netinet/in.h: No such file or directory 38 | #include <netinet/in.h> | ^~~~~~ compilation terminated. make: *** [Core/mqttsimple/subdir.mk:19: Core/mqttsimple/mqttsimple.o] Error 1 "make -j4 all" terminated with exit code 2. Build might be incomplete.

23:42:11 Build Failed. 5 errors, 0 warnings. (took 1s.693ms)

lealem47 commented 6 months ago

That header should not be included if using lwip (The desired functionality is already provided in lwip/netdb.h). I will make that modification to the example but for your case you can just comment it out.

Vishal-Birajdar commented 6 months ago

showing error when i comment out it. Screenshot from 2024-01-04 00-18-15

Vishal-Birajdar commented 6 months ago

this is my mqtt configuration Screenshot from 2024-01-04 00-36-49 Screenshot from 2024-01-04 00-37-13

lealem47 commented 6 months ago

I'm able to successfully able to compile your exact scenario after commenting out that header. Can you share your generated wolfSSL.I-CUBE-wolfMQTT_conf.h file?

Vishal-Birajdar commented 6 months ago

/home/pvipl/STM32CubeIDE/MQTT_E/wolfMQTT/wolfSSL.I-CUBE-wolfMQTT_conf.h

wolfSSL.I-CUBE-wolfMQTT_conf.txt

lealem47 commented 6 months ago

Could you try adding #include "examples/mqttport.h" to the top of the mqttsimple.c file?

lealem47 commented 6 months ago

Could you also try manually adding #define WOLFSSL_LWIP to the wolfSSL.I-CUBE-wolfMQTT_conf.h file?

Vishal-Birajdar commented 6 months ago

showing error . Can I copy mqttsimple.c function in main.c. as it to implement mqtt . like read,write,connect function as it is in my main.c file.

lealem47 commented 6 months ago

We are not making progress this way. I see that you have opened a support ticket regarding this issue. I will reach out to you there and we can schedule a call to debug and get this working for you.

Vishal-Birajdar commented 6 months ago

I will be waiting for your call. +918007904460

On Fri, 19 Jan, 2024, 12:30 am lealem47, @.***> wrote:

We are not making progress this way. I see that you have opened a support ticket regarding this issue. I will reach out to you there and we can schedule a call to debug and get this working for you.

— Reply to this email directly, view it on GitHub https://github.com/wolfSSL/wolfMQTT/issues/382#issuecomment-1899044202, or unsubscribe https://github.com/notifications/unsubscribe-auth/BEC7WDGYJUZKEAG33GBRPUDYPFWMZAVCNFSM6AAAAABASQ7MXSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJZGA2DIMRQGI . You are receiving this because you were mentioned.Message ID: @.***>

lealem47 commented 5 months ago

Resolved offline. The issue was fixed by enabling LWIP_DNS (DNS Module) in the LWIP general settings.