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

Compile error when building civetweb samples for posix_native #34226

Closed
mglettig opened this issue Apr 12, 2021 · 9 comments · Fixed by #46746
Closed

Compile error when building civetweb samples for posix_native #34226

mglettig opened this issue Apr 12, 2021 · 9 comments · Fixed by #46746
Assignees
Labels
area: civetweb area: Networking bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@mglettig
Copy link

mglettig commented Apr 12, 2021

Describe the bug
Using Zephyr 2.5.0 the build of civetweb http_server sample fails for the board posix_native. From the build logs it looks like an issue with conflicting types (useconds_t, pthread_t, pthread_mutexattr_t, pthread_condattr_t, ...)

To Reproduce
west build -b native_posix samples/net/civetweb/http_server

Expected behavior
The build should succeed.

Impact
For testing purposes it would be very convenient to run the webserver on x86. An alternative approach would be to use QEMU. But this doesn't work to to limited SRAM of qemu_cortex_m3.

Logs and console output

root@fce79450bfae:/opt/zephyrproject/zephyr# west build -b native_posix samples/net/civetweb/http_server
-- west build: generating a build system
Including boilerplate (Zephyr base): /opt/zephyrproject/zephyr/cmake/app/boilerplate.cmake
-- Application: /opt/zephyrproject/zephyr/samples/net/civetweb/http_server
-- Zephyr version: 2.5.0 (/opt/zephyrproject/zephyr)
-- Found Python3: /usr/bin/python3.8 (found suitable exact version "3.8.5") found components: Interpreter 
-- Found west (found suitable version "0.10.1", minimum required is "0.7.1")
-- Board: native_posix
-- Cache files will be written to: /root/.cache/zephyr
-- Found dtc: /usr/bin/dtc (found suitable version "1.5.0", minimum required is "1.4.6")
-- Found toolchain: host (gcc/ld)
-- Found BOARD.dts: /opt/zephyrproject/zephyr/boards/posix/native_posix/native_posix.dts
-- Generated zephyr.dts: /opt/zephyrproject/zephyr/build/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: /opt/zephyrproject/zephyr/build/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: /opt/zephyrproject/zephyr/build/zephyr/include/generated/device_extern.h

warning: MINIMAL_LIBC_MALLOC_ARENA_SIZE (defined at lib/libc/Kconfig:102) was assigned the value
'16384' but got the value ''. Check these unsatisfied dependencies: MINIMAL_LIBC_MALLOC (=n),
MINIMAL_LIBC (=n). See
http://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE.html
and/or look up MINIMAL_LIBC_MALLOC_ARENA_SIZE in the menuconfig/guiconfig interface. The Application
Development Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices sections of
the manual might be helpful too.


warning: POSIX_API (defined at lib/posix/Kconfig:12) was assigned the value 'y' but got the value
'n'. Check these unsatisfied dependencies: (!ARCH_POSIX) (=n). See
http://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_POSIX_API.html and/or look up
POSIX_API in the menuconfig/guiconfig interface. The Application Development Primer, Setting
Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful
too.

