lpereira / lwan

Experimental, scalable, high performance HTTP server
https://lwan.ws
GNU General Public License v2.0
5.92k stars 549 forks source link

Compilation error on AWS Linux AMI #123

Open subnetmarco opened 8 years ago

subnetmarco commented 8 years ago

I am experiencing the following compilation error on the latest Amazon Linux AMI:

Linking C static library liblwan-common.a
[ 96%] Built target lwan-common
[100%] Building C object lwan/CMakeFiles/lwan.dir/main.c.o
/home/ec2-user/lwan/lwan/main.c: In function ‘parse_args’:
/home/ec2-user/lwan/lwan/main.c:176:5: warning: missing initializer for field ‘name’ of ‘const struct option’ [-Wmissing-field-initializers]
     { }
     ^
In file included from /home/ec2-user/lwan/lwan/main.c:21:0:
/usr/include/getopt.h:107:15: note: ‘name’ declared here
   const char *name;
               ^
/home/ec2-user/lwan/lwan/main.c: In function ‘main’:
/home/ec2-user/lwan/lwan/main.c:239:13: warning: missing initializer for field ‘handler’ of ‘lwan_url_map_t’ [-Wmissing-field-initializers]
             { }
             ^
In file included from /home/ec2-user/lwan/lwan/main.c:25:0:
/home/ec2-user/lwan/common/lwan.h:253:26: note: ‘handler’ declared here
     lwan_http_status_t (*handler)(lwan_request_t *request, lwan_response_t *response, void *data);
                          ^
Linking C executable lwan
/tmp/ccuOKgDw.ltrans16.ltrans.o:(.rodata+0x3700): undefined reference to `.L183'
/tmp/ccuOKgDw.ltrans16.ltrans.o:(.rodata+0x3708): undefined reference to `.L184'
/tmp/ccuOKgDw.ltrans16.ltrans.o:(.rodata+0x3710): undefined reference to `.L185'
/tmp/ccuOKgDw.ltrans16.ltrans.o:(.rodata+0x3718): undefined reference to `.L186'
/tmp/ccuOKgDw.ltrans16.ltrans.o:(.rodata+0x3720): undefined reference to `.L187'
/tmp/ccuOKgDw.ltrans16.ltrans.o:(.rodata+0x3728): undefined reference to `.L188'
/tmp/ccuOKgDw.ltrans16.ltrans.o:(.rodata+0x3730): undefined reference to `.L189'
/tmp/ccuOKgDw.ltrans16.ltrans.o:(.rodata+0x3738): undefined reference to `.L190'
/tmp/ccuOKgDw.ltrans16.ltrans.o:(.rodata+0x3740): undefined reference to `.L191'
/tmp/ccuOKgDw.ltrans16.ltrans.o:(.rodata+0x3748): undefined reference to `.L192'
/tmp/ccuOKgDw.ltrans16.ltrans.o:(.rodata+0x3750): undefined reference to `.L193'
collect2: error: ld returned 1 exit status
make[2]: *** [lwan/lwan] Error 1
make[1]: *** [lwan/CMakeFiles/lwan.dir/all] Error 2
make: *** [all] Error 2
lpereira commented 8 years ago

Never seen those linking errors before. What compiler and version are you using?

lpereira commented 8 years ago

@thefosk ^

subnetmarco commented 8 years ago
[ec2-user@ip-172-31-58-108 ~]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-amazon-linux/4.8.3/lto-wrapper
Target: x86_64-amazon-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,fortran,ada,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.3-20140911/obj-x86_64-amazon-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.3-20140911/obj-x86_64-amazon-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-amazon-linux
Thread model: posix
gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC)
lpereira commented 8 years ago

I've tried building Lwan with gcc-4.8.4 (oldest I have available), and it works, albeit with a few warnings. Are you getting this error with a clean build?

maksym-iv commented 8 years ago

@thefosk Had similar error on Centos 7 with GCC 4.8.5 while not all dependencies installed (zlib-devel)

Linking C static library liblwan-common.a
[ 93%] Built target lwan-common
[ 96%] Building C object lwan/CMakeFiles/lwan.dir/main.c.o
/lwan/lwan/main.c: In function 'parse_args':
/lwan/lwan/main.c:42:9: warning: missing initializer for field 'name' of 'const struct option' [-Wmissing-field-initializers]
         { }
         ^
In file included from /lwan/lwan/main.c:21:0:
/usr/include/getopt.h:107:15: note: 'name' declared here
   const char *name;
               ^
/lwan/lwan/main.c: In function 'main':
/lwan/lwan/main.c:106:13: warning: missing initializer for field 'handler' of 'lwan_url_map_t' [-Wmissing-field-initializers]
             { }
             ^
In file included from /lwan/lwan/main.c:26:0:
/lwan/common/lwan.h:255:26: note: 'handler' declared here
     lwan_http_status_t (*handler)(lwan_request_t *request, lwan_response_t *response, void *data);
                          ^
Linking C executable lwan
/tmp/ccJEmjYe.ltrans0.ltrans.o:(.rodata+0x3340): undefined reference to `.L1'
/tmp/ccJEmjYe.ltrans0.ltrans.o:(.rodata+0x3348): undefined reference to `.L2'
/tmp/ccJEmjYe.ltrans0.ltrans.o:(.rodata+0x3350): undefined reference to `.L3'
/tmp/ccJEmjYe.ltrans0.ltrans.o:(.rodata+0x3358): undefined reference to `.L4'
/tmp/ccJEmjYe.ltrans0.ltrans.o:(.rodata+0x3360): undefined reference to `.L5'
/tmp/ccJEmjYe.ltrans0.ltrans.o:(.rodata+0x3368): undefined reference to `.L6'
/tmp/ccJEmjYe.ltrans0.ltrans.o:(.rodata+0x3370): undefined reference to `.L7'
/tmp/ccJEmjYe.ltrans0.ltrans.o:(.rodata+0x3378): undefined reference to `.L8'
/tmp/ccJEmjYe.ltrans0.ltrans.o:(.rodata+0x3380): undefined reference to `.L9'
/tmp/ccJEmjYe.ltrans0.ltrans.o:(.rodata+0x3388): undefined reference to `.L10'
/tmp/ccJEmjYe.ltrans0.ltrans.o:(.rodata+0x3390): undefined reference to `.L11'
collect2: error: ld returned 1 exit status
make[2]: *** [lwan/lwan] Error 1
make[1]: *** [lwan/CMakeFiles/lwan.dir/all] Error 2
make: *** [all] Error 2

Cleaning 'build' folder helped so solve the issue.

lpereira commented 8 years ago

Is this still an issue?