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

Include sys/types.h in src/hash.c #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Include sys/types.h in src/hash.c #42

wants to merge 1 commit into from

Conversation

joshuamorris3
Copy link

Include sys/types.h in src/hash.c, otherwise during make you can receive a unknown type name error for u_int32_t. To recreate follow the steps below:

  1. docker run --rm -it alpine sh
  2. Add the build dependencies: apk add --update alpine-sdk
  3. wget http://download.joedog.org/siege/siege-latest.tar.gz
  4. tar -zxvf siege-latest.tar.gz
  5. cd siege-3.1.3
  6. ./configure
  7. make

Once you make the this fix then run:

  1. make clean
  2. make

Siege will build successfully.

Include sys/types.h in src/hash.c, otherwise during make you can receive a undefined type error for u_int32_t
@boeboe
Copy link

boeboe commented Dec 15, 2020

This does not work with siege 4.x.x

@JoeDog
Copy link
Owner

JoeDog commented Dec 15, 2020 via email

@zarianec
Copy link

zarianec commented Mar 17, 2021

How to reproduce:

  1. docker run --rm -it alpine sh
  2. command:
apk update \
    && apk add make g++ \
    && wget http://download.joedog.org/siege/siege-4.0.7.tar.gz \
    && tar -zxvf siege-4.0.7.tar.gz \
    && cd siege-4.0.7 \
    && ./configure \
    && make install