Parsing /opt/zephyrproject/zephyr/Kconfig
Loaded configuration '/opt/zephyrproject/zephyr/boards/posix/native_posix/native_posix_defconfig'
Merged configuration '/opt/zephyrproject/zephyr/samples/net/civetweb/http_server/prj.conf'
Configuration saved to '/opt/zephyrproject/zephyr/build/zephyr/.config'
Kconfig header saved to '/opt/zephyrproject/zephyr/build/zephyr/include/generated/autoconf.h'
^Croot@fce79450bfae:/opt/zephyrproject/zephyr# west build -b native_posix samples/net/civetweb/my_http_server
-- west build: generating a build system
Including boilerplate (Zephyr base): /opt/zephyrproject/zephyr/cmake/app/boilerplate.cmake
-- Application: /opt/zephyrproject/zephyr/samples/net/civetweb/my_http_server
-- Zephyr version: 2.5.0 (/opt/zephyrproject/zephyr)
-- Found Python3: /usr/bin/python3.8 (found suitable exact version "3.8.5") found components: Interpreter 
-- Found west (found suitable version "0.10.1", minimum required is "0.7.1")
-- Board: native_posix
-- Cache files will be written to: /root/.cache/zephyr
-- Found dtc: /usr/bin/dtc (found suitable version "1.5.0", minimum required is "1.4.6")
-- Found toolchain: host (gcc/ld)
-- Found BOARD.dts: /opt/zephyrproject/zephyr/boards/posix/native_posix/native_posix.dts
-- Generated zephyr.dts: /opt/zephyrproject/zephyr/build/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: /opt/zephyrproject/zephyr/build/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: /opt/zephyrproject/zephyr/build/zephyr/include/generated/device_extern.h
Parsing /opt/zephyrproject/zephyr/Kconfig
Loaded configuration '/opt/zephyrproject/zephyr/build/zephyr/.config'
No change to configuration in '/opt/zephyrproject/zephyr/build/zephyr/.config'
No change to Kconfig header in '/opt/zephyrproject/zephyr/build/zephyr/include/generated/autoconf.h'
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/gcc
-- Target architecture - x86_64
-- Enabling tests in the build - ON
-- Thread Stack Size - 102400
-- Enabling server executable - ON
-- Serve no static files - OFF
-- Disable CGI support - OFF
-- Disable caching support - OFF
-- C++ wrappers - OFF
-- IP Version 6 - OFF
-- Websockets support - OFF
-- Server statistics support - OFF
-- Memory Debugging - OFF
-- ASAN in debug mode - ON
-- Force x32 / x64 architecture - OFF
-- Lua CGI support - OFF
-- Executable installation - ON
-- Build if there are warnings - ON
-- Duktape CGI support - OFF
-- SSL support - ON
-- Compile for OpenSSL 1.1 API - OFF
-- Dynamically load SSL libraries - ON
-- Configuring C Compiler
-- Performing Test HAVE_C_FLAG_STD_C11
-- Performing Test HAVE_C_FLAG_STD_C11 - Success
-- Performing Test HAVE_C_FLAG_FSANITIZE_UNDEFINED
-- Performing Test HAVE_C_FLAG_FSANITIZE_UNDEFINED - Success
-- Performing Test HAVE_C_FLAG_FSANITIZE_ADDRESS
-- Performing Test HAVE_C_FLAG_FSANITIZE_ADDRESS - Success
-- Performing Test HAVE_C_FLAG_STATIC_ASAN
-- Performing Test HAVE_C_FLAG_STATIC_ASAN - Failed
-- Performing Test HAVE_C_FLAG_COVERAGE
-- Performing Test HAVE_C_FLAG_COVERAGE - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /opt/zephyrproject/zephyr/build
-- west build: building application
[1/132] Preparing syscall dependency handling

[9/132] Building C object CMakeFiles/app.dir/src/main.c.obj
/opt/zephyrproject/zephyr/samples/net/civetweb/my_http_server/src/main.c: In function ‘main_pthread’:
/opt/zephyrproject/zephyr/samples/net/civetweb/my_http_server/src/main.c:161:2: warning: implicit declaration of function ‘memset’ [-Wimplicit-function-declaration]
  161 |  memset(&callbacks, 0, sizeof(callbacks));
      |  ^~~~~~
/opt/zephyrproject/zephyr/samples/net/civetweb/my_http_server/src/main.c:161:2: warning: incompatible implicit declaration of built-in function ‘memset’
/opt/zephyrproject/zephyr/samples/net/civetweb/my_http_server/src/main.c:12:1: note: include ‘<string.h>’ or provide a declaration of ‘memset’
   11 | #include "civetweb.h"
  +++ |+#include <string.h>
   12 | 
/opt/zephyrproject/zephyr/samples/net/civetweb/my_http_server/src/main.c: In function ‘zephyr_app_main’:
/opt/zephyrproject/zephyr/samples/net/civetweb/my_http_server/src/main.c:181:8: warning: implicit declaration of function ‘pthread_attr_init’ [-Wimplicit-function-declaration]
  181 |  (void)pthread_attr_init(&civetweb_attr);
      |        ^~~~~~~~~~~~~~~~~
