Giter Club home page Giter Club logo

libesphttpd_linux_example's Introduction

Introduction

An example of how you can build and run the libesphttpd http server under Linux.

Why?

To provide a way to run Linux analysis tools against a libesphttpd server.

Building

$ git submodule init $ git submodule update $ cd libesphttpd $ git submodule init $ git submodule update $ cd ../ $ mkdir build $ cd build $ cmake ../ $ make

Running

$ ./install/bin/httpd

libesphttpd_linux_example's People

Contributors

chmorgan avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

paulsykes lumax

libesphttpd_linux_example's Issues

/usr/bin/ld: -r and -pie may not be used together

Hello,
i would like to run this linux example on ubuntu 18.04.4 but got the following error:

make[6]: Entering directory '/opt/source/libesphttpd_linux/libesphttpd_linux_example/build/httpd-prefix/src/httpd-build'
[ 20%] Generating libwebpages-espfs.a
cd /opt/source/libesphttpd_linux/libesphttpd_linux_example/httpd/html && find | /opt/source/libesphttpd_linux/libesphttpd_linux_example/build/install/bin/mkespfsimage > /opt/source/libesphttpd_linux/libesphttpd_linux_example/build/httpd-prefix/src/httpd-build/webpages.espfs
wifi/wifi.tpl (55%, heatshrink)
wifi/connecting.html (48%, gzip)
wifi/140medley.min.js (61%, gzip)
wifi/icons.png (100%, none)
wifi/style.css (62%, gzip)
index.html (97%, gzip)
websocket/index.html (42%, gzip)
cd /opt/source/libesphttpd_linux/libesphttpd_linux_example/httpd/html && objcopy -I binary -O elf64-x86-64 -B i386 --rename-section .data=.rodata /opt/source/libesphttpd_linux/libesphttpd_linux_example/build/httpd-prefix/src/httpd-build/webpages.espfs /opt/source/libesphttpd_linux/libesphttpd_linux_example/build/httpd-prefix/src/httpd-build/webpages.espfs.o.tmp
cd /opt/source/libesphttpd_linux/libesphttpd_linux_example/httpd/html && gcc -nostdlib -Wl,-r /opt/source/libesphttpd_linux/libesphttpd_linux_example/build/httpd-prefix/src/httpd-build/webpages.espfs.o.tmp -o /opt/source/libesphttpd_linux/libesphttpd_linux_example/build/httpd-prefix/src/httpd-build/webpages.espfs.o -Wl,-T /opt/source/libesphttpd_linux/libesphttpd_linux_example/httpd/linker.ld
/usr/bin/ld: -r and -pie may not be used together
collect2: error: ld returned 1 exit status
CMakeFiles/libwebpages_target.dir/build.make:80: recipe for target 'libwebpages-espfs.a' failed
make[6]: *** [libwebpages-espfs.a] Error 1
[...]

It seems there is some "-pie stuff" involved in mkespfsimage building before COMMAND gcc -nostdlib -Wl,-r ... from libesphttpd_linux_example/httpd/CMakeLists.txt.

I cannot figure out how to handle this.
Can someone help me with this?

Thanks and best regards,

Bastian.

Unable to build

I'm trying to build the example on Arch Linux.

$ uname -a
Linux nadja 5.8.3-arch1-1 #1 SMP PREEMPT Fri, 21 Aug 2020 16:54:16 +0000 x86_64 GNU/Linux
$ cmake --version
cmake version 3.18.2
$ make --version
GNU Make 4.3
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ gcc --version
gcc (GCC) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

When running make the compilation fails complaining the lack of the ESPHTTPD_LIBRARY variable.

