Explorar el Código

Lwan: fix build breakage with Ubuntu 21.10 containers (#7229)

* Lwan: Update copyright info

* Lwan: Fix build breakage with newer Ubuntu containers
L. A. F. Pereira hace 3 años
padre
commit
330497c3aa

+ 7 - 7
frameworks/C/lwan/Makefile

@@ -4,15 +4,15 @@ CFLAGS = -mtune=native -march=native -O3 -fno-plt -flto -ffat-lto-objects -DNDEB
 	-falign-functions=32 -malign-data=abi \
 	-include /lwan/build/lwan-build-config.h \
 	-I /lwan/src/lib \
-	`pkg-config mariadb --cflags` \
-	`pkg-config sqlite3 --cflags` \
-	`pkg-config luajit --cflags`
+	$(shell pkg-config mariadb --cflags) \
+	$(shell pkg-config sqlite3 --cflags) \
+	$(shell pkg-config luajit --cflags)
 
 LDFLAGS = -mtune=native -march=native -O3 -flto -ffat-lto-objects -Wl,-z,now,-z,relro \
 	-Wl,-whole-archive /lwan/build/src/lib/liblwan.a -Wl,-no-whole-archive \
-	`pkg-config mariadb --libs` \
-	`pkg-config sqlite3 --libs` \
-	`pkg-config luajit --libs` \
+	$(shell pkg-config mariadb --libs) \
+	$(shell pkg-config sqlite3 --libs) \
+	$(shell pkg-config luajit --libs) \
 	-lpthread \
 	-lz
 
@@ -26,7 +26,7 @@ all: techempower
 	$(CC) $(CFLAGS) -c $< -o $@
 
 techempower: $(OBJS)
-	$(CC) $(LDFLAGS) $(OBJS) -o techempower
+	$(CC) -o techempower $(OBJS) $(LDFLAGS)
 
 clean:
 	rm -f techempower $(OBJS)

+ 2 - 4
frameworks/C/lwan/benchmark_config.json

@@ -23,8 +23,7 @@
         "database_os": "Linux",
         "display_name": "Lwan",
         "notes": "",
-        "versus": "None",
-        "tags": ["broken"]
+        "versus": "None"
       },
       "lua": {
         "json_url": "/lua.json",
@@ -43,8 +42,7 @@
         "database_os": "Linux",
         "display_name": "Lwan",
         "notes": "",
-        "versus": "None",
-        "tags": ["broken"]
+        "versus": "None"
       }
     }
   ]

+ 4 - 9
frameworks/C/lwan/lwan-lua.dockerfile

@@ -3,22 +3,17 @@ FROM ubuntu:21.10
 RUN apt-get update -yqq && \
 	apt-get install -yqq \
 		git pkg-config build-essential cmake zlib1g-dev \
-		libsqlite3-dev libmariadbclient-dev wget
+		libsqlite3-dev libmariadb-dev wget libluajit-5.1-dev
 
 ADD ./ /lwan
 WORKDIR /lwan
 
 RUN mkdir mimalloc && \
-    wget https://github.com/microsoft/mimalloc/archive/6e1ca96a4965c776c10698c24dae576523178ef5.tar.gz -O - | tar xz --strip-components=1 -C mimalloc && \
+    wget https://github.com/microsoft/mimalloc/archive/817569dfad79732233fb86649c89e04387ce02e9.tar.gz -O - | tar xz --strip-components=1 -C mimalloc && \
     cd mimalloc && mkdir build && cd build && \
     CFLAGS="-flto -ffat-lto-objects" cmake .. -DCMAKE_BUILD_TYPE=Release -DMI_SECURE=OFF && make -j install
 
-RUN mkdir luajit && \
-    wget http://luajit.org/download/LuaJIT-2.0.5.tar.gz -O - | tar xz --strip-components=1 -C luajit && \
-    cd luajit && \
-    PREFIX=/usr CFLAGS="-O3 -mtune=native -march=native -flto -ffat-lto-objects" make -j install
-
-RUN wget https://github.com/lpereira/lwan/archive/3bb25e235e76028d7687ae4636a059474f42b19c.tar.gz -O - | tar xz --strip-components=1 && \
+RUN wget https://github.com/lpereira/lwan/archive/e637f1ea724389a36dcab02affb6ec3fe5ecb0b6.tar.gz -O - | tar xz --strip-components=1 && \
     mkdir build && cd build && \
     cmake /lwan -DCMAKE_BUILD_TYPE=Release -DUSE_ALTERNATIVE_MALLOC=mimalloc && \
     make lwan-static
@@ -26,7 +21,7 @@ RUN wget https://github.com/lpereira/lwan/archive/3bb25e235e76028d7687ae4636a059
 RUN make clean && make
 
 ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/lib