/opt/zephyrproject/zephyr/samples/net/civetweb/my_http_server/src/main.c:182:8: warning: implicit declaration of function ‘pthread_attr_setstack’ [-Wimplicit-function-declaration]
  182 |  (void)pthread_attr_setstack(&civetweb_attr, &civetweb_stack,
      |        ^~~~~~~~~~~~~~~~~~~~~
/opt/zephyrproject/zephyr/samples/net/civetweb/my_http_server/src/main.c:185:8: warning: implicit declaration of function ‘pthread_create’; did you mean ‘k_thread_create’? [-Wimplicit-function-declaration]
  185 |  (void)pthread_create(&civetweb_thread, &civetweb_attr,
      |        ^~~~~~~~~~~~~~
      |        k_thread_create
[105/132] Building C object modules/civetweb/CMakeFiles/..__modules__lib__civetweb.dir/src/civetweb.c.obj
FAILED: modules/civetweb/CMakeFiles/..__modules__lib__civetweb.dir/src/civetweb.c.obj 
ccache /usr/bin/gcc -DBUILD_VERSION=zephyr-v2.5.0 -DKERNEL -DMG_EXTERNAL_FUNCTION_log_access -DMG_EXTERNAL_FUNCTION_mg_cry_internal_impl -DNO_ALTERNATIVE_QUEUE -DNO_CACHING -DNO_CGI -DNO_FILES -DNO_FILESYSTEMS -DNO_SSL -DUSE_STACK_SIZE=0 -DZEPHYR_VERSION=\"2.5.0\" -D_FORTIFY_SOURCE=2 -D_POSIX_C_SOURCE=200809 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED -D__ZEPHYR__=1 -I/opt/zephyrproject/zephyr/samples/net/civetweb/my_http_server/../common/include -I/opt/zephyrproject/zephyr/include -Izephyr/include/generated -I/opt/zephyrproject/zephyr/soc/posix/inf_clock -I/opt/zephyrproject/zephyr/boards/posix/native_posix -I/opt/zephyrproject/zephyr/subsys/net/lib/sockets/. -I/opt/zephyrproject/zephyr/subsys/net/lib/dns/. -I/opt/zephyrproject/zephyr/subsys/net/l2 -I/opt/zephyrproject/modules/lib/civetweb/include -I/opt/zephyrproject/modules/lib/civetweb/src -I/opt/zephyrproject/zephyr/samples/net/civetweb/my_http_server/src -std=c11   -Os -imacros /opt/zephyrproject/zephyr/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -imacros /opt/zephyrproject/zephyr/include/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wno-address-of-packed-member -Wno-unused-but-set-variable -Werror=implicit-int -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-strict-overflow -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=/opt/zephyrproject/zephyr/samples/net/civetweb/my_http_server=CMAKE_SOURCE_DIR -fmacro-prefix-map=/opt/zephyrproject/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/opt/zephyrproject=WEST_TOPDIR -ffunction-sections -fdata-sections -m32 -include /opt/zephyrproject/zephyr/arch/posix/include/posix_cheats.h -fno-freestanding -std=c11 -MD -MT modules/civetweb/CMakeFiles/..__modules__lib__civetweb.dir/src/civetweb.c.obj -MF modules/civetweb/CMakeFiles/..__modules__lib__civetweb.dir/src/civetweb.c.obj.d -o modules/civetweb/CMakeFiles/..__modules__lib__civetweb.dir/src/civetweb.c.obj   -c /opt/zephyrproject/modules/lib/civetweb/src/civetweb.c
In file included from /opt/zephyrproject/zephyr/include/posix/time.h:61,
                 from /opt/zephyrproject/zephyr/include/posix/pthread.h:12,
                 from /opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:170:
/opt/zephyrproject/zephyr/include/posix/posix_types.h:36:16: error: ‘pthread_attr_t’ defined as wrong kind of tag
   36 | typedef struct pthread_attr_t {
      |                ^~~~~~~~~~~~~~
/opt/zephyrproject/zephyr/include/posix/posix_types.h:45:3: error: conflicting types for ‘pthread_attr_t’
   45 | } pthread_attr_t;
      |   ^~~~~~~~~~~~~~
In file included from /usr/include/sys/types.h:227,
                 from /opt/zephyrproject/zephyr/include/net/socket.h:25,
                 from /opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:169:
/usr/include/bits/pthreadtypes.h:62:30: note: previous declaration of ‘pthread_attr_t’ was here
   62 | typedef union pthread_attr_t pthread_attr_t;
      |                              ^~~~~~~~~~~~~~
In file included from /opt/zephyrproject/zephyr/include/posix/time.h:61,
                 from /opt/zephyrproject/zephyr/include/posix/pthread.h:12,
                 from /opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:170:
/opt/zephyrproject/zephyr/include/posix/posix_types.h:47:15: error: conflicting types for ‘pthread_t’
   47 | typedef void *pthread_t;
      |               ^~~~~~~~~
In file included from /usr/include/sys/types.h:227,
                 from /opt/zephyrproject/zephyr/include/net/socket.h:25,
                 from /opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:169:
/usr/include/bits/pthreadtypes.h:27:27: note: previous declaration of ‘pthread_t’ was here
   27 | typedef unsigned long int pthread_t;
      |                           ^~~~~~~~~
In file included from /opt/zephyrproject/zephyr/include/posix/time.h:61,
                 from /opt/zephyrproject/zephyr/include/posix/pthread.h:12,
                 from /opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:170:
/opt/zephyrproject/zephyr/include/posix/posix_types.h:58:3: error: conflicting types for ‘pthread_mutex_t’
   58 | } pthread_mutex_t;
      |   ^~~~~~~~~~~~~~~
In file included from /usr/include/sys/types.h:227,
                 from /opt/zephyrproject/zephyr/include/net/socket.h:25,
                 from /opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:169:
/usr/include/bits/pthreadtypes.h:72:3: note: previous declaration of ‘pthread_mutex_t’ was here
   72 | } pthread_mutex_t;
      |   ^~~~~~~~~~~~~~~