Output for make:

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... utils/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... none
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) none
checking for a sed that does not truncate output... /bin/sed
checking for ld used by gcc... /usr/x86_64-alpine-linux-musl/bin/ld
checking if the linker (/usr/x86_64-alpine-linux-musl/bin/ld) is GNU ld... yes
checking for /usr/x86_64-alpine-linux-musl/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognise dependent libraries... pass_all
./configure: line 1: /usr/bin/file: not found
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... none
checking how to run the C++ preprocessor... g++ -E
checking for g77... no
checking for xlf... no
checking for f77... no
checking for frt... no
checking for pgf77... no
checking for cf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for xlf90... no
checking for f90... no
checking for pgf90... no
checking for pghpf... no
checking for epcf90... no
checking for gfortran... no
checking for g95... no
checking for xlf95... no
checking for f95... no
checking for fort... no
checking for ifort... no
checking for ifc... no
checking for efc... no
checking for pgfortran... no
checking for pgf95... no
checking for lf95... no
checking for ftn... no
checking whether we are using the GNU Fortran 77 compiler... no
checking whether  accepts -g... no
checking the maximum length of command line arguments... 32768
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking whether the gcc linker (/usr/x86_64-alpine-linux-musl/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... ./configure: line 1: /usr/bin/file: not found
GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
configure: creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by g++... /usr/x86_64-alpine-linux-musl/bin/ld
checking if the linker (/usr/x86_64-alpine-linux-musl/bin/ld) is GNU ld... yes
checking whether the g++ linker (/usr/x86_64-alpine-linux-musl/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC
checking if g++ PIC flag -fPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking whether the g++ linker (/usr/x86_64-alpine-linux-musl/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... ./configure: line 1: /usr/bin/file: not found
GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
appending configuration tag "F77" to libtool
checking for perl... false 
checking for a POSIX-compliant shell... /bin/sh
checking whether make sets $(MAKE)... (cached) yes
checking for buggy pthread mutex initializers... no
checking for dlopen() in -ldld... no
checking for dlopen() in -ldl... yes
checking for random device... yes
checking for ssl support... yes
checking /include/openssl/opensslv.h usability... no
checking /include/openssl/opensslv.h presence... no
checking for /include/openssl/opensslv.h... no
checking /usr/include/openssl/opensslv.h usability... no
checking /usr/include/openssl/opensslv.h presence... no
checking for /usr/include/openssl/opensslv.h... no
checking /usr/local/include/openssl/opensslv.h usability... no
checking /usr/local/include/openssl/opensslv.h presence... no
checking for /usr/local/include/openssl/opensslv.h... no
checking /usr/local/ssl/include/openssl/opensslv.h usability... no
checking /usr/local/ssl/include/openssl/opensslv.h presence... no
checking for /usr/local/ssl/include/openssl/opensslv.h... no
checking /usr/pkg/include/openssl/opensslv.h usability... no
checking /usr/pkg/include/openssl/opensslv.h presence... no
checking for /usr/pkg/include/openssl/opensslv.h... no
checking /usr/lib/ssl/include/openssl/opensslv.h usability... no
checking /usr/lib/ssl/include/openssl/opensslv.h presence... no
checking for /usr/lib/ssl/include/openssl/opensslv.h... no
checking /usr/include/ssl/include/openssl/opensslv.h usability... no
checking /usr/include/ssl/include/openssl/opensslv.h presence... no
checking for /usr/include/ssl/include/openssl/opensslv.h... no
checking /usr/include/include/openssl/opensslv.h usability... no
checking /usr/include/include/openssl/opensslv.h presence... no
checking for /usr/include/include/openssl/opensslv.h... no
checking for zlib support... yes
checking /include/zlib.h usability... no
checking /include/zlib.h presence... no
checking for /include/zlib.h... no
checking /usr/include/zlib.h usability... no
checking /usr/include/zlib.h presence... no
checking for /usr/include/zlib.h... no
checking /usr/local/include/zlib.h usability... no
checking /usr/local/include/zlib.h presence... no
checking for /usr/local/include/zlib.h... no
checking /usr/local/ssl/include/zlib.h usability... no
checking /usr/local/ssl/include/zlib.h presence... no
checking for /usr/local/ssl/include/zlib.h... no
checking /usr/pkg/include/zlib.h usability... no
checking /usr/pkg/include/zlib.h presence... no
checking for /usr/pkg/include/zlib.h... no
checking /usr/lib/zlib/include/zlib.h usability... no
checking /usr/lib/zlib/include/zlib.h presence... no
checking for /usr/lib/zlib/include/zlib.h... no
checking /usr/include/zlib/include/zlib.h usability... no
checking /usr/include/zlib/include/zlib.h presence... no
checking for /usr/include/zlib/include/zlib.h... no
checking /usr/include/include/zlib.h usability... no
checking /usr/include/include/zlib.h presence... no
checking for /usr/include/include/zlib.h... no
checking for inline... inline
checking for int8_t... yes
checking for int16_t... yes
checking for int32_t... yes
checking for int64_t... yes
checking for uint8_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
checking for uint64_t... yes
checking for u_int32_t... yes
checking for ssize_t... yes
checking for ANSI C header files... (cached) yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking for unistd.h... (cached) yes
checking signal.h usability... yes
checking signal.h presence... yes
checking for signal.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking for sys/types.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking sys/times.h usability... yes
checking sys/times.h presence... yes
checking for sys/times.h... yes
checking sys/resource.h usability... yes
checking sys/resource.h presence... yes
checking for sys/resource.h... yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking for string.h... (cached) yes
checking for strings.h... (cached) yes
checking sched.h usability... yes
checking sched.h presence... yes
checking for sched.h... yes
checking openssl/e_os.h usability... no
checking openssl/e_os.h presence... no
checking for openssl/e_os.h... no
checking openssl/e_os2.h usability... no
checking openssl/e_os2.h presence... no
checking for openssl/e_os2.h... no
checking for an ANSI C-conforming const... yes
checking for size_t... yes
checking whether time.h and sys/time.h may both be included... yes
checking return type of signal handlers... void
checking for working alloca.h... yes
checking for alloca... yes
checking for strchr... yes
checking for memcpy... yes
checking for strncpy... yes
checking for strstr... yes
checking for strlen... yes
checking for strncasecmp... yes
checking for strncmp... yes
checking for socket... yes
checking for gethostbyname... yes
checking for snprintf... yes
checking for strdup... yes
checking for rand_r... yes
checking for localtime_r... yes
checking for gethostbyname_r... yes
checking for gmtime_r... yes
checking for getipnodebyname... no
checking for freehostent... no
checking for getopt_long... yes
checking for poll... yes
checking for socket in -lsocket... no
checking for pthread_attr_init in -lpthread... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating doc/Makefile
config.status: creating html/Makefile
config.status: creating include/Makefile
config.status: creating include/joedog/Makefile
config.status: creating utils/Makefile
config.status: creating include/config.h
config.status: executing depfiles commands
config.status: executing default-1 commands
config.status: executing default-2 commands
config.status: executing default-3 commands
config.status: executing default-4 commands
config.status: executing default-5 commands
config.status: executing default-6 commands

--------------------------------------------------------
Configuration is complete

Run the following commands to complete the installation:
  make 
  make install

For complete documentation:        http://www.joedog.org
--------------------------------------------------------
Making install in .
make[1]: Entering directory '/siege-4.0.7'
make[2]: Entering directory '/siege-4.0.7'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/siege-4.0.7'
make[1]: Leaving directory '/siege-4.0.7'
Making install in include
make[1]: Entering directory '/siege-4.0.7/include'
Making install in joedog
make[2]: Entering directory '/siege-4.0.7/include/joedog'
make[3]: Entering directory '/siege-4.0.7/include/joedog'
make[3]: Nothing to be done for 'install-exec-am'.
make[3]: Nothing to be done for 'install-data-am'.
make[3]: Leaving directory '/siege-4.0.7/include/joedog'
make[2]: Leaving directory '/siege-4.0.7/include/joedog'
make[2]: Entering directory '/siege-4.0.7/include'
make[3]: Entering directory '/siege-4.0.7/include'
make[3]: Nothing to be done for 'install-exec-am'.
make[3]: Nothing to be done for 'install-data-am'.
make[3]: Leaving directory '/siege-4.0.7/include'
make[2]: Leaving directory '/siege-4.0.7/include'
make[1]: Leaving directory '/siege-4.0.7/include'
Making install in src
make[1]: Entering directory '/siege-4.0.7/src'
gcc -DHAVE_CONFIG_H -I. -I../include      -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -W -Wall -Wunused-value   -g -O2 -c array.c
gcc -DHAVE_CONFIG_H -I. -I../include      -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -W -Wall -Wunused-value   -g -O2 -c auth.c
gcc -DHAVE_CONFIG_H -I. -I../include      -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -W -Wall -Wunused-value   -g -O2 -c base64.c
gcc -DHAVE_CONFIG_H -I. -I../include      -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -W -Wall -Wunused-value   -g -O2 -c browser.c
gcc -DHAVE_CONFIG_H -I. -I../include      -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -W -Wall -Wunused-value   -g -O2 -c cache.c
cache.c: In function 'cache_get_header':
cache.c:211:11: warning: statement will never be executed [-Wswitch-unreachable]
  211 |     char *ptr = NULL;
      |           ^~~
gcc -DHAVE_CONFIG_H -I. -I../include      -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -W -Wall -Wunused-value   -g -O2 -c cookie.c
gcc -DHAVE_CONFIG_H -I. -I../include      -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -W -Wall -Wunused-value   -g -O2 -c cookies.c
cookies.c: In function 'cookies_add':
cookies.c:67:19: warning: initialization of 'size_t' {aka 'long unsigned int'} from 'pthread_t' {aka 'struct __pthread *'} makes integer from pointer without a cast [-Wint-conversion]
   67 |   size_t  id    = pthread_self();
      |                   ^~~~~~~~~~~~
cookies.c: In function 'cookies_delete':
cookies.c:125:23: warning: comparison between pointer and integer
  125 |     if (cur->threadID == id) {
      |                       ^~
cookies.c: In function 'cookies_delete_all':
cookies.c:153:23: warning: comparison between pointer and integer
  153 |     if (cur->threadID == id) {
      |                       ^~
cookies.c: In function 'cookies_header':
cookies.c:179:15: warning: initialization of 'size_t' {aka 'long unsigned int'} from 'pthread_t' {aka 'struct __pthread *'} makes integer from pointer without a cast [-Wint-conversion]
  179 |   size_t id = pthread_self();
      |               ^~~~~~~~~~~~
cookies.c:222:5: warning: 'strncpy' output truncated before terminating nul copying 8 bytes from a string of the same length [-Wstringop-truncation]
  222 |     strncpy(newton, "Cookie: ", 8);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cookies.c:224:5: warning: 'strncat' specified bound 2 equals source length [-Wstringop-overflow=]
  224 |     strncat(newton, "\015\012", 2);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cookies.c:223:5: warning: 'strncat' output may be truncated copying 4096 bytes from a string of length 81919 [-Wstringop-truncation]
  223 |     strncat(newton, oreo,       MAX_COOKIE_SIZE);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -DHAVE_CONFIG_H -I. -I../include      -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -W -Wall -Wunused-value   -g -O2 -c cfg.c
gcc -DHAVE_CONFIG_H -I. -I../include      -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -W -Wall -Wunused-value   -g -O2 -c creds.c
gcc -DHAVE_CONFIG_H -I. -I../include      -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -W -Wall -Wunused-value   -g -O2 -c crew.c
gcc -DHAVE_CONFIG_H -I. -I../include      -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -W -Wall -Wunused-value   -g -O2 -c data.c
gcc -DHAVE_CONFIG_H -I. -I../include      -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -W -Wall -Wunused-value   -g -O2 -c date.c
gcc -DHAVE_CONFIG_H -I. -I../include      -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -W -Wall -Wunused-value   -g -O2 -c eval.c
eval.c: In function 'evaluate':
eval.c:84:3: warning: 'strncpy' specified bound depends on the length of the source argument [-Wstringop-overflow=]
   84 |   strncpy(result, final, strlen(final));
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -DHAVE_CONFIG_H -I. -I../include      -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -W -Wall -Wunused-value   -g -O2 -c ftp.c
ftp.c: In function 'ftp_stor':
ftp.c:149:16: warning: initialization of 'size_t' {aka 'long unsigned int'} from 'pthread_t' {aka 'struct __pthread *'} makes integer from pointer without a cast [-Wint-conversion]
  149 |   size_t  id = pthread_self();
      |                ^~~~~~~~~~~~
In function '__response_code',
    inlined from '__response' at ftp.c:300:12:
ftp.c:317:3: warning: 'strncpy' output may be truncated copying 3 bytes from a string of length 1023 [-Wstringop-truncation]
  317 |   strncpy(code, buf, 3);
      |   ^~~~~~~~~~~~~~~~~~~~~
gcc -DHAVE_CONFIG_H -I. -I../include      -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -W -Wall -Wunused-value   -g -O2 -c getopt.c
gcc -DHAVE_CONFIG_H -I. -I../include      -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -W -Wall -Wunused-value   -g -O2 -c getopt1.c
gcc -DHAVE_CONFIG_H -I. -I../include      -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -W -Wall -Wunused-value   -g -O2 -c handler.c
gcc -DHAVE_CONFIG_H -I. -I../include      -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -W -Wall -Wunused-value   -g -O2 -c hash.c
hash.c:57:9: error: unknown type name 'u_int32_t'
   57 | private u_int32_t    fnv_32_buf(void *buf, size_t len, u_int32_t hval);
      |         ^~~~~~~~~
hash.c:57:56: error: unknown type name 'u_int32_t'
   57 | private u_int32_t    fnv_32_buf(void *buf, size_t len, u_int32_t hval);
      |                                                        ^~~~~~~~~
hash.c: In function 'fnv_32_buf':
hash.c:394:14: error: 'u_int32_t' undeclared (first use in this function)
  394 |     hval ^= (u_int32_t)*bp++;
      |              ^~~~~~~~~
hash.c:394:14: note: each undeclared identifier is reported only once for each function it appears in
make[1]: *** [Makefile:363: hash.o] Error 1
make[1]: Leaving directory '/siege-4.0.7/src'
make: *** [Makefile:323: install-recursive] Error 1

@JoeDog
Copy link
Owner

JoeDog commented Mar 17, 2021 via email

@zarianec
Copy link

Works with the #include <sys/types.h>.

@JoeDog
Copy link
Owner

JoeDog commented Mar 17, 2021 via email

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

Successfully merging this pull request may close these issues.

None yet

4 participants