-ENV LD_PRELOAD=/usr/local/lib/mimalloc-1.6/libmimalloc.so
+ENV LD_PRELOAD=/usr/local/lib/libmimalloc.so
 
 EXPOSE 8080
 

+ 4 - 9
frameworks/C/lwan/lwan.dockerfile

@@ -3,22 +3,17 @@ FROM ubuntu:21.10
 RUN apt-get update -yqq && \
 	apt-get install -yqq \
 		git pkg-config build-essential cmake zlib1g-dev \
-		libsqlite3-dev libmariadbclient-dev wget
+		libsqlite3-dev libmariadb-dev wget libluajit-5.1-dev
 
 ADD ./ /lwan
 WORKDIR /lwan
 
 RUN mkdir mimalloc && \
-    wget https://github.com/microsoft/mimalloc/archive/6e1ca96a4965c776c10698c24dae576523178ef5.tar.gz -O - | tar xz --strip-components=1 -C mimalloc && \
+    wget https://github.com/microsoft/mimalloc/archive/817569dfad79732233fb86649c89e04387ce02e9.tar.gz -O - | tar xz --strip-components=1 -C mimalloc && \
     cd mimalloc && mkdir build && cd build && \
     CFLAGS="-flto -ffat-lto-objects" cmake .. -DCMAKE_BUILD_TYPE=Release -DMI_SECURE=OFF && make -j install
 
-RUN mkdir luajit && \
-    wget http://luajit.org/download/LuaJIT-2.0.5.tar.gz -O - | tar xz --strip-components=1 -C luajit && \
-    cd luajit && \
-    PREFIX=/usr CFLAGS="-O3 -mtune=native -march=native -flto -ffat-lto-objects" make -j install
-
-RUN wget https://github.com/lpereira/lwan/archive/3bb25e235e76028d7687ae4636a059474f42b19c.tar.gz -O - | tar xz --strip-components=1 && \
+RUN wget https://github.com/lpereira/lwan/archive/e637f1ea724389a36dcab02affb6ec3fe5ecb0b6.tar.gz -O - | tar xz --strip-components=1 && \
     mkdir build && cd build && \
     cmake /lwan -DCMAKE_BUILD_TYPE=Release -DUSE_ALTERNATIVE_MALLOC=mimalloc && \
     make lwan-static
@@ -31,7 +26,7 @@ ENV MYSQL_USER=benchmarkdbuser
 ENV MYSQL_PASS=benchmarkdbpass
 ENV MYSQL_DB=hello_world
 ENV MYSQL_HOST=tfb-database
-ENV LD_PRELOAD=/usr/local/lib/mimalloc-1.6/libmimalloc.so
+ENV LD_PRELOAD=/usr/local/lib/libmimalloc.so
 
 EXPOSE 8080
 

+ 1 - 1
frameworks/C/lwan/src/database.c

@@ -1,6 +1,6 @@
 /*
  * lwan - simple web server
- * Copyright (c) 2014 Leandro A. F. Pereira <[email protected]>
+ * Copyright (c) 2022 L. A. F. Pereira <[email protected]>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License

+ 1 - 1
frameworks/C/lwan/src/database.h

@@ -1,6 +1,6 @@
 /*
  * lwan - simple web server
- * Copyright (c) 2014 Leandro A. F. Pereira <[email protected]>
+ * Copyright (c) 2022 L. A. F. Pereira <[email protected]>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License

+ 1 - 1
frameworks/C/lwan/src/json.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2017 Intel Corporation
- * Copyright (c) 2020 Leandro A. F. Pereira <[email protected]>
+ * Copyright (c) 2022 L. A. F. Pereira <[email protected]>
  *
  * SPDX-License-Identifier: Apache-2.0
  */

+ 1 - 1
frameworks/C/lwan/src/techempower.c

@@ -1,6 +1,6 @@
 /*
  * lwan - simple web server
- * Copyright (c) 2014 Leandro A. F. Pereira <[email protected]>
+ * Copyright (c) 2022 L. A. F. Pereira <[email protected]>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License

+ 5 - 1
frameworks/C/lwan/techempower.conf

@@ -1,4 +1,6 @@
-listener *:8080 {
+listener *:8080
+
+site {
     # For main TWFB benchmarks
     &plaintext /plaintext
     &json /json
@@ -15,11 +17,13 @@ listener *:8080 {
 
                 function handle_get_plaintext(req)
                     req:set_response("Hello, World!")
+                    return nil
                 end
 
                 function handle_get_json(req)
                     req:set_headers({['Content-Type']='application/json'})
                     req:set_response(json.encode({message="Hello, World!"}))
+                    return nil
                 end'''
     }