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

Error in compiling #1

Open
h-g93 opened this issue Mar 18, 2019 · 21 comments
Open

Error in compiling #1

h-g93 opened this issue Mar 18, 2019 · 21 comments

Comments

@h-g93
Copy link

h-g93 commented Mar 18, 2019

hey,
I tried to compile the WiFiNatRouter sketch and I get an error:

Build options changed, rebuilding all
/bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
/bin/sh: -c: line 1: syntax error: unexpected end of file
make: *** [build/api/api_lib.o] Error 2
exit status 2
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

help, please

@martin-ger
Copy link
Owner

If you Switch Back to the original lwip, does it work?

@h-g93
Copy link
Author

h-g93 commented Mar 18, 2019

No,
when I try in another computer i get:
WiFiNatRouter:3:28: error: lwip/lwip_napt.h: No such file or directory
#include "lwip/lwip_napt.h"
^
compilation terminated.
exit status 1
lwip/lwip_napt.h: No such file or directory

@martin-ger
Copy link
Owner

martin-ger commented Mar 19, 2019

Okay, the second error is "normal", as the lwip_napt.h is not part of the standard liblwip. Please check the following:

  • use the second (standard) setup, chose a builtin example, let's say the Basic Webserver, and compile with the "lwip 1.4 from sources" option.
  • if this fails, you have some problems with your Arduino installation
  • if this works, try to replace the lwip with my extension - should still work
  • if yes, you are ready to go on with NAT...

@h-g93
Copy link
Author

h-g93 commented Mar 19, 2019

when I try to upload example "HelloServer" with lwip variant "V2 Lower Memory (no features)" its work
when I try to upload example "HelloServer" with lwip variant "lwip 1.4 from sources" it doesn't work and I get this error:
exec: "make": executable file not found in %PATH%
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

Must to say that I didn't find the exact directory of ".../packages/esp8266/hardware/esp8266/2.5.0/tools/sdk/"
but my directory is:
...\Documents\Arduino\hardware\esp8266com\esp8266\tools\sdk

@martin-ger
Copy link
Owner

Path is okay. Problem is, that you are compiling on Windows and your environment doesn't have the make tool. That's not a specific issue of this lib, but a general issue with the Arduino on Windows. Could you try on Linux? Maybe Google helps...?

@h-g93
Copy link
Author

h-g93 commented Mar 20, 2019

hey,
I Succeeded to recompile (in Windows) the lib and i get a new "liblwip_src.a" file and I put him in the lib folder.
it still not working, the same error. Do I have something more to do?

@martin-ger
Copy link
Owner

You will need the includes from my lib. Replace the lwip/include drectory with the one from my repo.

@h-g93
Copy link
Author

h-g93 commented Mar 20, 2019

what do you mean i need the includes from your lib?
I replace the lwip folder like you write, run the MakeFile and replace the "liblwip_src.a".
in addition I run "fix_sdk_libs.sh" like write in the README file (in lib folder)

_## Updating SDK libraries

  • Copy .a files from SDK lib directory to this directory
  • Run fix_sdk_libs.sh_

I did this ugly to step up the direction error
code snipped :
_#include <ESP8266WiFi.h>

#include "C:/Users/hezi/Documents/Arduino/hardware/esp8266com/esp8266/tools/sdk/lwip/include/lwip/lwip_napt.h"

#include "C:/Users/hezi/Documents/Arduino/hardware/esp8266com/esp8266/tools/sdk/lwip/include/lwip/app/dhcpserver.h"_

and I get:
.....
exit status 1
'IP_NAPT_MAX' was not declared in this scope
........

@h-g93
Copy link
Author

h-g93 commented Mar 21, 2019

I success to solved this, i think this is a bug because need to add
#include <ESP8266WiFi.h>
#define IP_NAPT 1
#define IP_FORWARD 1

