Skip to content

Instantly share code, notes, and snippets.

@paresharma
Last active July 3, 2024 05:34
Show Gist options
  • Save paresharma/ec628a7fa5524a0ed18b227387d1b43a to your computer and use it in GitHub Desktop.
Save paresharma/ec628a7fa5524a0ed18b227387d1b43a to your computer and use it in GitHub Desktop.
Rails on Termux
apt update && apt upgrade
apt install ruby vim git nodejs
apt install ruby-dev libxml2-dev libxslt-dev pkg-config make clang
gem install nokogiri -- --use-system-libraries
apt install libsqlite-dev
gem install sqlite3
apt install libffi-dev
gem install rb-inotify
gem install ffi
apt install openssh
sshd
packages install postgresql postgresql-contrib postgresql-dev
gem install pg
initdb -D ~/postgres/
# pg_ctl -D /data/data/com.termux/files/home/postgres/ -l logfile start
@AndrewMcSwain
Copy link

still no solution found. Seems thereis a permission error with libxml

ERROR: Error installing rails: ERROR: Failed to build gem native extension. current directory: /data/data/com.termux/files/usr/lib/ruby/gems/3.1.0/gems/nokogiri-1.13.9/ext/nokogiri /data/data/com.termux/files/usr/bin/ruby -I /data/data/com.termux/files/usr/lib/ruby/3.1.0 -r ./siteconf20221025-21592-wmtp59.rb extconf.rb
checking for whether -std=c99 is accepted as CFLAGS... yes checking for whether -Wno-declaration-after-statement is accepted as CFLAGS... yes checking for whether -g is accepted as CFLAGS... yes
checking for whether -Winline is accepted as CFLAGS... yes checking for whether -Wmissing-noreturn is accepted as CFLAGS... yes Building nokogiri using packaged libraries. Static linking is enabled.
Cross build is disabled. Using mini_portile version 2.8.0 checking for iconv... yes
---------- IMPORTANT NOTICE ---------- Building Nokogiri with a packaged version of libxml2-2.10.3.
Configuration options: --host=arm-unknown-linux-androideabi --enable-static --disable-shared --libdir=/data/data/com.termux/files/usr/lib/ruby/gems/3.1.0/gems/nokogiri-1.13.9/ports/arm-linux-androideabi/libxml2/2.10.3/lib --with-iconv=yes --disable-dependency-tracking --without-python --without-readline --with-c14n --with-debug --with-threads --disable-shared --enable-static CFLAGS=-O2\ -U_FORTIFY_SOURCE\ -g\ -fPIC The following patches are being applied: - 0001-Remove-script-macro-support.patch

  • 0002-Update-entities-to-remove-handling-of-ssi.patch - 0003-libxml2.la-is-in-top_builddir.patch
  • 0005-avoid-isnan-isinf.patch - 0009-allow-wildcard-namespaces.patch
    The Nokogiri maintainers intend to provide timely security updates, but if this is a concern for you and want to use your OS/distro system library instead, then abort this installation process and install nokogiri as
    instructed at: https://nokogiri.org/tutorials/installing_nokogiri.html#installing-using-standard-system-libraries
    Note, however, that nokogiri cannot guarantee compatibility with every version of libxml2 that may be provided by OS/package vendors. [{:url=>
    "https://mirror.csclub.uwaterloo.ca/gnome/sources/libxml2/2.10/libxml2-2.10.3.tar.xz",
    :sha256=>"5d2cc3d78bec3dbe212a9d7fa629ada25a7da928af432c93060ff5c17ee28a9c"}] Extracting libxml2-2.10.3.tar.xz into tmp/arm-unknown-linux-androideabi/ports/libxml2/2.10.3... ERROR, review '/data/data/com.termux/files/usr/lib/ruby/gems/3.1.0/gems/nokogiri-1.13.9/ext/nokogiri/tmp/arm-unknown-linux-androideabi/ports/libxml2/2.10.3/extract.log' to see what happened. Last lines are:
    ======================================================================== tar: libxml2-2.10.3/test/relaxng/ambig_name-class.xml: Cannot hard link to ‘libxml2-2.10.3/test/relaxng/ambig_name-class2.rng’: Permission denied
    tar: libxml2-2.10.3/test/relaxng/ambig_name-class.rng: Cannot hard link to ‘libxml2-2.10.3/test/relaxng/tutorA.rng’: Permission denied tar: Exiting with failure status due to previous errors
    ======================================================================== *** extconf.rb failed ***
    Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.
    Provided configuration options: --with-opt-dir --without-opt-dir
    --with-opt-include --without-opt-include=${opt-dir}/include
    --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog
    --without-make-prog --srcdir=. --curdir
    --ruby=/data/data/com.termux/files/usr/bin/$(RUBY_BASE_NAME) --help
    --clean --prevent-strip --enable-system-libraries
    --disable-system-libraries
    --use-system-libraries --enable-system-libraries
    --disable-system-libraries --use-system-libraries
    --enable-static
    --enable-cross-build
    --disable-cross-build --with-zlib-dir
    --without-zlib-dir --with-zlib-include
    --without-zlib-include=${zlib-dir}/include
    --with-zlib-lib --without-zlib-lib=${zlib-dir}/lib
    --with-xml2-source-dir /data/data/com.termux/files/usr/lib/ruby/gems/3.1.0/gems/mini_portile2-2.8.0/lib/mini_portile2/mini_portile.rb:460:in block in execute': Failed to complete extract task (RuntimeError) from /data/data/com.termux/files/usr/lib/ruby/gems/3.1.0/gems/mini_portile2-2.8.0/lib/mini_portile2/mini_portile.rb:426:in chdir' from /data/data/com.termux/files/usr/lib/ruby/gems/3.1.0/gems/mini_portile2-2.8.0/lib/mini_portile2/mini_portile.rb:426:in execute' from /data/data/com.termux/files/usr/lib/ruby/gems/3.1.0/gems/mini_portile2-2.8.0/lib/mini_portile2/mini_portile.rb:413:in extract_file'
    from /data/data/com.termux/files/usr/lib/ruby/gems/3.1.0/gems/mini_portile2-2.8.0/lib/mini_portile2/mini_portile.rb:90:in block in extract' from /data/data/com.termux/files/usr/lib/ruby/gems/3.1.0/gems/mini_portile2-2.8.0/lib/mini_portile2/mini_portile.rb:88:in each'
    from /data/data/com.termux/files/usr/lib/ruby/gems/3.1.0/gems/mini_portile2-2.8.0/lib/mini_portile2/mini_portile.rb:88:in extract' from /data/data/com.termux/files/usr/lib/ruby/gems/3.1.0/gems/mini_portile2-2.8.0/lib/mini_portile2/mini_portile.rb:183:in cook'
    from extconf.rb:529:in block (2 levels) in process_recipe' from extconf.rb:309:in chdir' from extconf.rb:309:in chdir_for_build' from extconf.rb:529:in block in process_recipe'
    from internal:kernel:90:in tap' from extconf.rb:428:in process_recipe'
    from extconf.rb:782:in `'
    To see why this extension failed to compile, please check the mkmf.log which can be found here:
    /data/data/com.termux/files/usr/lib/ruby/gems/3.1.0/extensions/arm-linux-androideabi/3.1.0/nokogiri-1.13.9/mkmf.log
    extconf failed, exit code 1
    Gem files will remain installed in /data/data/com.termux/files/usr/lib/ruby/gems/3.1.0/gems/nokogiri-1.13.9 for inspection.
    Results logged to /data/data/com.termux/files/usr/lib/ruby/gems/3.1.0/extensions/arm-linux-androideabi/3.1.0/nokogiri-1.13.9/gem_make.out
    ~ $

@webzrout
Copy link

Today's Termux doesn't have these packages at all...

apt install ruby-dev libxml2-dev libxslt-dev libsqlite-dev libffi-dev postgresql-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package libffi-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
libffi

Package libsqlite-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
libsqlite

Package libxml2-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
libxml2

Package libxslt-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
libxslt

Package postgresql-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
postgresql

Package ruby-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
ruby2 ruby

E: Package 'ruby-dev' has no installation candidate
E: Package 'libxml2-dev' has no installation candidate
E: Package 'libxslt-dev' has no installation candidate
E: Package 'libsqlite-dev' has no installation candidate
E: Package 'libffi-dev' has no installation candidate
E: Package 'postgresql-dev' has no installation candidate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment