Link Library that has directories and subdirectories

Hi,

I am trying to link the wolfSSL C library in my Arduino build. I am trying to determine the best route to do this. I cannot include it in the libraries sections as the wolfSSL library includes directories and subdirectories which store the .c and .h files, i.e., wolfssl/wolfssl/ssl.h, wolfssl/wolfcrypt/aes.h, wolfssl/src/ssl.c, etc. Do I need to completely re-map the library so all .h and .c files lie directly under wolfssl, or is there another way to build/link my Arduino project with this library?

Any help is greatly appreciated!

Thanks,

Leah

I have seen libraries that use sub-directories so I don't think you have to move files. Have you installed the library and written a sketch to reference it? Do you get an error? What error do you get?

If it can't find the ssl.h file, try including it as <wolfssl/ssl.h> instead. That's the sort of thing the wolfssl source is doing: wolfssl/ssl.h at master · wolfSSL/wolfssl · GitHub

Hi John,

I am including it as <wolfssl/ssl.h>, I was trying to explain its location in the wolfssl library folder - libraries/wolfssl/wolfssl/ssl.h. I think I made that bit confusing. I have written a sketch and included wolfssl header files after installing the library. The error is:

fatal error: wolfssl/ssl.h: No such file or directory

I have found that if I include any header file that is located in the wolfssl folder (libraries/wolfssl/any_header.h), even if that file is completely empty, I can now use the other headers, i.e., <wolfssl/ssl.h> or <wolfssl/wolfcrypt/aes.h> that are in subdirectories. I have to go to sketch > Include Library > wolfssl and it will include that single header file automatically and then I can add the other headers. Without this step, I cannot include any of the wolfssl header files that lie in subdirectories of wolfssl. I also have to move the .c files to be directly in the wolfssl folder - libraries/wolfssl/ssl.c vs libraries/wolfssl/src/ssl.c. I get errors for undefined references to functions if the .c files are left in their normal subdirectories. Is this typical?

Am I missing something else for including headers? I am not sure adding an out-of-place header file to the library is the best option, but I suppose it will work if it is my only option.

Thanks for your help!

leah_wolf:
I have found that if I include any header file that is located in the wolfssl folder (libraries/wolfssl/any_header.h), even if that file is completely empty, I can now use the other headers, i.e., <wolfssl/ssl.h> or <wolfssl/wolfcrypt/aes.h> that are in subdirectories.

Sounds like a plausible Arduino weirdness. I'd use an empty file called "wolfssl.h" since Arduino likes the library name and include-file name to be the same.

leah_wolf:
I also have to move the .c files to be directly in the wolfssl folder - libraries/wolfssl/ssl.c vs libraries/wolfssl/src/ssl.c. I get errors for undefined references to functions if the .c files are left in their normal subdirectories. Is this typical?

That's a disappointment but it does sound plausible.