SlashDevin / NeoGPS

NMEA and ublox GPS parser for Arduino, configurable to use as few as 10 bytes of RAM
GNU General Public License v3.0
707 stars 195 forks source link

error: 'const void*' is not a pointer-to-object type for ESP8266 NodeMcu #112

Open minida28 opened 5 years ago

minida28 commented 5 years ago

Platform: NodeMcu / ESP8266.

By the time I am posting this issue, I am using:

  1. Git version of NeoGPS
  2. Git version of esp8266 arduino core
  3. Platformio IDE (MS Visual Code)

Just after I updated esp8266 core to the latest version (git), suddenly the sketch won't compile, and I got this error:

error: 'const void*' is not a pointer-to-object type

So clearly there must be something in esp8266 arduino core that causes this issue.

This is pretty similar to issue #76

Applying the fix https://github.com/SlashDevin/NeoGPS/commit/1d18418e100e4399845069e85a66235550257842 mentioned in the above issue seems solve the compile problem.

Here is the change I did in file NeoGPS_cfg.h, I added new define #if defined(ESP8266) | \

#if defined(ESP8266) |              \
    defined(ARDUINO_SAMD_MKRZERO) | \
    defined(ARDUINO_SAMD_ZERO) |    \
    defined(ARDUINO_SAM_DUE) |      \
    defined(ARDUINO_ARCH_ARC32) |   \
    defined(__TC27XX__) |           \
    (defined(TEENSYDUINO) && (TEENSYDUINO < 139))
#undef pgm_read_ptr
#define pgm_read_ptr(addr) (*(const void **)(addr))
#endif

Below is the complete error:

Compiling .pioenvs\esp12e\libc0f\NeoGPS\DMS.cpp.o
Compiling .pioenvs\esp12e\libc0f\NeoGPS\GPSTime.cpp.o
Compiling .pioenvs\esp12e\libc0f\NeoGPS\Garmin\GrmNMEA.cpp.o
Compiling .pioenvs\esp12e\libc0f\NeoGPS\Location.cpp.o
Compiling .pioenvs\esp12e\libc0f\NeoGPS\NMEAGPS.cpp.o
Compiling .pioenvs\esp12e\libc0f\NeoGPS\NeoTime.cpp.o
Compiling .pioenvs\esp12e\libc0f\NeoGPS\Streamers.cpp.o
In file included from C:\users\iqbal\.platformio\packages\framework-arduinoespressif8266\tools\sdk\libc\xtensa-lx106-elf\include/sys/stdio.h:6:0,
from C:\users\iqbal\.platformio\packages\framework-arduinoespressif8266\tools\sdk\libc\xtensa-lx106-elf\include/stdio.h:63,
from C:\users\iqbal\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/Arduino.h:32,
from lib\NeoGPS\src\NMEAGPS.h:23,
from lib\NeoGPS\src\NMEAGPS.cpp:18:
lib\NeoGPS\src\NMEAGPS.cpp: In member function 'NMEAGPS::decode_t NMEAGPS::parseCommand(const NMEAGPS::msg_table_t*, uint8_t, char)':
C:\users\iqbal\.platformio\packages\framework-arduinoespressif8266\tools\sdk\libc\xtensa-lx106-elf\include/sys/pgmspace.h:76:81: error: 'const void*' is not a pointer-to-object type
#define pgm_read_ptr(addr)              (*reinterpret_cast<const void*>(addr))
^
lib\NeoGPS\src\NMEAGPS.cpp:598:43: note: in expansion of macro 'pgm_read_ptr'
const char *table_i = (const char *)pgm_read_ptr(&table[i]);
^
C:\users\iqbal\.platformio\packages\framework-arduinoespressif8266\tools\sdk\libc\xtensa-lx106-elf\include/sys/pgmspace.h:76:81: error: 'const void*' is not a pointer-to-object type
#define pgm_read_ptr(addr)              (*reinterpret_cast<const void*>(addr))
^
lib\NeoGPS\src\NMEAGPS.cpp:626:48: note: in expansion of macro 'pgm_read_ptr'
const char *table_next = (const char *)pgm_read_ptr(&table[next_msg]);
^
lib\NeoGPS\src\NMEAGPS.cpp: In member function 'const __FlashStringHelper* NMEAGPS::string_for(NMEAGPS::nmea_msg_t) const':
C:\users\iqbal\.platformio\packages\framework-arduinoespressif8266\tools\sdk\libc\xtensa-lx106-elf\include/sys/pgmspace.h:76:81: error: 'const void*' is not a pointer-to-object type
#define pgm_read_ptr(addr)              (*reinterpret_cast<const void*>(addr))
^
lib\NeoGPS\src\NMEAGPS.cpp:693:43: note: in expansion of macro 'pgm_read_ptr'
const char *table_i = (const char *)pgm_read_ptr(&table[i]);
^
lib\NeoGPS\src\NMEAGPS.cpp: In static member function 'static void NMEAGPS::poll(Stream*, NMEAGPS::nmea_msg_t)':
C:\users\iqbal\.platformio\packages\framework-arduinoespressif8266\tools\sdk\libc\xtensa-lx106-elf\include/sys/pgmspace.h:76:81: error: 'const void*' is not a pointer-to-object type
#define pgm_read_ptr(addr)              (*reinterpret_cast<const void*>(addr))
^
lib\NeoGPS\src\NMEAGPS.cpp:2224:38: note: in expansion of macro 'pgm_read_ptr'
(const __FlashStringHelper *)pgm_read_ptr(&poll_msgs[msg - NMEA_FIRST_MSG]);
^
*** [.pioenvs\esp12e\libc0f\NeoGPS\NMEAGPS.cpp.o] Error 1
============================================================================================================= [ERROR] Took 10.74 seconds =============================================================================================================
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.
Karshilistic commented 4 years ago

For those curious, I fixed the problem by following this issue: https://github.com/esp8266/Arduino/issues/5733

It now compiles after changing #define pgm_read_ptr(addr) (*reinterpret_cast<const void*>(addr)) with #define pgm_read_ptr(addr) (*reinterpret_cast<const void* const *>(addr)) in pgmspace.h (see original log for full path)

nmfrankel commented 2 years ago

I had the same issue, why doesn't it get fixed in the actual repo?

wm1962 commented 10 months ago

I had the same problem, and it is still not fixed. What a mess !!!