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

Compilation isssue in jwt.h from picojson include directories #195

Closed
sureshganapathyhacker opened this issue Jan 18, 2022 · 4 comments
Closed

Comments

@sureshganapathyhacker
Copy link

sureshganapathyhacker commented Jan 18, 2022

jwt.h includes "picojson/picojson.h"...But the picojson directory is one level above where jwt.h file exists....So the inclusion should be as follows:

"../picojson/picojson.h" .... Otherwise there will be an compilation error. If a developer wants to download this lib and uses the header files as it is available in GitHub, I think you must change jwt.h as I mentioned.

Kindly let me know if I am wrong..

@Thalhammer
Copy link
Owner

While this was how it worked originally, jwt-cpp has come a long way since then (supporting multiple ssl and json libraries in multiple versions). The supposed way to do this is to configure your include paths in a way that makes picojson visible at that path. It doesn't need to be the version that ships with this repo, you can also use a already present one or system installed one.

The fact that "..." is used for including picojson instead of <...> is a relict of the time when picojson was the only supported library and should probably be changed. I am not at a PC, but I'll do so tomorrow.

As for the include failure. Make sure to configure the include path correctly, or use a package manager or cmakes fetchcontent to include and link the library. Copy pasting the file is a bad idea cause it prevents you from easily getting updates which, given jwt-cpp is usually used in a security sensitive context, is especially problematic. (We never had a security incident and take care when working on crypto code, but you can never be sure).

@prince-chrismc
Copy link
Collaborator

The header includes are designed to be used with CMake. If you just download or clone the source, then yes they would be incorrect.

If you are using another build tool perhaps adding support here might be an option?

Sadly its it's difficult to support everything but we are open to ideas!

@prince-chrismc
Copy link
Collaborator

Even jumping way back, it looks like we had the same issue

https://github.com/Thalhammer/jwt-cpp/tree/72553b24e42b80ab2b5d36608df988a73e8db18a

@prince-chrismc prince-chrismc changed the title Compilation Isssue in jwt.h Compilation isssue in jwt.h from picojson include directories May 11, 2022
@prince-chrismc
Copy link
Collaborator

Since #213 has more information and possible solution I am closing this as a duplicate

@prince-chrismc prince-chrismc closed this as not planned Won't fix, can't repro, duplicate, stale Sep 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants