Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build issue caused by implicit signed type in JSON schema validator #385

Merged
merged 1 commit into from
Jan 3, 2024

Conversation

drmrd
Copy link
Collaborator

@drmrd drmrd commented Dec 23, 2023

When attempting to build libocpp on macOS Sonoma 14.2.1 (23C71) (on a Apple 2023 MacBook Pro with M2 Pro CPU), I immediately run into an error with smtp-address-validator.cpp.o from pboettch/json-schema-validator (also known as nlohmann_json_schema_validator in EVerest CMake files). The error is due to an array of chars in their 2.2.0 release that contains negative values but is not explicitly declared to be signed. (See the details block at the end of this message for the complete error output.)

Using the bare char type instead of signed char or unsigned char with numeric values is generally considered a bad practice that limits portability (see, for instance, the SEI CERT C Coding Standard), and the authors of pboettch/json-schema-validator have since changed this variable to be a signed char array for their 2.3.0 release.

This PR updates the pboettch/json-schema-validator dependency in our dependencies.yaml to the newer 2.3.0 release, making libocpp, resolving this compilation issue.

Full Error Log
[  0%] Building CXX object _deps/nlohmann_json_schema_validator-build/CMakeFiles/nlohmann_json_schema_validator.dir/src/smtp-address-validator.cpp.o
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-32' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-19' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-16' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-12' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-62' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-33' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-31' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-17' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-15' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-13' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-128' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-65' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-32' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-19' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-16' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-12' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-62' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-33' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-31' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-17' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-15' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-13' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-96' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-65' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-128' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-65' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-128' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-97' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-112' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-65' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-128' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-65' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-128' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-113' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-32' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-19' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-16' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-12' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-62' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-33' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-31' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-17' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-15' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-13' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-32' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-19' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-16' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-12' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-62' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-33' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-31' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-17' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-15' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-13' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-128' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-65' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-96' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-65' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-128' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-65' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-128' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-97' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-112' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-65' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-128' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-65' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-128' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-113' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-32' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-19' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-16' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-12' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-62' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-33' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-31' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-17' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-15' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-13' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-32' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-19' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-16' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-12' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-62' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-33' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-31' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-17' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-15' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-13' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-32' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-19' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-16' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-12' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-62' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-33' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-31' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-17' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-15' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-13' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-128' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-65' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-96' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-65' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-128' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-65' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-128' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-97' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-112' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-65' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-128' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-65' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-128' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-113' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-32' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-19' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-16' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-12' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-62' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-33' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-31' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-17' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-15' from 'int' to 'char' [-Wnarrowing]
smtp-address-validator.cpp:213:1: error: narrowing conversion of '-13' from 'int' to 'char' [-Wnarrowing]
make[2]: *** [_deps/nlohmann_json_schema_validator-build/CMakeFiles/nlohmann_json_schema_validator.dir/build.make:82: _deps/nlohmann_json_schema_validator-build/CMakeFiles/nlohmann_json_schema_validator.dir/src/smtp-address-validator.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:586: _deps/nlohmann_json_schema_validator-build/CMakeFiles/nlohmann_json_schema_validator.dir/all] Error 2
make: *** [Makefile:149: all] Error 2

@drmrd drmrd requested a review from hikinggrass December 23, 2023 20:50
@drmrd
Copy link
Collaborator Author

drmrd commented Dec 23, 2023

@shankari: This is probably the smallest PR I'll ever send your way. 😄

@couryrr-afs
Copy link
Contributor

Please see #318 that addresses the same issue.

@shankari
Copy link

shankari commented Jan 3, 2024

@couryrr-afs I already approved #318
I think that @drmrd's explanation is much more clear, though - thanks @drmrd!
@drmrd I think you need to add a line to fix the formatting in the details

This is not formatted correctly ``` some long log string ```
But this is
some long log string

I tried to fix it, but since I am not an admin, I am not able to edit the issue 😦

@Pietfried Pietfried merged commit 8114bce into EVerest:main Jan 3, 2024
2 checks passed
@drmrd drmrd deleted the hotfix/macos-build-issue branch January 26, 2024 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants