C/C++ Question compilation issue with GSM_MQTT library on B4X - OK now -

candide

Active Member
Licensed User
i am still working on a wrapper for GSM_MQTT library on B4R but i blocked at compilation with B4R when compilation is OK on Arduino.

after several tests, i reduced wrapper at 2 functions, but problem is still the same.
the 3 callback function were locked but compilation is still NOK on B4X
this libray use PROGMEM and an issue was possible at this level. after all strings in memory and PROGMEM removed, issue in compilation is still here.
In this library Serial1 is used for link with SIM800 and a Softserial is used for link with PC: i removed Softserial, but no impact on compilation.

error seen :
Preparation des cartes
Verification...
c:/users/mpage/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: D:\B4R\B4R_AP~1\test\Objects\bin\sketch\GSM_MQTT.cpp.o: in function `GSM_MQTT::printConnectAck(unsigned char)':
D:\B4R\B4R_AP~1\test\Objects\bin\sketch/GSM_MQTT.cpp:603: undefined reference to `MQTT'
c:/users/mpage/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: D:\B4R\B4R_AP~1\test\Objects\bin\sketch/GSM_MQTT.cpp:603: undefined reference to `MQTT'
c:/users/mpage/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: D:\B4R\B4R_AP~1\test\Objects\bin\sketch/GSM_MQTT.cpp:600: undefined reference to `MQTT'
collect2.exe: error: ld returned 1 exit status
exit status 1

=> in GSM_MQTT.cpp file i don't see MQTT object on lines provided by error...
At last i have no idea about this issue and explanation of linker error is not clear...

GSM_MQTT, wrapper and B4R files are in zip file added if someone want to help me, he will be welcome.

thanks for your help

at last, i found my problem: it is linked with a function in original cpp file: "void serialEvent();"

i will check more tomorrow
--------------------------------
update
now compilation is OK and start of esp8266 with a basic program is working. i cannot do more because i have a A6 module but not a SIM800...

last libray built for B4X is attached with a short example.

one thing to highlight : in this library, Hard serial is used for SIM800 connection and SoftwareSerial is used for PC link. It can be changed but from arduino library developers , it is better to use hard serial for SIM800 link.

arduino library : https://elementztechblog.wordpress....-library-for-sim800-gsm-modem/comment-page-1/
 

Attachments

  • rGSM_MQTT.zip
    11.9 KB · Views: 157
Last edited:

Michael1968

Active Member
Licensed User
Longtime User
hi candide,

....short test

i get this error:
IC:\\Users\\Michael Lankers\\Documents\\Arduino\\libraries\\EspSoftwareSerial\\src" "C:\\Users\\MICHAE~1\\Desktop\\rgsm\\Objects\\bin\\sketch\\src.ino.cpp" -o nul
Alternatives for avr/pgmspace.h: []
ResolveLibrary(avr/pgmspace.h)
-> candidates: []
In file included from C:\Users\MICHAE~1\Desktop\rgsm\Objects\bin\sketch\rGSM_MQTT.h:4:0,
from C:\Users\MICHAE~1\Desktop\rgsm\Objects\bin\sketch\B4RDefines.h:26,
from C:\Users\MICHAE~1\Desktop\rgsm\Objects\src\src.ino:1:
GSM_MQTT.h:18:26: fatal error: avr/pgmspace.h: No such file or directory
compilation terminated.
Bibliothek EspSoftwareSerial in Version 6.9.0 im Ordner: C:\Users\Michael Lankers\Documents\Arduino\libraries\EspSoftwareSerial wird verwendet
exit status 1

best regards
Michael
 

candide

Active Member
Licensed User
no chance ...😭
i just tested again and on my pc compilation is OK (log attached)
i am using last version of arduino and last version B4X and last version of esp8266 package
after, it is mandatory to use version of GSM_MQTT.h and GSM_MQTT.h in Zip file because some modifications were done to be compatible with a B4X wrapper.

from your log, it seems avr/pgmspace.h is missing, normally it is part of ESP8266 package, it is a part to check...
 

Attachments

  • log B4X.zip
    10.8 KB · Views: 143

Michael1968

Active Member
Licensed User
Longtime User
found the probleme...

in gsm_mqtt.cpp i have changed :
B4X:
#include <avr/pgmspace.h>
to
B4X:
#include <pgmspace.h>

now compile with ESP32 is ok

... i will test the lib in the next days
 

yaqoob

Member
Licensed User
Longtime User
no chance ...😭
i just tested again and on my pc compilation is OK (log attached)
i am using last version of arduino and last version B4X and last version of esp8266 package
after, it is mandatory to use version of GSM_MQTT.h and GSM_MQTT.h in Zip file because some modifications were done to be compatible with a B4X wrapper.

from your log, it seems avr/pgmspace.h is missing, normally it is part of ESP8266 package, it is a part to check...

Hi Candide,

I am getting the below error during complaining. Even though I checked and the file is available in the libraries directory.


B4R Version: 3.71
Parsing code. (0.00s)
Building folders structure. (0.00s)
Compiling code. (0.00s)
Building project Error
Could not find a part of the path 'C:\Users\yaqoo\B4R\Libraries file\rgsm_mqtt'.
 

candide

Active Member
Licensed User
i can reproduce same issue when i have a mistake in directory name for this library.

in your case directory should be rGSM_MQTT
 
Top