tce-load -i compiletc gdbm-dev openssl-dev readline-dev tk8.6-dev

cd ruby-2.5.3

CC="gcc -flto -fuse-linker-plugin -mtune=generic -Os -pipe" CXX="g++ -flto -fuse-linker-plugin -mtune=generic -Os -pipe -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local --disable-static --localstatedir=/var --enable-shared --disable-install-doc --disable-install-rdoc --disable-install-capi

find . -name Makefile -type f -exec sed -i 's/-O3//g' {} \;
find . -name Makefile -type f -exec sed -i 's/-ggdb3//g' {} \;
find . -name config.status -type f -exec sed -i 's/-O3//g' {} \;
find . -name config.status -type f -exec sed -i 's/-ggdb3//g' {} \;

make [9m 17.35s]
sudo make install

Configuration summary for ruby version 2.5.3

   * Installation prefix: /usr/local
   * exec prefix:         ${prefix}
   * arch:                x86_64-linux
   * site arch:           ${arch}
   * RUBY_BASE_NAME:      ruby
   * enable shared:       yes
   * ruby lib prefix:     ${libdir}/${RUBY_BASE_NAME}
   * site libraries path: ${rubylibprefix}/${sitearch}
   * vendor path:         ${rubylibprefix}/vendor_ruby
   * target OS:           linux
   * compiler:            gcc -flto -fuse-linker-plugin -mtune=generic -Os \
                          -pipe
   * with pthread:        yes
   * enable shared libs:  yes
   * dynamic library ext: so
   * CFLAGS:              ${optflags} ${debugflags} ${warnflags}
   * LDFLAGS:             -L. -fstack-protector -rdynamic \
                          -Wl,-export-dynamic
   * optflags:            -O3
   * debugflags:          -ggdb3
   * warnflags:           -Wall -Wextra -Wno-unused-parameter \
                          -Wno-parentheses -Wno-long-long \
                          -Wno-missing-field-initializers \
                          -Wno-tautological-compare \
                          -Wno-parentheses-equality \
                          -Wno-constant-logical-operand -Wno-self-assign \
                          -Wunused-variable -Wimplicit-int -Wpointer-arith \
                          -Wwrite-strings -Wdeclaration-after-statement \
                          -Wimplicit-function-declaration \
                          -Wdeprecated-declarations \
                          -Wmisleading-indentation \
                          -Wno-packed-bitfield-compat \
                          -Wsuggest-attribute=noreturn \
                          -Wsuggest-attribute=format \
                          -Wimplicit-fallthrough=0 -Wduplicated-cond \
                          -Wrestrict
   * strip command:       strip -S -x
   * install doc:         no
   * man page type:       man
