Teensy 4.1 and ethenrnetwebserver_ssl

Just trying this module out and getting build errors with one of the examples, any ideas?

Compiling .pio\build\teensy41\src\main.cpp.o
Compiling .pio\build\teensy41\lib483\QNEthernet\QNEthernet.cpp.o
In file included from src\main.cpp:18:0:
include/defines.h:374:8: warning: #warning Using NativeEthernet lib for Teensy 4.1. Must also use Teensy Packages Patch or error [-Wcpp]
#warning Using NativeEthernet lib for Teensy 4.1. Must also use Teensy Packages Patch or error
^
In file included from include/defines.h:422:0,
from src\main.cpp:18:
.pio\libdeps\teensy41\EthernetWebServer_SSL\src/EthernetWebServer_SSL.h:125:4: warning: #warning SENDCONTENT_P_BUFFER_SZ using default 4 Kbytes [-Wcpp]
#warning SENDCONTENT_P_BUFFER_SZ using default 4 Kbytes
^
.pio\libdeps\teensy41\QNEthernet\src\QNEthernet.cpp:12:21: fatal error: Entropy.h: No such file or directory

platformio.ini and reference code?

Platformio.ini

[env:teensy41]
platform = teensy
board = teensy41
framework = arduino
lib_deps = khoih-prog/EthernetWebServer_SSL@^1.7.4

in library build, for QNEthernet.cpp

line 12

#include <Entropy.h>

file not found

pulled entropy.cpp and .h from GitHub - pmjdebruijn/Arduino-Entropy-Library: Arduino Entropy Library (Temporary Fork) but seems this library is not well setup for teensy in platformio, going to try arest,

A few notes:

  1. The Entropy library is included in the Teensy core. You shouldn’t need to include it in your code anywhere. It will be picked up automatically. (Remove anything you’ve manually added.)
  2. To get QNEthernet, I would add:
    GitHub - ssilverman/QNEthernet: An lwIP-based Ethernet library for Teensy 4.1
    to your lib_deps. (And remove anything manually downloaded.)
  3. You may need to set some QNETHERNET_SOMETHING macro in order to correctly build the web server code with QNEthernet.

If you still can’t get this to work, could you paste minimal source code that reproduces the build problem? If I have some time, I’ll create a new project with the above platform.ini contents to see if I can reproduce and solve it on my end.

I have the same issue with “ssilverman/QNEthernet”:

[env:teensy41]
lib_extra_dirs = …/…/library
platform = teensy
board = teensy41
framework = arduino
upload_protocol = teensy-cli
lib_deps = ssilverman/QNEthernet

giving

fatal error: Entropy.h: No such file or directory

when I start adding other lib_deps and/or #include(s)

My solution is adding

#include “Entropy.h”

as first include to

main.cpp

This also works with libraries that depend on “ssilverman/QNEthernet”. (like “khoih-prog/WebSockets2_Generic”; after “cleaning up” the “WebSockets2_Generic/library.json” file :wink: :))

Is the program including QNEthernet.h? (Note: I’m the author of QNEthernet.)

I tried to reproduce this, and here were my steps.

  1. Create a new project. The platformio.ini file looks like this:
[env:teensy41]
platform = teensy
board = teensy41
framework = arduino
lib_deps = https://github.com/ssilverman/QNEthernet
  1. Build. (main.cpp is effectively empty; its contents are just the initial default.) I see the missing Entropy.h error.

  2. Add #include <QNEthernet.h> to main.cpp.

  3. Rebuild. I don’t see the error. My main.cpp looks like this:

#include <Arduino.h>
#include <QNEthernet.h>  // <-- Added this

void setup() {
  // put your setup code here, to run once:
}

void loop() {
  // put your main code here, to run repeatedly:
}

It sounds like there might be some more dependency issues if the library path is modified? What happens when you add the above include to your program (if it isn’t already)? I’m having some trouble reproducing the error. The Entropy library is included in the Teensyduino framework here: ~/.platformio/packages/framework-arduinoteensy/libraries/Entropy.

I’d like to figure this out so I can add it to the README if others encounter this.
@mtjs @david2: What further steps do I need to take so I can see the problem after step 4?

The solution is one of:

  1. Include <QNEthernet.h> in your project, or
  2. In platformio.ini, set library_ldf_mode = deep (or deep+).

By default, PlatformIO only looks one level deep for dependencies, and the Entropy library is a dependency of QNEthernet. Since QNEthernet is itself a dependency of one of the project’s library dependencies, the system won’t find the Entropy library without one of the above two steps.

A follow up: I put in my own entropy routines and no longer depend on the Entropy library. (Note: the behaviour can be changed back to using Entropy by defining a macro.)