$ git clone --recursive https://github.com/chmorgan/libesphttpd_linux_example.git
$ cd libesphttpd_linux_example
$ mkdir build
$ cd build
$ cmake ../
$ make
Scanning dependencies of target tests
[  4%] Creating directories for 'tests'
[  8%] No download step for 'tests'
[ 12%] No update step for 'tests'
[ 16%] No patch step for 'tests'
[ 20%] Performing configure step for 'tests'
CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- The C compiler identification is GNU 10.2.0
-- The CXX compiler identification is GNU 10.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/libesphttpd_linux_example/build/tests-prefix/src/tests-build
[ 25%] Performing build step for 'tests'
[ 29%] Performing install step for 'tests'
Install the project...
-- Install configuration: ""
-- Installing: /tmp/libesphttpd_linux_example/build/install/bin/test_post.sh
-- Installing: /tmp/libesphttpd_linux_example/build/install/bin/test_too_long_url.sh
[ 33%] Completed 'tests'
[ 33%] Built target tests
Scanning dependencies of target httpd
[ 37%] Creating directories for 'httpd'
[ 41%] No download step for 'httpd'
[ 45%] No update step for 'httpd'
[ 50%] No patch step for 'httpd'
[ 54%] Performing configure step for 'httpd'
CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- The C compiler identification is GNU 10.2.0
-- The CXX compiler identification is GNU 10.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- cacert.der
-- /tmp/libesphttpd_linux_example/build/httpd-prefix/src/httpd-build/cacert.der
-- prvtkey.der
-- /tmp/libesphttpd_linux_example/build/httpd-prefix/src/httpd-build/prvtkey.der
-- Found OpenSSL: /usr/lib/libcrypto.so (found version "1.1.1g")  
-- Using OpenSSL 1.1.1g
-- rt found /usr/lib/librt.so
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
Found library ESPHTTPD_LIBRARY-NOTFOUND
-- Configuring done
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
ESPHTTPD_LIBRARY
    linked by target "httpd" in directory /tmp/libesphttpd_linux_example/httpd

-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.
make[2]: *** [CMakeFiles/httpd.dir/build.make:125: httpd-prefix/src/httpd-stamp/httpd-configure] Error 1
make[1]: *** [CMakeFiles/Makefile2:126: CMakeFiles/httpd.dir/all] Error 2
make: *** [Makefile:114: all] Error 2

Am I missing some steps?

Error when running make

Following the build instructions I get the following error when running make

paul@ae25:~/work/libesphttpd_linux_example/build$ make
[ 4%] Creating directories for 'esphttpd'
[ 8%] No download step for 'esphttpd'
[ 12%] No patch step for 'esphttpd'
[ 16%] No update step for 'esphttpd'
[ 20%] Performing configure step for 'esphttpd'
-- Configuring done
-- Generating done
-- Build files have been written to: /home/paul/work/libesphttpd_linux_example/build/esphttpd-prefix/src/esphttpd-build
[ 25%] Performing build step for 'esphttpd'
[ 7%] Building C object CMakeFiles/esphttpd.dir/core/httpd-freertos.c.o
/home/paul/work/libesphttpd_linux_example/libesphttpd/core/httpd-freertos.c: In function ‘sslCreateContext’:
/home/paul/work/libesphttpd_linux_example/libesphttpd/core/httpd-freertos.c:152:23: error: implicit declaration of function ‘TLS_server_method’ [-Werror=implicit-function-declaration]
ctx = SSL_CTX_new(TLS_server_method());
^
/home/paul/work/libesphttpd_linux_example/libesphttpd/core/httpd-freertos.c:152:23: error: passing argument 1 of ‘SSL_CTX_new’ makes pointer from integer without a cast [-Werror=int-conversion]
In file included from /home/paul/work/libesphttpd_linux_example/libesphttpd/include/libesphttpd/httpd-freertos.h:14:0,
from /home/paul/work/libesphttpd_linux_example/libesphttpd/core/httpd-freertos.c:31:
/usr/include/openssl/ssl.h:2131:10: note: expected ‘const SSL_METHOD * {aka const struct ssl_method_st *}’ but argument is of type ‘int’
SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth);
^
/home/paul/work/libesphttpd_linux_example/libesphttpd/core/httpd-freertos.c: In function ‘platHttpServerTask’:
/home/paul/work/libesphttpd_linux_example/libesphttpd/core/httpd-freertos.c:489:51: error: implicit declaration of function ‘SSL_has_pending’ [-Werror=implicit-function-declaration]
bytesStillAvailable = SSL_has_pending(pRconn->ssl);
^
cc1: all warnings being treated as errors
CMakeFiles/esphttpd.dir/build.make:158: recipe for target 'CMakeFiles/esphttpd.dir/core/httpd-freertos.c.o' failed
make[5]: *** [CMakeFiles/esphttpd.dir/core/httpd-freertos.c.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/esphttpd.dir/all' failed
make[4]: *** [CMakeFiles/esphttpd.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make[3]: *** [all] Error 2
CMakeFiles/esphttpd.dir/build.make:110: recipe for target 'esphttpd-prefix/src/esphttpd-stamp/esphttpd-build' failed
make[2]: *** [esphttpd-prefix/src/esphttpd-stamp/esphttpd-build] Error 2
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/esphttpd.dir/all' failed
make[1]: *** [CMakeFiles/esphttpd.dir/all] Error 2
Makefile:94: recipe for target 'all' failed
make: *** [all] Error 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.