In file included from /opt/zephyrproject/zephyr/include/posix/time.h:61,
                 from /opt/zephyrproject/zephyr/include/posix/pthread.h:12,
                 from /opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:170:
/opt/zephyrproject/zephyr/include/posix/posix_types.h:62:3: error: conflicting types for ‘pthread_mutexattr_t’
   62 | } pthread_mutexattr_t;
      |   ^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/sys/types.h:227,
                 from /opt/zephyrproject/zephyr/include/net/socket.h:25,
                 from /opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:169:
/usr/include/bits/pthreadtypes.h:36:3: note: previous declaration of ‘pthread_mutexattr_t’ was here
   36 | } pthread_mutexattr_t;
      |   ^~~~~~~~~~~~~~~~~~~
In file included from /opt/zephyrproject/zephyr/include/posix/time.h:61,
                 from /opt/zephyrproject/zephyr/include/posix/pthread.h:12,
                 from /opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:170:
/opt/zephyrproject/zephyr/include/posix/posix_types.h:67:3: error: conflicting types for ‘pthread_cond_t’
   67 | } pthread_cond_t;
      |   ^~~~~~~~~~~~~~
In file included from /usr/include/sys/types.h:227,
                 from /opt/zephyrproject/zephyr/include/net/socket.h:25,
                 from /opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:169:
/usr/include/bits/pthreadtypes.h:80:3: note: previous declaration of ‘pthread_cond_t’ was here
   80 | } pthread_cond_t;
      |   ^~~~~~~~~~~~~~
In file included from /opt/zephyrproject/zephyr/include/posix/time.h:61,
                 from /opt/zephyrproject/zephyr/include/posix/pthread.h:12,
                 from /opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:170:
