openpgp
openpgp copied to clipboard
Can't build on arch
Hi there,
Trying to build on arch, getting:
▶ make
g++ -std=c++17 -Os -Wall -g3 -I. -Ipc/ -Isrc/ -Ilibs/mbedtls/ -Ilibs/mbedtls/mbedtls/crypto/include/ -Ilibs/stm32fs/ -Ilibs/bearssl/ -Ilibs/spiffs/ -Ilibs/spiffs/default -Ilibs/spiffs/test -c -o obj/opgpdevice.o ./pc/opgpdevice.cpp
g++ -std=c++17 -Os -Wall -g3 -I. -Ipc/ -Isrc/ -Ilibs/mbedtls/ -Ilibs/mbedtls/mbedtls/crypto/include/ -Ilibs/stm32fs/ -Ilibs/bearssl/ -Ilibs/spiffs/ -Ilibs/spiffs/default -Ilibs/spiffs/test -c -o obj/cryptolib.o ./src/cryptolib.cpp
g++ -std=c++17 -Os -Wall -g3 -I. -Ipc/ -Isrc/ -Ilibs/mbedtls/ -Ilibs/mbedtls/mbedtls/crypto/include/ -Ilibs/stm32fs/ -Ilibs/bearssl/ -Ilibs/spiffs/ -Ilibs/spiffs/default -Ilibs/spiffs/test -c -o obj/opgputil.o ./src/opgputil.cpp
./src/opgputil.cpp:9:10: fatal error: led.h: No such file or directory
9 | #include "led.h"
| ^~~~~~~
./pc/opgpdevice.cpp:31:10: fatal error: spiffs.h: No such file or directory
31 | #include <spiffs.h>
| ^~~~~~~~~~
compilation terminated.
compilation terminated.
make: *** [Makefile:31: obj/opgpdevice.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [Makefile:31: obj/opgputil.o] Error 1
./src/cryptolib.cpp:15:10: fatal error: device.h: No such file or directory
15 | #include "device.h"
| ^~~~~~~~~~
compilation terminated.
make: *** [Makefile:31: obj/cryptolib.o] Error 1
Then with https://github.com/solokeys/openpgp/pull/24, I fixed spiffs. I used submodule strategy, let me know if you prefer another method.
▶ make
g++ -std=c++17 -Os -Wall -g3 -I. -Ipc/ -Isrc/ -Ilibs/mbedtls/ -Ilibs/mbedtls/mbedtls/crypto/include/ -Ilibs/stm32fs/ -Ilibs/bearssl/ -Ilibs/spiffs/src -Ilibs/spiffs/src/default -Ilibs/spiffs/src/test -c -o obj/opgpdevice.o ./pc/opgpdevice.cpp
g++ -std=c++17 -Os -Wall -g3 -I. -Ipc/ -Isrc/ -Ilibs/mbedtls/ -Ilibs/mbedtls/mbedtls/crypto/include/ -Ilibs/stm32fs/ -Ilibs/bearssl/ -Ilibs/spiffs/src -Ilibs/spiffs/src/default -Ilibs/spiffs/src/test -c -o obj/cryptolib.o ./src/cryptolib.cpp
g++ -std=c++17 -Os -Wall -g3 -I. -Ipc/ -Isrc/ -Ilibs/mbedtls/ -Ilibs/mbedtls/mbedtls/crypto/include/ -Ilibs/stm32fs/ -Ilibs/bearssl/ -Ilibs/spiffs/src -Ilibs/spiffs/src/default -Ilibs/spiffs/src/test -c -o obj/opgputil.o ./src/opgputil.cpp
./src/opgputil.cpp:9:10: fatal error: led.h: No such file or directory
9 | #include "led.h"
| ^~~~~~~
compilation terminated.
make: *** [Makefile:31: obj/opgputil.o] Error 1
make: *** Waiting for unfinished jobs....
./src/cryptolib.cpp:15:10: fatal error: device.h: No such file or directory
15 | #include "device.h"
| ^~~~~~~~~~
compilation terminated.
make: *** [Makefile:31: obj/cryptolib.o] Error 1
./pc/opgpdevice.cpp: In function ‘void hw_spiffs_mount()’:
./pc/opgpdevice.cpp:71:26: error: invalid conversion from ‘s32_t (*)(u32_t, u32_t, u8_t*)’ {aka ‘int (*)(unsigned int, unsigned int, unsigned char*)’} to ‘spiffs_read’ {aka ‘int (*)(spiffs_t*, unsigned int, unsigned int, unsigned char*)’} [-fpermissive]
71 | cfg.hal_read_f = hw_spiffs_read;
| ^~~~~~~~~~~~~~
| |
| s32_t (*)(u32_t, u32_t, u8_t*) {aka int (*)(unsigned int, unsigned int, unsigned char*)}
./pc/opgpdevice.cpp:72:27: error: invalid conversion from ‘s32_t (*)(u32_t, u32_t, u8_t*)’ {aka ‘int (*)(unsigned int, unsigned int, unsigned char*)’} to ‘spiffs_write’ {aka ‘int (*)(spiffs_t*, unsigned int, unsigned int, unsigned char*)’} [-fpermissive]
72 | cfg.hal_write_f = hw_spiffs_write;
| ^~~~~~~~~~~~~~~
| |
| s32_t (*)(u32_t, u32_t, u8_t*) {aka int (*)(unsigned int, unsigned int, unsigned char*)}
./pc/opgpdevice.cpp:73:27: error: invalid conversion from ‘s32_t (*)(u32_t, u32_t)’ {aka ‘int (*)(unsigned int, unsigned int)’} to ‘spiffs_erase’ {aka ‘int (*)(spiffs_t*, unsigned int, unsigned int)’} [-fpermissive]
73 | cfg.hal_erase_f = hw_spiffs_erase;
| ^~~~~~~~~~~~~~~
| |
| s32_t (*)(u32_t, u32_t) {aka int (*)(unsigned int, unsigned int)}
./pc/opgpdevice.cpp: In function ‘int ireadfile(char*, uint8_t*, size_t, size_t*)’:
./pc/opgpdevice.cpp:271:15: error: ordered comparison of pointer with integer zero (‘FILE*’ and ‘int’)
271 | if (f <= 0)
| ~~^~~~
./pc/opgpdevice.cpp: In function ‘int iwritefile(char*, uint8_t*, size_t)’:
./pc/opgpdevice.cpp:314:15: error: ordered comparison of pointer with integer zero (‘FILE*’ and ‘int’)
314 | if (f <= 0)
| ~~^~~~
make: *** [Makefile:31: obj/opgpdevice.o] Error 1
It's failing for me using #24 :
g++ -std=c++17 -Os -Wall -g3 -I. -Ipc/ -Isrc/ -Ilibs/mbedtls/ -Ilibs/mbedtls/mbedtls/crypto/include/ -Ilibs/stm32fs/ -Ilibs/bearssl/ -Ilibs/spiffs/src -c -o obj/opgpdevice.o ./pc/opgpdevice.cpp
In file included from ./pc/opgpdevice.cpp:31:
libs/spiffs/src/spiffs.h:14:10: fatal error: spiffs_config.h: No such file or directory
14 | #include "spiffs_config.h"
| ^~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:28: obj/opgpdevice.o] Error 1
Got it past the include stage with the following:
g++ -std=c++17 -Os -Wall -g3 -I. -Ipc/ -Isrc/ -Ilibs/mbedtls/ -Ilibs/mbedtls/mbedtls/crypto/include/ -Ilibs/stm32fs/ -Ilibs/bearssl/ -I libs/spiffs/src -I libs/spiffs/src/default -I libs/spiffs/src/test -c -o obj/opgpdevice.o ./pc/opgpdevice.cpp
However, it looks like the SPIFFS API may have changed? Am getting compile errors now - only 3 parameters are passed but 4 are expected:
./pc/opgpdevice.cpp: In function ‘void hw_spiffs_mount()’:
./pc/opgpdevice.cpp:71:19: error: invalid conversion from ‘s32_t (*)(u32_t, u32_t, u8_t*)’ {aka ‘int (*)(unsigned int, unsigned int, unsigned char*)’} to ‘spiffs_read’ {aka ‘int (*)(spiffs_t*, unsigned int, unsigned int, unsigned char*)’} [-fpermissive]
71 | cfg.hal_read_f = hw_spiffs_read;
| ^~~~~~~~~~~~~~
| |
| s32_t (*)(u32_t, u32_t, u8_t*) {aka int (*)(unsigned int, unsigned int, unsigned char*)}
./pc/opgpdevice.cpp:72:20: error: invalid conversion from ‘s32_t (*)(u32_t, u32_t, u8_t*)’ {aka ‘int (*)(unsigned int, unsigned int, unsigned char*)’} to ‘spiffs_write’ {aka ‘int (*)(spiffs_t*, unsigned int, unsigned int, unsigned char*)’} [-fpermissive]
72 | cfg.hal_write_f = hw_spiffs_write;
| ^~~~~~~~~~~~~~~
| |
| s32_t (*)(u32_t, u32_t, u8_t*) {aka int (*)(unsigned int, unsigned int, unsigned char*)}
./pc/opgpdevice.cpp:73:20: error: invalid conversion from ‘s32_t (*)(u32_t, u32_t)’ {aka ‘int (*)(unsigned int, unsigned int)’} to ‘spiffs_erase’ {aka ‘int (*)(spiffs_t*, unsigned int, unsigned int)’} [-fpermissive]
73 | cfg.hal_erase_f = hw_spiffs_erase;
| ^~~~~~~~~~~~~~~
| |
| s32_t (*)(u32_t, u32_t) {aka int (*)(unsigned int, unsigned int)}
make: *** [Makefile:31: obj/opgpdevice.o] Error 1
Nevermind, I fixed the previous issue with:
-DSPIFFS_HAL_CALLBACK_EXTRA=0
Almost there... now stuck on importing "device.h"
g++ -std=c++17 -Os -Wall -g3 -I. -Ipc/ -Isrc/ -Ilibs/mbedtls/ -Ilibs/mbedtls/mbedtls/crypto/include/ -Ilibs/stm32fs/ -Ilibs/bearssl/ -I libs/spiffs/src -I libs/spiffs/src/default -I libs/spiffs/src/test -DSPIFFS_HAL_CALLBACK_EXTRA=0 -c -o obj/cryptolib.o ./src/cryptolib.cpp
./src/cryptolib.cpp:15:10: fatal error: device.h: No such file or directory
15 | #include "device.h"
| ^~~~~~~~~~
compilation terminated.
make: *** [Makefile:31: obj/cryptolib.o] Error 1