unikraft / static-pie-apps

Built Linux applications (static-pie) for Unikraft binary compatibility mode
7 stars 40 forks source link

Add Ruby static PIE build #18

Open razvand opened 1 year ago

razvand commented 1 year ago

Add Ruby as a -static-pie build. Test it natively on Linux and with run-elfloader on Unikraft. In case of issues with Unikraft, post an issue in the Unikraft core repository.

Follow the structure of existing applications or submitted for review applications: create a folder with build.sh script, a README.md file, a rootfs/ subfolder (if required), the -static-pie built executable and other useful files.

Hackathon points: 50

andreasstamos commented 1 year ago

Working on it

T-001v2r3 commented 1 year ago

Tried to work on this but without success, running the following configure command: ./configure --disable-install-doc --disable-dynamic --disable-shared --without-gmp --without-tk --without-tcl CFLAGS="-O3 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=pointer-to-int-cast" LDFLAGS="" --disable-all The result obtained with ldd ruby was: linux-vdso.so.1 (0x00007ffe36580000) libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fde728c5000) libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007fde7288b000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fde72319000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fde72000000) /lib64/ld-linux-x86-64.so.2 (0x00007fde728fc000) I made a makefile for compling it the static libraries and it still didnt work cause of multiple definitions. This is the makefile: CC = gcc -static-pie CFLAGS = -Wall -Wextra -Werror LIB = *.a RM = rm -rf

CLIENT = build

CLIENT_OBJS = ./ruby-3.2.2/*.o all: $(CLIENT)

$(CLIENT): $(CLIENT_OBJS) $(LIB) $(CC) $(CFLAGS) $(CLIENT_OBJS) $(LIB) -o client

clean: $(RM) $(CLIENT_OBJS)

fclean: clean $(RM) $(CLIENT)

re: fclean all