now I have this problem a lot of time:
c:/users/hezi/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: C:\Users\hezi\AppData\Local\Temp\arduino_build_370994\sketch\WiFiNatRouter.ino.cpp.o:(.text.setup+0x44): undefined reference to `ip_napt_init'

@martin-ger
Copy link
Owner

Values are in lwip_napt.h:

/* Default size of the tables used for NAPT */
#define IP_NAPT_MAX 512
#define IP_PORTMAP_MAX 32

You are obviously not linking against the correct lib or you didn't include lwip_napt.h correctly.

@h-g93
Copy link
Author

h-g93 commented Mar 21, 2019

You are right but have this:
#if IP_FORWARD
#if IP_NAPT

/* Default size of the tables used for NAPT /
#define IP_NAPT_MAX 512
#define IP_PORTMAP_MAX 32
.
.
#endif /
IP_NAPT /
#endif /
IP_FORWARD */

that make to not compile the header.

so i dont know what to do i have a lot of problems
Do you think that if i do this project on Linux it will be easier?
what do you recommend?

@emadkavousi
Copy link

hi . i have same error in compiling
exec: "make": executable file not found in $PATH
Error compiling for board NodeMCU 1.0 (ESP-12E Module).
i am in linux environment
i placed your lwip folder in /home/emad/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/tools/sdk/ like you said.
please help me.i really need this for my project

@martin-ger
Copy link
Owner

Guess you tried this on Windows?

@emadkavousi
Copy link

Guess you tried this on Windows?

no .i am in linux.kubuntu 18.04
i do evrything said in repasetory but still have this error

@martin-ger
Copy link
Owner

If you type "make" on the commandline - does ist find the command? If not you probably have to install it.

@emadkavousi
Copy link

If you type "make" on the commandline - does ist find the command? If not you probably have to install it.

thats worked. i install make and i can compile and upload it on my nodeMCU .thank you.

@emadkavousi
Copy link

hi again .i have quastion. how much is muximum speed of this?
i cant get more than 50 KB!!!!!!

@martin-ger
Copy link
Owner

Depends on the signal strength ond loss rate - under good conditions about 4-5 MBit are possible.

@emadkavousi
Copy link

hi. sorry its me again.i have another quastion.
struct pbuf {
/** next pbuf in singly linked pbuf chain */
struct pbuf *next;

/** pointer to the actual data in the buffer */
void *payload;

/**

  • total length of this buffer and all next buffers in chain
  • belonging to the same packet.
  • For non-queue packet chains this is the invariant:
  • p->tot_len == p->len + (p->next? p->next->tot_len: 0)
    */
    u16_t tot_len;

/** length of this buffer */
u16_t len;

/** pbuf_type as u8_t instead of enum to save space */
u8_t /pbuf_type/ type;

/** misc flags */
u8_t flags;

/**

  • the reference count always equals the number of pointers
  • that refer to this pbuf. This can be pointers from an application,
  • the stack itself, or pbuf->next pointers from a chain.
    */
    u16_t ref;

/* add a pointer for esf_buf */
void * eb;
};

its pbuf struct in pbuf.h file .iwant to know what is unit of len and tot_len attributes of this struct?and sum of len can be used to meter trafic that pass from esp?

@martin-ger
Copy link
Owner

uint is bytes, len is the size of this buffer and tot_len the payload length of the complete buffer chain (in almost any case you have yu´´just one buffer here). You can add up tot_len to meter the traffic.

@guigui9
Copy link

guigui9 commented May 29, 2019

Hello,
here is the procedure to install and compile the library in Windows (7, 8.1 and 10).
(thanks for the file "liblwip_src.a").

1) Downloading files :
Download Arduino IDE 1.8.9 (portable) :
  https://downloads.arduino.cc/arduino-1.8.9-windows.zip
Download "lwip_nat_arduino-master.zip" :
  https://codeload.github.com/martin-ger/lwip_nat_arduino/zip/master
Download "hh2.golden.exe" (402 bytes) :
  https://github.com/pts/pts-tinype/raw/master/hh2.golden.exe

2) Configure Arduino with ESP8266 library :
Unzip "arduino-1.8.9-windows.zip" to "C:\App\arduino-ide\"
Makedir "portable" in "C:\App\arduino-ide\"
Create new file : "C:\App\arduino-ide\portable\preferences.txt"
Add line with :
  boardsmanager.additional.urls=http://arduino.esp8266.com/stable/package_esp8266com_index.json
Open IDE Arduino and install ESP8266 library in menu :
  Tools / Boards: "Arduino..." / Boards Manager

3) Install the lwip_nat_arduino library :
Copy and rename "hh2.golden.exe" to "C:\App\arduino-ide\make.exe"
  (to have an empty "make" utility)
Open "lwip_nat_arduino-master.zip"
Next operation in folder :
  "C:\App\arduino-ide\portable\packages\esp8266\hardware\esp8266\2.5.2\tools\"
Rename lwip\ with lwip.orig\ in sdk\
Unzip  lwip\                 in sdk\lwip\
Unzip  liblwip_src.a         in sdk\lib\

4) Change the compilation mode :
Menu : Tools / lwIP Variant: "v1.4 Compile from source"
Menu : Tools / Erase Flash: "Sketch + WiFi Settings"

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

No branches or pull requests

4 participants