/opt/zephyrproject/zephyr/include/posix/posix_types.h:70:3: error: conflicting types for ‘pthread_condattr_t’
   70 | } pthread_condattr_t;
      |   ^~~~~~~~~~~~~~~~~~
In file included from /usr/include/sys/types.h:227,
                 from /opt/zephyrproject/zephyr/include/net/socket.h:25,
                 from /opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:169:
/usr/include/bits/pthreadtypes.h:45:3: note: previous declaration of ‘pthread_condattr_t’ was here
   45 | } pthread_condattr_t;
      |   ^~~~~~~~~~~~~~~~~~
In file included from /opt/zephyrproject/zephyr/include/posix/time.h:61,
                 from /opt/zephyrproject/zephyr/include/posix/pthread.h:12,
                 from /opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:170:
/opt/zephyrproject/zephyr/include/posix/posix_types.h:77:3: error: conflicting types for ‘pthread_barrier_t’
   77 | } pthread_barrier_t;
      |   ^~~~~~~~~~~~~~~~~
In file included from /usr/include/sys/types.h:227,
                 from /opt/zephyrproject/zephyr/include/net/socket.h:25,
                 from /opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:169:
/usr/include/bits/pthreadtypes.h:112:3: note: previous declaration of ‘pthread_barrier_t’ was here
  112 | } pthread_barrier_t;
      |   ^~~~~~~~~~~~~~~~~
In file included from /opt/zephyrproject/zephyr/include/posix/time.h:61,
                 from /opt/zephyrproject/zephyr/include/posix/pthread.h:12,
                 from /opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:170:
/opt/zephyrproject/zephyr/include/posix/posix_types.h:80:3: error: conflicting types for ‘pthread_barrierattr_t’
   80 | } pthread_barrierattr_t;
      |   ^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/sys/types.h:227,
                 from /opt/zephyrproject/zephyr/include/net/socket.h:25,
                 from /opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:169:
/usr/include/bits/pthreadtypes.h:118:3: note: previous declaration of ‘pthread_barrierattr_t’ was here
  118 | } pthread_barrierattr_t;
      |   ^~~~~~~~~~~~~~~~~~~~~
In file included from /opt/zephyrproject/zephyr/include/posix/time.h:61,
                 from /opt/zephyrproject/zephyr/include/posix/pthread.h:12,
                 from /opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:170:
/opt/zephyrproject/zephyr/include/posix/posix_types.h:82:18: error: conflicting types for ‘pthread_rwlockattr_t’
   82 | typedef uint32_t pthread_rwlockattr_t;
      |                  ^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/sys/types.h:227,
                 from /opt/zephyrproject/zephyr/include/net/socket.h:25,
                 from /opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:169:
/usr/include/bits/pthreadtypes.h:97:3: note: previous declaration of ‘pthread_rwlockattr_t’ was here
   97 | } pthread_rwlockattr_t;
      |   ^~~~~~~~~~~~~~~~~~~~
In file included from /opt/zephyrproject/zephyr/include/posix/time.h:61,
                 from /opt/zephyrproject/zephyr/include/posix/pthread.h:12,
                 from /opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:170:
/opt/zephyrproject/zephyr/include/posix/posix_types.h:90:3: error: conflicting types for ‘pthread_rwlock_t’
   90 | } pthread_rwlock_t;
      |   ^~~~~~~~~~~~~~~~
In file included from /usr/include/sys/types.h:227,
                 from /opt/zephyrproject/zephyr/include/net/socket.h:25,
                 from /opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:169:
/usr/include/bits/pthreadtypes.h:91:3: note: previous declaration of ‘pthread_rwlock_t’ was here
   91 | } pthread_rwlock_t;
      |   ^~~~~~~~~~~~~~~~
In file included from /opt/zephyrproject/zephyr/include/posix/pthread.h:16,
                 from /opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:170:
/opt/zephyrproject/zephyr/include/posix/pthread_key.h:18:18: error: conflicting types for ‘pthread_once_t’
   18 | typedef uint32_t pthread_once_t;
      |                  ^~~~~~~~~~~~~~
