Project

General

Profile

Actions

Feature #3130

closed

Solaris build fix proposal

Added by devnexen over 2 years ago. Updated over 2 years ago.

Status:
Fixed
Priority:
Low
Category:
build_cmake
Target version:
ASK QUESTIONS IN Forums:
No

Files

Actions #1

Updated by gstrauss over 2 years ago

  • Tracker changed from Bug to Feature
  • Category set to build_cmake
  • Priority changed from Normal to Low

Please do not spit patches without context.

What is your test platform and version of Solaris? What lighttpd commit are you building against? What are the build issues? Have you tested only CMake build of lighttpd?

Actions #2

Updated by devnexen over 2 years ago

- Illumos but the linkage issues are the same on Solaris too.
- from master branch.
- Linkage and errno_t availability issues stated in the patch.

Actions #3

Updated by devnexen over 2 years ago

if you wonder why the change for the HAVE_SYS_LOADAVG_H detection, the detection failed because loadavg struct used the alias type hrtime_t which is defined in sys/time.h

Actions #4

Updated by gstrauss over 2 years ago

Please provide compiler error messages. The errno_t patch to ck.h is fine. I have questions for the rest.

A long time ago, I recall that the link order of -lsocket -lnsl on Solaris mattered (but I don't recall the correct order). Is that still the case?

Why remove -std=gnu99 for gcc and clang?

Have you tested only CMake build of lighttpd?

Actions #5

Updated by devnexen over 2 years ago

- The order of linkage does not matter it passes.
- for the std=gnu99 removal it seems it had been switched to C11 but it can be put back if it makes sense, the build pass without.
- I ve tested meson and the loadavg part is well detected in this case contrary to cmake, but I admit I m much well less versed with meson (e.g. os detection etc), so it s mainly a cmake fix indeed.
- here the compiler errors on master

/export/home/dcarlier/Contribs/lighttpd1.4/src/ck.h:39:1: error: unknown type name 'errno_t'
errno_t ck_getenv_s (size_t * restrict len, char * restrict value, rsize_t maxsize, const char * restrict name);
^
/export/home/dcarlier/Contribs/lighttpd1.4/src/ck.h:43:1: error: unknown type name 'errno_t'
errno_t ck_memclear_s (void *s, rsize_t smax, rsize_t n);
^
/export/home/dcarlier/Contribs/lighttpd1.4/src/ck.h:47:15: error: unknown type name 'errno_t'
static inline errno_t ck_memzero(void *s, rsize_t n);
              ^
/export/home/dcarlier/Contribs/lighttpd1.4/src/ck.h:48:15: error: unknown type name 'errno_t'
static inline errno_t ck_memzero(void *s, rsize_t n) {
              ^
/export/home/dcarlier/Contribs/lighttpd1.4/src/ck.h:52:1: error: unknown type name 'errno_t'
errno_t ck_strerror_s (char *s, rsize_t maxsize, errno_t errnum);
^
/export/home/dcarlier/Contribs/lighttpd1.4/src/ck.h:52:50: error: unknown type name 'errno_t'
errno_t ck_strerror_s (char *s, rsize_t maxsize, errno_t errnum);

linkage issues

[ 43%] Linking C executable fcgi-responder
Undefined            first referenced
 symbol                  in file
recv                                CMakeFiles/fcgi-responder.dir/fcgi-responder.c.o
accept                              CMakeFiles/fcgi-responder.dir/fcgi-responder.c.o

...

 88%] Linking C executable lighttpd
ld: warning: entry point option (-e, --entry) appears more than once, first setting taken
Undefined            first referenced
 symbol                  in file
__xnet_connect                      CMakeFiles/lighttpd.dir/network.c.o
__xnet_socket                       CMakeFiles/lighttpd.dir/fdevent.c.o
__xnet_getsockopt                   CMakeFiles/lighttpd.dir/network.c.o
getsockname                         CMakeFiles/lighttpd.dir/server.c.o
accept                              CMakeFiles/lighttpd.dir/fdevent.c.o
listen                              CMakeFiles/lighttpd.dir/network.c.o
gethostbyaddr                       CMakeFiles/lighttpd.dir/sock_addr.c.o
accept4                             CMakeFiles/lighttpd.dir/fdevent.c.o
setsockopt                          CMakeFiles/lighttpd.dir/connections.c.o
__xnet_getaddrinfo                  CMakeFiles/lighttpd.dir/sock_addr.c.o
getpeername                         CMakeFiles/lighttpd.dir/server.c.o
freeaddrinfo                        CMakeFiles/lighttpd.dir/sock_addr.c.o
__xnet_bind                         CMakeFiles/lighttpd.dir/network.c.o
gai_strerror                        CMakeFiles/lighttpd.dir/sock_addr.c.o
h_errno                             CMakeFiles/lighttpd.dir/sock_addr.c.o
shutdown                            CMakeFiles/lighttpd.dir/connections.c.o

Actions #6

Updated by gstrauss over 2 years ago

Does linking -lsocket -lnsl work on Illumos with the meson build?

I've pushed some commits for small items. I'll look at more of the CMakeLists.txt changes tomorrow.

Actions #7

Updated by devnexen over 2 years ago

The meson configure part does not pass, it stop at pcre/pcre2 detection (do not know if it relies on pkg-config, but there is no pkg-config package out of the box for illumos) but if, for ex, I modify the line :

libpcre: [ dependency('libpcre')]

to

libpcre: compiler.find_library('pcre', required: true)

it passes ; however I do not know enough meson if find_library is the "right way" to do it in this case.
Also there might be compiler flags discrepencies/not passed with other build means, as for ex src/lighttpd-angel.c and src/server.c does not compile, to let it continue I put #define __EXTENSIONS__ on top of all headers inclusions but these are more hack I feel.

So to your question, if I put it in meson.build

Most like needs discriminant line as
#if target_machine.system() == <solaris proper naming>
lighttpd_flags += += [declare_dependency(link_args: ['-lnsl', '-lsocket'],)]

again maybe there is a proper way to handle it.

however on src/buffer.c it wrongly assumes the system has mempcpy.

Hope it helps a bit.

Actions #8

Updated by gstrauss over 2 years ago

Something similar might be needed in src/lighttpd-angel.c and tests/{fcgi,scgi}-responder.c

--- a/src/first.h
+++ b/src/first.h
@@ -19,6 +19,10 @@
 #endif
 #endif

+#if defined(__sun)
+#define __EXTENSIONS__
+#endif
+
 #ifndef __STDC_WANT_LIB_EXT1__
 #define __STDC_WANT_LIB_EXT1__ 1
 #endif

Actions #9

Updated by gstrauss over 2 years ago

untested patches are on my dev branch https://git.lighttpd.net/lighttpd/lighttpd1.4/src/branch/personal/gstrauss/master
Please give them a try.

Might need to define __EXTENSIONS__ for src/lighttpd-angel.c and tests/{fcgi,scgi}-responder.c for meson build?

Please include compiler warnings/errors in your posts.

Actions #10

Updated by gstrauss over 2 years ago

  • Status changed from New to Patch Pending
  • Target version changed from 1.4.xx to 1.4.64
Actions #11

Updated by devnexen over 2 years ago

with cmake :

In file included from /export/home/dcarlier/Contribs/lighttpd1.4/src/buffer.h:406:0,
                 from /export/home/dcarlier/Contribs/lighttpd1.4/src/base.h:8,
                 from /export/home/dcarlier/Contribs/lighttpd1.4/src/server.c:3:
/export/home/dcarlier/Contribs/lighttpd1.4/src/ck.h:42:68: error: unknown type name 'rsize_t'; did you mean 'ssize_t'?
 errno_t ck_getenv_s (size_t * restrict len, char * restrict value, rsize_t maxsize, const char * restrict name);
                                                                    ^~~~~~~
                                                                    ssize_t
/export/home/dcarlier/Contribs/lighttpd1.4/src/ck.h:46:33: error: unknown type name 'rsize_t'; did you mean 'ssize_t'?
 errno_t ck_memclear_s (void *s, rsize_t smax, rsize_t n);
                                 ^~~~~~~
                                 ssize_t
/export/home/dcarlier/Contribs/lighttpd1.4/src/ck.h:46:47: error: unknown type name 'rsize_t'; did you mean 'ssize_t'?
 errno_t ck_memclear_s (void *s, rsize_t smax, rsize_t n);
                                               ^~~~~~~
                                               ssize_t
/export/home/dcarlier/Contribs/lighttpd1.4/src/ck.h:50:43: error: unknown type name 'rsize_t'; did you mean 'ssize_t'?
 static inline errno_t ck_memzero(void *s, rsize_t n);
                                           ^~~~~~~
                                           ssize_t
/export/home/dcarlier/Contribs/lighttpd1.4/src/ck.h:51:43: error: unknown type name 'rsize_t'; did you mean 'ssize_t'?
 static inline errno_t ck_memzero(void *s, rsize_t n) {
                                           ^~~~~~~
                                           ssize_t
/export/home/dcarlier/Contribs/lighttpd1.4/src/ck.h:55:33: error: unknown type name 'rsize_t'; did you mean 'ssize_t'?
 errno_t ck_strerror_s (char *s, rsize_t maxsize, errno_t errnum);
                                 ^~~~~~~
                                 ssize_t
/export/home/dcarlier/Contribs/lighttpd1.4/src/server.c: In function 'server_handle_sigalrm':
/export/home/dcarlier/Contribs/lighttpd1.4/src/server.c:1870:16: warning: implicit declaration of function 'getloadavg'; did you mean 'setlocale'? [-Wimplicit-function-declaration]
      if (-1 != getloadavg(srv->loadavg, 3)) {
                ^~~~~~~~~~
                setlocale

- seems with your branch we need the same typedef rsize_t as for FreeBSD, indeed, if I add it it passes.
- second error is just consequential of remarks earlier.

with meson (having modified it to make pass the pcre2 detection), among all the noise due to 32 bits compilation :

../src/lighttpd-angel.c: In function 'sigaction_handler':
../src/lighttpd-angel.c:46:3: warning: implicit declaration of function 'kill'; did you mean 'tell'? [-Wimplicit-function-declaration]
   kill(pid, sig);
   ^~~~
   tell
../src/lighttpd-angel.c:55:3: warning: implicit declaration of function 'usleep'; did you mean 'sleep'? [-Wimplicit-function-declaration]
   usleep(5 * 1000); /** wait 5 microsec */
   ^~~~~~
   sleep
../src/lighttpd-angel.c: In function 'main':
../src/lighttpd-angel.c:68:19: error: storage size of 'act' isn't known
  struct sigaction act;
                   ^~~
../src/lighttpd-angel.c:82:2: warning: implicit declaration of function 'sigaction'; did you mean 'si_ctid'? [-Wimplicit-function-declaration]
  sigaction(SIGPIPE, &act, NULL);
  ^~~~~~~~~
  si_ctid
../src/lighttpd-angel.c:86:2: warning: implicit declaration of function 'sigemptyset' [-Wimplicit-function-declaration]
  sigemptyset(&act.sa_mask);
  ^~~~~~~~~~~
../src/lighttpd-angel.c:87:17: error: 'SA_SIGINFO' undeclared (first use in this function); did you mean 'SIGINFO'?
  act.sa_flags = SA_SIGINFO;
                 ^~~~~~~~~~
                 SIGINFO
../src/lighttpd-angel.c:87:17: note: each undeclared identifier is reported only once for each function it appears in
../src/lighttpd-angel.c:147:41: warning: format '%d' expects argument of type 'int', but argument 5 has type 'pid_t {aka volatile long int}' [-Wformat=]
     fprintf(stderr, "%s.%d: child (pid=%d) exited normally with exitcode: %d\n",
                                        ~^
                                        %ld
../src/lighttpd-angel.c:155:41: warning: format '%d' expects argument of type 'int', but argument 5 has type 'pid_t {aka volatile long int}' [-Wformat=]
     fprintf(stderr, "%s.%d: child (pid=%d) exited unexpectedly with signal %d, restarting\n",
                                        ~^
                                        %ld
../src/lighttpd-angel.c:68:19: warning: unused variable 'act' [-Wunused-variable]
  struct sigaction act;
                   ^~~
[2/191] Compiling C object src/lemon.p/lemon.c.o
ninja: build stopped: subcommand failed.
dcarlier@openindianavbox:~/Contribs/lighttpd1.4/rel$ vim ../src/first.h 
dcarlier@openindianavbox:~/Contribs/lighttpd1.4/rel$ meson compile
[1/190] Compiling C object src/lighttpd-angel.p/lighttpd-angel.c.o
../src/lighttpd-angel.c: In function 'main':
../src/lighttpd-angel.c:147:41: warning: format '%d' expects argument of type 'int', but argument 5 has type 'pid_t {aka volatile long int}' [-Wformat=]
     fprintf(stderr, "%s.%d: child (pid=%d) exited normally with exitcode: %d\n",
                                        ~^
                                        %ld
../src/lighttpd-angel.c:155:41: warning: format '%d' expects argument of type 'int', but argument 5 has type 'pid_t {aka volatile long int}' [-Wformat=]
     fprintf(stderr, "%s.%d: child (pid=%d) exited unexpectedly with signal %d, restarting\n",
                                        ~^
                                        %ld
[12/190] Compiling C object src/lighttpd.p/buffer.c.o
../src/buffer.c: In function 'buffer_append_str2':
../src/buffer.c:204:5: warning: implicit declaration of function 'mempcpy'; did you mean 'memccpy'? [-Wimplicit-function-declaration]
     mempcpy(mempcpy(s, s1, len1), s2, len2);
     ^~~~~~~
     memccpy
../src/buffer.c: In function 'buffer_append_iovec':
../src/buffer.c:230:11: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
         s = mempcpy(s, iov[i].iov_base, iov[i].iov_len);
           ^
[35/190] Compiling C object src/lighttpd.p/gw_backend.c.o
../src/gw_backend.c: In function 'gw_proc_connect_success':
../src/gw_backend.c:275:28: warning: format '%d' expects argument of type 'int', but argument 5 has type 'pid_t {aka long int}' [-Wformat=]
           "got proc: pid: %d socket: %s load: %d",
                           ~^
                           %ld
           proc->pid, proc->connection_name->ptr, proc->load);
           ~~~~~~~~~         
../src/gw_backend.c: In function 'gw_proc_release':
../src/gw_backend.c:350:33: warning: format '%d' expects argument of type 'int', but argument 5 has type 'pid_t {aka long int}' [-Wformat=]
           "released proc: pid: %d socket: %s load: %u",
                                ~^
                                %ld
           proc->pid, proc->connection_name->ptr, proc->load);
           ~~~~~~~~~              
../src/gw_backend.c: In function 'gw_proc_waitpid':
../src/gw_backend.c:403:17: warning: format '%d' expects argument of type 'int', but argument 5 has type 'pid_t {aka long int}' [-Wformat=]
           "pid %d %d not found", proc->pid, proc->state);
                ~^                ~~~~~~~~~
                %ld
../src/gw_backend.c: In function 'gw_restart_dead_procs':
../src/gw_backend.c:1097:35: warning: format '%d' expects argument of type 'int', but argument 9 has type 'pid_t {aka long int}' [-Wformat=]
               "proc: %s %d %d %d %d", proc->connection_name->ptr,
                                  ~^
                                  %ld
               proc->state, proc->is_local, proc->load, proc->pid);
                                                        ~~~~~~~~~
../src/gw_backend.c: In function 'gw_handle_trigger_host':
../src/gw_backend.c:2815:73: warning: format '%d' expects argument of type 'int', but argument 6 has type 'pid_t {aka long int}' [-Wformat=]
               "idle-timeout reached, terminating child: socket: %s pid %d",
                                                                        ~^
                                                                        %ld
               proc->unixsocket ? proc->unixsocket->ptr : "", proc->pid);
                                                              ~~~~~~~~~   
[46/190] Compiling C object src/lighttpd.p/ls-hpack_lshpack.c.o
../src/ls-hpack/lshpack.c: In function 'lshpack_dec_decode':
../src/ls-hpack/lshpack.c:1783:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (len > UINT16_MAX)
                 ^
../src/ls-hpack/lshpack.c:1816:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (len > UINT16_MAX)
             ^
[53/190] Compiling C object src/test_common.p/t_test_buffer.c.o
In file included from ../src/t/test_buffer.c:8:0:
../src/buffer.c: In function 'buffer_append_str2':
../src/buffer.c:204:5: warning: implicit declaration of function 'mempcpy'; did you mean 'memccpy'? [-Wimplicit-function-declaration]
     mempcpy(mempcpy(s, s1, len1), s2, len2);
     ^~~~~~~
     memccpy
../src/buffer.c: In function 'buffer_append_iovec':
../src/buffer.c:230:11: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
         s = mempcpy(s, iov[i].iov_base, iov[i].iov_len);
           ^
[55/190] Linking target src/lighttpd
FAILED: src/lighttpd 
gcc  -o src/lighttpd src/lighttpd.p/meson-generated_.._configparser.c.o src/lighttpd.p/algo_md5.c.o src/lighttpd.p/algo_sha1.c.o src/lighttpd.p/algo_splaytree.c.o src/lighttpd.p/array.c.o src/lighttpd.p/base64.c.o src/lighttpd.p/buffer.c.o src/lighttpd.p/burl.c.o src/lighttpd.p/chunk.c.o src/lighttpd.p/configfile-glue.c.o src/lighttpd.p/http_etag.c.o src/lighttpd.p/fdevent.c.o src/lighttpd.p/fdevent_fdnode.c.o src/lighttpd.p/fdlog_maint.c.o src/lighttpd.p/fdlog.c.o src/lighttpd.p/gw_backend.c.o src/lighttpd.p/http_cgi.c.o src/lighttpd.p/http_chunk.c.o src/lighttpd.p/http_date.c.o src/lighttpd.p/http_header.c.o src/lighttpd.p/http_kv.c.o src/lighttpd.p/http-header-glue.c.o src/lighttpd.p/keyvalue.c.o src/lighttpd.p/log.c.o src/lighttpd.p/plugin.c.o src/lighttpd.p/rand.c.o src/lighttpd.p/request.c.o src/lighttpd.p/ck.c.o src/lighttpd.p/sock_addr.c.o src/lighttpd.p/stat_cache.c.o src/lighttpd.p/vector.c.o src/lighttpd.p/configfile.c.o src/lighttpd.p/connections.c.o src/lighttpd.p/data_config.c.o src/lighttpd.p/h2.c.o src/lighttpd.p/sock_addr_cache.c.o src/lighttpd.p/ls-hpack_lshpack.c.o src/lighttpd.p/algo_xxhash.c.o src/lighttpd.p/fdevent_impl.c.o src/lighttpd.p/http_range.c.o src/lighttpd.p/network_write.c.o src/lighttpd.p/network.c.o src/lighttpd.p/reqpool.c.o src/lighttpd.p/response.c.o src/lighttpd.p/server.c.o -L/usr/lib -I/usr/include/pcre -Wl,-z -Wl,ignore -z defs -Wl,-export-dynamic -Wl,--start-group -ldl -lpcre2-8 -Wl,--end-group
Undefined                       first referenced
 symbol                             in file
bind                                src/lighttpd.p/gw_backend.c.o
mempcpy                             src/lighttpd.p/buffer.c.o
in6addr_loopback                    src/lighttpd.p/sock_addr.c.o
getsockname                         src/lighttpd.p/http_cgi.c.o
accept                              src/lighttpd.p/fdevent.c.o
listen                              src/lighttpd.p/gw_backend.c.o
accept4                             src/lighttpd.p/fdevent.c.o
socket                              src/lighttpd.p/fdevent.c.o
getnameinfo                         src/lighttpd.p/sock_addr.c.o
setsockopt                          src/lighttpd.p/fdevent.c.o
getsockopt                          src/lighttpd.p/fdevent.c.o
connect                             src/lighttpd.p/gw_backend.c.o
in6addr_any                         src/lighttpd.p/sock_addr.c.o
getaddrinfo                         src/lighttpd.p/sock_addr.c.o
getpeername                         src/lighttpd.p/server.c.o
freeaddrinfo                        src/lighttpd.p/sock_addr.c.o
gai_strerror                        src/lighttpd.p/sock_addr.c.o
shutdown                            src/lighttpd.p/gw_backend.c.o

Indeed, after adding EXTENSIONS constant on top of lighttpd-angel.c, its compilation unit finally pass.

Actions #12

Updated by gstrauss over 2 years ago

Please check your build environments.
  • lighttpd-angel.c includes first.h, which defines __EXTENSIONS__ when __sun is defined.
  • The lighttpd meson build adds -lsocket -lnsl
  • The lighttpd meson build amends the detection for pcre and pcre2.

My changes are on my dev branch, not lighttpd git master, so you might not have the latest commits from my dev branch.

Regarding mempcpy(), the build detected mempcpy() and defined HAVE_MEMPCPY, so please check to see where it is defined in the system headers and if defining __EXTENSIONS__ is sufficient to expose it in the system headers.

Using my dev branch with __EXTENSIONS__ defined might also solve the issue with providing getloadavg() from the system headers.

Regarding sizeof pid_t, I may fix that printf warning in the future along with my (separate) toy branch which attempts a Windows native port.

I have pushed a commit on my dev branch with a change for rsize_t on Illumos.

After git pull --rebase, please ensure that you have cleared the CMake and meson build caches, and reconfigured cmake and meson in order to pick up the changes in my dev branch.

Actions #13

Updated by devnexen over 2 years ago

with cmake

if((NOT APPLE) OR CMAKE_C_COMPILER_ID MATCHES "GNU")
        add_target_properties(lighttpd LINK_FLAGS "-Wl,-export-dynamic")
endif()

leads to

Consolidate compiler generated dependencies of target lighttpd
[  2%] Linking C executable lighttpd
ld: fatal: entry point symbol 'xport-dynamic' is undefined
collect2: error: ld returned 1 exit status
*** Error code 1

once added SunOS system as discriminant, it passes.

with meson

        if libpcre.found()
                libpcre = [ libpcre ]
        else
                libpcre = [ compiler.find_library('pcre2-8'), required: true ]

you forgot the closing the closing endif for each case.

furthermore

if target_machine.system() == 'windows'
        socket_libs = [ compiler.find_library('ws2_32') ]
        defs += [
                '-DNVALGRIND',
        ]
endif
if target_machine.system() == 'sunos'
        socket_libs = [ compiler.find_library('socket')
                      , compiler.find_library('nsl')
                      ]
endif

compiler = meson.get_compiler('c')

setting the compiler var before usage should help the error I get.
even with your libpcre detection changes, it still does not pass (oddily because you clearly set required as false). what happens (in your side) if we revert the conditions (as find_library first) ? meson question tough ... I see this

 libpcre = [ dependency('libpcre2-8'), required: false ]

since there are square brackets, do you still need to put these still like here ?

libpcre = [ libpcre ]

after I modified a bit locally I spotted this typo :

libpcre = [ compiler.find_library('pcre'), required: true ]

should be

libpcre = [ compiler.find_library('pcre', required: true) ]

afterwards, now tests/meson.build need fixes too as

tests/meson.build:11:0: ERROR: All keyword arguments must be after positional arguments.

should it be ?

executable('fcgi-responder',
        sources: 'fcgi-responder.c',
        dependencies: [common_flags, socket_libs]
)

After all of these, the only remaining real issue is the mempcpy detection because cmake does not find it (rightfully because solaris does not support it system libc's wise) so does meson detects in the fact the compiler implementation ?

let's see the outputs

cmake log

//Have function memcpy
HAVE_MEMCPY:INTERNAL=1
//Have function mempcpy
HAVE_MEMPCPY:INTERNAL=
//Have function memset
HAVE_MEMSET:INTERNAL=1
//Have function memset_s

meson's

Working directory:  /export/home/dcarlier/Contribs/lighttpd1.4/rel/meson-private/tmp8hesr3gs
Command line:  gcc -I/usr/include/pcre /export/home/dcarlier/Contribs/lighttpd1.4/rel/meson-private/tmp8hesr3gs/testfile.c -o /export/home/dcarlier/Contribs/lighttpd1.4/rel/meson-private/tmp8hesr3gs/output.exe -O0 -std=c11 -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES -D_GNU_SOURCE

Code:

        int main(void) {

        /* With some toolchains (MSYS2/mingw for example) the compiler
         * provides various builtins which are not really implemented and
         * fall back to the stdlib where they aren't provided and fail at
         * build/link time. In case the user provides a header, including
         * the header didn't lead to the function being defined, and the
         * function we are checking isn't a builtin itself we assume the
         * builtin is not functional and we just error out. */
        #if !1 && !defined(mempcpy) && !0
            #error "No definition for __builtin_mempcpy found in the prefix" 
        #endif

        #ifdef __has_builtin
            #if !__has_builtin(__builtin_mempcpy)
                #error "__builtin_mempcpy not found" 
            #endif
        #elif ! defined(mempcpy)
            __builtin_mempcpy;
        #endif
        return 0;
        }
Compiler stdout:

Compiler stderr:

Checking for function "mempcpy" : YES
Actions #14

Updated by gstrauss over 2 years ago

My sincerest apologies for all those typos in meson.build. I have force-pushed fixes to my dev branch.
I also think I addressed the cmake issue passing -Wl,-export-dynamic to Sun ld.

Actions #15

Updated by devnexen over 2 years ago

happens that s fine :-)

little nits, cmake

if(((NOT APPLE) AND (NOT CMAKE_SYSTEM_NAME MATCHES "SunOS")) OR CMAKE_C_COMPILER_ID MATCHES "GNU")
        add_target_properties(lighttpd LINK_FLAGS "-Wl,-export-dynamic")
endif()

shouldn't it be ?

if(((NOT APPLE) AND (NOT CMAKE_SYSTEM_NAME MATCHES "SunOS")) AND CMAKE_C_COMPILER_ID MATCHES "GNU")
        add_target_properties(lighttpd LINK_FLAGS "-Wl,-export-dynamic")
endif()

otherwise I still get the same linkage issue as above.

meson, all fixed except mempcpy, so what would be your suggestion ? using mempcpy only if the system has a proper declaration (as Linux) or __builtin_mempcpy if the compiler support it (or vice versa) then the memcpy fallback otherwise ?

Actions #16

Updated by gstrauss over 2 years ago

Force pushed fixes to my branch.
Yes, it makes more sense to limit -Wl,-export-dynamic to ... AND CMAKE_C_COMPILER_ID MATCHES "GNU"
I added a kludge to meson.build to skip the search for mempcpy on sunos, but had inverted the logic. That is fixed, too, on my dev branch.

Actions #17

Updated by devnexen over 2 years ago

cmake we re good now.

meson same little linkage issue as cmake

FAILED: src/lighttpd 
gcc  -o src/lighttpd src/lighttpd.p/meson-generated_.._configparser.c.o src/lighttpd.p/algo_md5.c.o src/lighttpd.p/algo_sha1.c.o src/lighttpd.p/algo_splaytree.c.o src/lighttpd.p/array.c.o src/lighttpd.p/base64.c.o src/lighttpd.p/buffer.c.o src/lighttpd.p/burl.c.o src/lighttpd.p/chunk.c.o src/lighttpd.p/configfile-glue.c.o src/lighttpd.p/http_etag.c.o src/lighttpd.p/fdevent.c.o src/lighttpd.p/fdevent_fdnode.c.o src/lighttpd.p/fdlog_maint.c.o src/lighttpd.p/fdlog.c.o src/lighttpd.p/gw_backend.c.o src/lighttpd.p/http_cgi.c.o src/lighttpd.p/http_chunk.c.o src/lighttpd.p/http_date.c.o src/lighttpd.p/http_header.c.o src/lighttpd.p/http_kv.c.o src/lighttpd.p/http-header-glue.c.o src/lighttpd.p/keyvalue.c.o src/lighttpd.p/log.c.o src/lighttpd.p/plugin.c.o src/lighttpd.p/rand.c.o src/lighttpd.p/request.c.o src/lighttpd.p/ck.c.o src/lighttpd.p/sock_addr.c.o src/lighttpd.p/stat_cache.c.o src/lighttpd.p/vector.c.o src/lighttpd.p/configfile.c.o src/lighttpd.p/connections.c.o src/lighttpd.p/data_config.c.o src/lighttpd.p/h2.c.o src/lighttpd.p/sock_addr_cache.c.o src/lighttpd.p/ls-hpack_lshpack.c.o src/lighttpd.p/algo_xxhash.c.o src/lighttpd.p/fdevent_impl.c.o src/lighttpd.p/http_range.c.o src/lighttpd.p/network_write.c.o src/lighttpd.p/network.c.o src/lighttpd.p/reqpool.c.o src/lighttpd.p/response.c.o src/lighttpd.p/server.c.o -I/usr/include/pcre -Wl,-z -Wl,ignore -z defs -Wl,-export-dynamic -Wl,--start-group -ldl -lpcre2-8 -lsocket -lnsl -Wl,--end-group
ld: fatal: entry point symbol 'xport-dynamic' is undefined

...
if compiler.get_id() == 'gcc' or target_machine.system() != 'darwin'
        lighttpd_flags += [ declare_dependency(
                link_args: [
                        '-Wl,-export-dynamic',
                ],
        ) ]
endif

Indeed if I lazily comment this section locally just for testing it passes.

About tests/fcgi-responder

../tests/fcgi-responder.c:372:24: warning: implicit declaration of function 'fdopen'; did you mean 'fopen'? [-Wimplicit-function-declaration]
FILE *stream = fdopen(fd, "r+");
^~~~
fopen

as you suggested earlier, #define __EXTENSIONS__ on top solve it.

Only remains then the numerous little printf and format discrepancies with pid and stuff but you already know.

Actions #18

Updated by gstrauss over 2 years ago

Ok. Those should be fixed, too, on my dev branch except for printf of pid_t warnings, which will be addresses some time later.

I need to test the recently committed mod_webdav copy acceleration changes before pushing my dev branch to lighttpd git master.

Thanks for all your help in updating the lighttpd cmake build config.

Actions #19

Updated by devnexen over 2 years ago

meson build passes now, cheers.

Actions #20

Updated by gstrauss over 2 years ago

The patch for -Wl,-export-dynamic needs adjustment, as it breaks when clang is used instead of gcc. I might add a kludge which excludes the platforms which have a problem, rather than trying to a find a perfect solution which tests for compiler and linker supporting -Wl,-export-dynamic

Actions #21

Updated by gstrauss over 2 years ago

  • Status changed from Patch Pending to Fixed
Actions

Also available in: Atom