In file included from /usr/include/sys/types.h:227,
                 from /opt/zephyrproject/zephyr/include/net/socket.h:25,
                 from /opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:169:
/usr/include/bits/pthreadtypes.h:53:30: note: previous declaration of ‘pthread_once_t’ was here
   53 | typedef int __ONCE_ALIGNMENT pthread_once_t;
      |                              ^~~~~~~~~~~~~~
In file included from /opt/zephyrproject/zephyr/include/posix/pthread.h:16,
                 from /opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:170:
/opt/zephyrproject/zephyr/include/posix/pthread_key.h:21:15: error: conflicting types for ‘pthread_key_t’
   21 | typedef void *pthread_key_t;
      |               ^~~~~~~~~~~~~
In file included from /usr/include/sys/types.h:227,
                 from /opt/zephyrproject/zephyr/include/net/socket.h:25,
                 from /opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:169:
/usr/include/bits/pthreadtypes.h:49:22: note: previous declaration of ‘pthread_key_t’ was here
   49 | typedef unsigned int pthread_key_t;
      |                      ^~~~~~~~~~~~~
In file included from /usr/include/bits/fcntl-linux.h:38,
                 from /usr/include/bits/fcntl.h:61,
                 from /usr/include/fcntl.h:35,
                 from /opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:177:
/usr/include/bits/types/struct_iovec.h:26:8: error: redefinition of ‘struct iovec’
   26 | struct iovec
      |        ^~~~~
In file included from /opt/zephyrproject/zephyr/include/net/socket.h:27,
                 from /opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:169:
/opt/zephyrproject/zephyr/include/net/net_ip.h:221:8: note: originally defined here
  221 | struct iovec {
      |        ^~~~~
In file included from /opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:168:
/opt/zephyrproject/zephyr/samples/net/civetweb/my_http_server/../common/include/libc_extensions.h:26:17: error: expected ‘)’ before ‘c’
   26 | int iscntrl(int c);
      |                 ^
/opt/zephyrproject/zephyr/samples/net/civetweb/my_http_server/../common/include/libc_extensions.h:26:5: note: to match this ‘(’
   26 | int iscntrl(int c);
      |     ^~~~~~~
/opt/zephyrproject/zephyr/samples/net/civetweb/my_http_server/../common/include/libc_extensions.h:26:5: error: expected expression before ‘)’ token
   26 | int iscntrl(int c);
      |     ^~~~~~~
/opt/zephyrproject/modules/lib/civetweb/src/civetweb.c: In function ‘pull_inner’:
/opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:6426:16: warning: implicit declaration of function ‘read’; did you mean ‘fread’? [-Wimplicit-function-declaration]
 6426 |   nread = (int)read(fileno(fp), buf, (size_t)len);
      |                ^~~~
      |                fread
/opt/zephyrproject/modules/lib/civetweb/src/civetweb.c: In function ‘connect_socket’:
/opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:853:25: warning: implicit declaration of function ‘close’; did you mean ‘pclose’? [-Wimplicit-function-declaration]
  853 | #define closesocket(a) (close(a))
      |                         ^~~~~
/opt/zephyrproject/modules/lib/civetweb/src/civetweb.c:8942:3: note: in expansion of macro ‘closesocket’
 8942 |   closesocket(*sock);
      |   ^~~~~~~~~~~
[106/132] Building C object zephyr/kernel/CMakeFiles/kernel.dir/idle.c.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /opt/zephyrproject/zephyr/build

Environment (please complete the following information):

  • OS: Ubuntu 20.04 (running in Docker)
  • Toolchain (gcc-arm-none-eabi-8-2019-q3-update-linux & zephyr-sdk-0.12.4)
  • Zephyr 2.5.0

Additional context
Add any other context about the problem here.

@mglettig mglettig added the bug The issue is a bug, or the PR is fixing a bug label Apr 12, 2021
@mglettig
Copy link
Author

Could this be related to the following topic #13054? Is it currently not possible to use POSIX subsytem for ARCH_POSIX?

@KozhinovAlexander
Copy link
Collaborator

Hello and thank you for your bug description. I think, that posix support for civetweb need to be rethinked.
The first guys, who ported civetweb, were cool dudes from Anrmicro. @PiotrZierhoffer can you provide more info on posix support within civetweb?

@PiotrZierhoffer
Copy link
Collaborator

I must say it's been a while, and the civetweb module got pulled in during a very heated discussion on the POSIX APIs. I'm not very familiar with the current state of affairs in this topic.

If what @mglettig mentions still holds, then it is definitely a relevant problem. And it does seem so from your log:

warning: POSIX_API (defined at lib/posix/Kconfig:12) was assigned the value 'y' but got the value
'n'. Check these unsatisfied dependencies: (!ARCH_POSIX) (=n).

So Civetweb relies on the POSIX_API, and I'm not aware if there is any "switch" that you can use to turn to native POSIX. If there's a "standard way of handling this", then it should not be very difficult to apply to Civetweb, the port is not very complex. I would assume that we'd need to adjust ifdefs here and there: from #if ZEPHYR to #if ZEPHYR && !ARCH_POSIX, maybe?

@galak
Copy link
Collaborator

galak commented May 11, 2021

@Nukersson any updates on this?

@KozhinovAlexander
Copy link
Collaborator

KozhinovAlexander commented May 11, 2021

@Nukersson any updates on this?

Some progress can be seen here: #34438

But I am not actively involved into it. Just monitoring and trying to help, where I can. At the end I can do the tests on my HW of course, before the merge can be done.
It looks currently, that multiple posix functions, needed by Civetweb, must be implemented in Zephyr posix api. But not all the functionality is possible, since there are some constraints from the HW side.

Would you like to support?

@github-actions
Copy link

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

@github-actions github-actions bot added the Stale label Jul 11, 2021
@stephanosio stephanosio removed the Stale label Feb 18, 2022
@stephanosio stephanosio reopened this Feb 18, 2022
@stephanosio stephanosio changed the title Compile error when building civetweb http_server sample for posix_native Compile error when building civetweb samples for posix_native Feb 18, 2022
@stephanosio
Copy link
Member

Re-opening since this is still a valid issue.

@cfriedt
Copy link
Member

cfriedt commented Apr 11, 2022

This is probably fixed by #43987

mbolivar-nordic added a commit to mbolivar-nordic/zephyr that referenced this issue Jun 21, 2022
This code has gone unmaintained and bugs continue to be reported
against it. We do not have the resources as a project to maintain this
in "odd fixes" mode, and nobody has stepped up to maintain it [1], so
sadly this must be removed for now.

If anyone would like to see civetweb supported in upstream Zephyr
again, they are welcome to add it back, as long as they promise to
maintain it going forward.

Many thanks to everyone who has contributed to civetweb support in
Zephyr while it was here. So long and thanks for all the fish.

Fixes: zephyrproject-rtos#45807
Fixes: zephyrproject-rtos#43910
Fixes: zephyrproject-rtos#34226
Fixes: zephyrproject-rtos#46743

[1] https://lists.zephyrproject.org/g/devel/message/8466

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
mbolivar-nordic added a commit that referenced this issue Jun 22, 2022
This code has gone unmaintained and bugs continue to be reported
against it. We do not have the resources as a project to maintain this
in "odd fixes" mode, and nobody has stepped up to maintain it [1], so
sadly this must be removed for now.

If anyone would like to see civetweb supported in upstream Zephyr
again, they are welcome to add it back, as long as they promise to
maintain it going forward.

Many thanks to everyone who has contributed to civetweb support in
Zephyr while it was here. So long and thanks for all the fish.

Fixes: #45807
Fixes: #43910
Fixes: #34226
Fixes: #46743

[1] https://lists.zephyrproject.org/g/devel/message/8466

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
@mbolivar-nordic
Copy link
Contributor

"Fixed" by the removal of civetweb. See #46746 for more details. Thanks for taking the time to file an issue and sorry for the inconvenience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: civetweb area: Networking bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants