Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/setup ubuntu #2620

Open
wants to merge 35 commits into
base: fix/setup
Choose a base branch
from
Open

Fix/setup ubuntu #2620

wants to merge 35 commits into from

Conversation

ionosphere
Copy link
Member

@ionosphere ionosphere commented Feb 10, 2023

  • Test bin/setup for Ubuntu 20.04 LTS (Focal Fossa)
  • Test bin/setup for Ubuntu 22.04 LTS (Jammy Jellyfish)

@ionosphere
Copy link
Member Author

Hi @burisu ,
I let you merge this PR into your branch.

@ionosphere ionosphere self-assigned this Feb 23, 2023
@burisu
Copy link
Collaborator

burisu commented Feb 28, 2023

Hi @ionosphere,
I wanted to make only one script to install on any Linux/Unix machines to avoid repetitions and be sure to have almost the same steps everywhere. I'll try to gather all in one place and get the same tooling on every OS (I'll look to use nvm on MacOS too to be consistent). Let's talk about that if you want.

@ionosphere
Copy link
Member Author

Yes, you can try the method "one ring to rule them all". For the moment, i just validate 20.04. feel free to update

@HLFH
Copy link

HLFH commented Apr 21, 2023

Any updates between this PR and #2618?

@HLFH
Copy link

HLFH commented Apr 25, 2023

Issue with this branch and script:

./bin/setup: line 69: bundle: command not found

This issue probably comes when zsh is used rather than bash that is enforced in this script.

@HLFH
Copy link

HLFH commented Apr 25, 2023

On Ubuntu 22.04:

Issue about charta:

🚚 Installing gems...
The path `/srv/http/ekylibre/charta` does not exist.

When I look at it:

gem 'charta', path: '../charta' # gitlab: 'ekylibre/charta', branch: 'master'

I am therefore reverting to:

gem 'charta', gitlab: 'ekylibre/charta', branch: 'master'

After this revert, I am stuck to another step:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rjb-1.6.2/ext
/srv/http/ekylibre/.rbenv/versions/2.6.6/bin/ruby -I
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/2.6.0 -r
./siteconf20230425-101847-1k8nlma.rb extconf.rb
*** 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=/srv/http/ekylibre/.rbenv/versions/2.6.6/bin/$(RUBY_BASE_NAME)
extconf.rb:54:in `<main>': JAVA_HOME is not set. (RuntimeError)

extconf failed, exit code 1

Gem files will remain installed in
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rjb-1.6.2 for
inspection.
Results logged to
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/rjb-1.6.2/gem_make.out

An error occurred while installing rjb (1.6.2), and Bundler cannot
continue.
Make sure that `gem install rjb -v '1.6.2' --source 'https://rubygems.org/'`
succeeds before bundling.

In Gemfile:
  beardley-barcode was resolved to 1.0.1, which depends on
    beardley was resolved to 1.4.2, which depends on
      rjb-loader was resolved to 0.0.2, which depends on
        rjb


Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ext/gpgme
/srv/http/ekylibre/.rbenv/versions/2.6.6/bin/ruby -I
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/2.6.0 -r
./siteconf20230425-101847-1biuaaj.rb extconf.rb
************************************************************************
IMPORTANT!  gpgme gem uses locally built versions of required C libraries,
namely libgpg-error, libassuan, and gpgme.

If this is a concern for you and you want to use the system library
instead, abort this installation process and reinstall gpgme gem as
follows:

    gem install gpgme -- --use-system-libraries

************************************************************************
Extracting libgpg-error-1.37.tar.bz2 into
tmp/x86_64-linux-gnu/ports/libgpg-error/1.37... OK
Running 'configure' for libgpg-error 1.37... OK
Running 'compile' for libgpg-error 1.37... OK
Running 'install' for libgpg-error 1.37... OK
Activating libgpg-error 1.37 (from
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37)...
Extracting libassuan-2.5.3.tar.bz2 into
tmp/x86_64-linux-gnu/ports/libassuan/2.5.3... OK
Running 'configure' for libassuan 2.5.3... OK
Running 'compile' for libassuan 2.5.3... OK
Running 'install' for libassuan 2.5.3... OK
Activating libassuan 2.5.3 (from
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3)...
Extracting gpgme-1.13.1.tar.bz2 into tmp/x86_64-linux-gnu/ports/gpgme/1.13.1...
OK
Running 'configure' for gpgme 1.13.1... OK
Running 'compile' for gpgme 1.13.1... ERROR, review
'/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ext/gpgme/tmp/x86_64-linux-gnu/ports/gpgme/1.13.1/compile.log'
to see what happened. Last lines are:
========================================================================
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../conf
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37/include
-fPIC -Wall -Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k
-Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT engine-spawn.lo -MD -MP -MF
.deps/engine-spawn.Tpo -c engine-spawn.c -o engine-spawn.o
mv -f .deps/engine-spawn.Tpo .deps/engine-spawn.Plo
/bin/bash ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.
-I../conf   
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37/include
-fPIC  -Wall -Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k
-Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT gpgconf.lo -MD -MP -MF
.deps/gpgconf.Tpo -c -o gpgconf.lo gpgconf.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../conf
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37/include
-fPIC -Wall -Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k
-Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT gpgconf.lo -MD -MP -MF
.deps/gpgconf.Tpo -c gpgconf.c -o gpgconf.o
mv -f .deps/gpgconf.Tpo .deps/gpgconf.Plo
/bin/bash ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.
-I../conf   
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37/include
-fPIC  -Wall -Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k
-Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT queryswdb.lo -MD -MP -MF
.deps/queryswdb.Tpo -c -o queryswdb.lo queryswdb.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../conf
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37/include
-fPIC -Wall -Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k
-Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT queryswdb.lo -MD -MP -MF
.deps/queryswdb.Tpo -c queryswdb.c -o queryswdb.o
mv -f .deps/queryswdb.Tpo .deps/queryswdb.Plo
/bin/bash ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.
-I../conf   
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37/include
-fPIC  -Wall -Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k
-Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT posix-util.lo -MD -MP -MF
.deps/posix-util.Tpo -c -o posix-util.lo posix-util.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../conf
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37/include
-fPIC -Wall -Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k
-Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT posix-util.lo -MD -MP -MF
.deps/posix-util.Tpo -c posix-util.c -o posix-util.o
mv -f .deps/posix-util.Tpo .deps/posix-util.Plo
/bin/bash ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.
-I../conf   
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37/include
-fPIC  -Wall -Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k
-Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT posix-io.lo -MD -MP -MF
.deps/posix-io.Tpo -c -o posix-io.lo posix-io.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../conf
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37/include
-fPIC -Wall -Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k
-Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT posix-io.lo -MD -MP -MF
.deps/posix-io.Tpo -c posix-io.c -o posix-io.o
posix-io.c: In function '_gpgme_io_spawn':
posix-io.c:577:23: error: void value not ignored as it ought to be
  577 |             while ((i = closefrom (fd)) && errno == EINTR)
      |                       ^
make[1]: *** [Makefile:941: posix-io.lo] Error 1
make[1]: Leaving directory
'/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ext/gpgme/tmp/x86_64-linux-gnu/ports/gpgme/1.13.1/gpgme-1.13.1/src'
make: *** [Makefile:534: all-recursive] Error 1
========================================================================
*** 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=/srv/http/ekylibre/.rbenv/versions/2.6.6/bin/$(RUBY_BASE_NAME)
	--clean
	--use-system-libraries
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mini_portile2-2.8.1/lib/mini_portile2/mini_portile.rb:460:in
`block in execute': Failed to complete compile task (RuntimeError)
from
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mini_portile2-2.8.1/lib/mini_portile2/mini_portile.rb:426:in
`chdir'
from
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mini_portile2-2.8.1/lib/mini_portile2/mini_portile.rb:426:in
`execute'
from
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mini_portile2-2.8.1/lib/mini_portile2/mini_portile.rb:144:in
`compile'
from
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mini_portile2-2.8.1/lib/mini_portile2/mini_portile.rb:187:in
`cook'
	from extconf.rb:129:in `block in <main>'
	from extconf.rb:105:in `tap'
	from extconf.rb:105:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20
for inspection.
Results logged to
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/gpgme-2.0.20/gem_make.out

An error occurred while installing gpgme (2.0.20), and Bundler cannot
continue.
Make sure that `gem install gpgme -v '2.0.20' --source 'https://rubygems.org/'`
succeeds before bundling.

In Gemfile:
  gpgme


Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mini_racer-0.6.3/ext/mini_racer_extension
/srv/http/ekylibre/.rbenv/versions/2.6.6/bin/ruby -I
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/2.6.0 -r
./siteconf20230425-101847-vhijq9.rb extconf.rb
checking for -lpthread... yes
checking for whether -Wl,--exclude-libs=ALL  is accepted as LDFLAGS... no
creating Makefile

current directory:
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mini_racer-0.6.3/ext/mini_racer_extension

Probably because JAVA_HOME is not set, the Ubuntu 22.04 install script is incomplete.

@HLFH
Copy link

HLFH commented Apr 26, 2023

diff --git a/Gemfile b/Gemfile
index 4b4fe9cd8e..1118079856 100644
--- a/Gemfile
+++ b/Gemfile
@@ -92,7 +92,7 @@ gem 'exception_notification', '~> 4.4'
 gem 'redis-namespace', '~> 1.8'
 
 # Manipulate map data
-gem 'charta', path: '../charta' # gitlab: 'ekylibre/charta', branch: 'master'
+gem 'charta', gitlab: 'ekylibre/charta', branch: 'master'
 gem 'geocoder', '~> 1.6'
 gem 'rgeo', '~> 2.2'
 gem 'rgeo-geojson', '~> 2.1'
diff --git a/bin/install/ubuntu_22_04 b/bin/install/ubuntu_22_04
index 2e24658b2e..bb1e5c81c2 100644
--- a/bin/install/ubuntu_22_04
+++ b/bin/install/ubuntu_22_04
@@ -43,10 +43,65 @@ rbenv global $RUBY_VERSION
 rbenv rehash
 
 # Install nvm
-# TODO
+if [ -d "$HOME/.nvm" ];
+then
+    echo "✅ Node.js directory exist"
+else
+  echo "🚚 Installing Node.js..."
+  curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
+  export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
+  [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
+  nvm install 14.17.4
+  nvm alias default 14.17.4
+  npm i -g yarn
+  echo "✅ Node.js installed."
+fi
 
 # Install Postgresql / Postgis
-# TODO
+DIR_POSTGRES=/etc/postgresql/13
+if [ -d "$DIR_POSTGRES" ];
+then
+    echo "✅ Postgresql 13 directory exist"
+else
+  # Configure PostGres
+  echo "🚚 Installing Postgresql && Postgis..."
+  sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
+  wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
+  sudo apt-get update
+  sudo apt-get install -qq -y postgresql-13 postgresql-client-13 postgresql-13-postgis-3 postgresql-13-postgis-3-scripts
+  echo "✅ Postgresql 13 && Postgis 3 installed."
+  # sudo -su postgres
+  # createuser -d -P -s ekylibre
+  # psql -c \"CREATE USER ekylibre WITH PASSWORD 'ekylibre';\"
+  # psql -c \"ALTER USER ekylibre SUPERUSER; \"
+  # echo "ALTER USER ekylibre SUPERUSER;" | psql
+  if psql -t -c '\du' | cut -d \| -f 1 | grep -qw ekylibre; then
+    echo "✅ Postgresql role ekylibre already exist."
+  else
+    sudo -u postgres bash -c "psql -c \"CREATE USER ekylibre WITH PASSWORD 'ekylibre';\""
+    sudo -u postgres bash -c "psql -c \"ALTER USER ekylibre SUPERUSER;\""
+    echo "✅ Postgresql role ekylibre created."
+  fi
+
+  # TODO : Edit pg_hba.conf to use md5 password authentication instead of peer authentication for unix sockets
+  # Find and replace in file (local   all  all  peer) by (local  all  all md5)
+  # sudo vim /etc/postgresql/13/main/pg_hba.conf
+  echo "🛠️  Editing pg_hba.conf"
+  file="/etc/postgresql/13/main/pg_hba.conf"
+  sudo sed -i '/^local all all peer/ s/peer/md5/' $file
+  echo "✅ Postgresql 13 setup OK."
+fi
+
+# replace Proj version with version working with Rgeo
+# PROJ_VERSION=pkg-config --modversion proj
+echo "🚚 Configuring Proj specific version ..."
+sudo mkdir -p /opt/proj/share
+sudo tar -xvzf bin/install/proj.tar.gz -C /opt/proj/share
+echo "✅ Proj specific version installed."
 
-# Install Java
-# TODO
+# Java & Redis
+echo 'export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64' >> ~/.bashrc
+echo 'export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64' >> ~/.profile
+. ~/.bashrc
+. ~/.profile
+echo "✅ Java path configured."

Getting new error with updated Ubuntu 22.04 install script.

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rjb-1.6.2/ext
/srv/http/ekylibre/.rbenv/versions/2.6.6/bin/ruby -I /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/2.6.0 -r ./siteconf20230426-202733-1nrt5ck.rb
extconf.rb
*** 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=/srv/http/ekylibre/.rbenv/versions/2.6.6/bin/$(RUBY_BASE_NAME)
extconf.rb:54:in `<main>': JAVA_HOME is not set. (RuntimeError)

extconf failed, exit code 1

Gem files will remain installed in /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rjb-1.6.2 for inspection.
Results logged to /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/rjb-1.6.2/gem_make.out

An error occurred while installing rjb (1.6.2), and Bundler cannot continue.
Make sure that `gem install rjb -v '1.6.2' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  beardley-barcode was resolved to 1.0.1, which depends on
    beardley was resolved to 1.4.2, which depends on
      rjb-loader was resolved to 0.0.2, which depends on
        rjb


Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ext/gpgme
/srv/http/ekylibre/.rbenv/versions/2.6.6/bin/ruby -I /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/2.6.0 -r ./siteconf20230426-202733-eh95e3.rb
extconf.rb
************************************************************************
IMPORTANT!  gpgme gem uses locally built versions of required C libraries,
namely libgpg-error, libassuan, and gpgme.

If this is a concern for you and you want to use the system library
instead, abort this installation process and reinstall gpgme gem as
follows:

    gem install gpgme -- --use-system-libraries

************************************************************************
Extracting libgpg-error-1.37.tar.bz2 into tmp/x86_64-linux-gnu/ports/libgpg-error/1.37... OK
Running 'configure' for libgpg-error 1.37... OK
Running 'compile' for libgpg-error 1.37... OK
Running 'install' for libgpg-error 1.37... OK
Activating libgpg-error 1.37 (from
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37)...
Extracting libassuan-2.5.3.tar.bz2 into tmp/x86_64-linux-gnu/ports/libassuan/2.5.3... OK
Running 'configure' for libassuan 2.5.3... OK
Running 'compile' for libassuan 2.5.3... OK
Running 'install' for libassuan 2.5.3... OK
Activating libassuan 2.5.3 (from
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3)...
Extracting gpgme-1.13.1.tar.bz2 into tmp/x86_64-linux-gnu/ports/gpgme/1.13.1... OK
Running 'configure' for gpgme 1.13.1... OK
Running 'compile' for gpgme 1.13.1... ERROR, review
'/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ext/gpgme/tmp/x86_64-linux-gnu/ports/gpgme/1.13.1/compile.log' to see
what happened. Last lines are:
========================================================================
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../conf
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37/include -fPIC -Wall
-Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k -Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT engine-spawn.lo -MD -MP -MF .deps/engine-spawn.Tpo -c engine-spawn.c -o engine-spawn.o
mv -f .deps/engine-spawn.Tpo .deps/engine-spawn.Plo
/bin/bash ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../conf   
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37/include  -fPIC  -Wall
-Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k -Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT gpgconf.lo -MD -MP -MF .deps/gpgconf.Tpo -c -o gpgconf.lo gpgconf.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../conf
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37/include -fPIC -Wall
-Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k -Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT gpgconf.lo -MD -MP -MF .deps/gpgconf.Tpo -c gpgconf.c -o gpgconf.o
mv -f .deps/gpgconf.Tpo .deps/gpgconf.Plo
/bin/bash ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../conf   
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37/include  -fPIC  -Wall
-Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k -Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT queryswdb.lo -MD -MP -MF .deps/queryswdb.Tpo -c -o queryswdb.lo queryswdb.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../conf
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37/include -fPIC -Wall
-Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k -Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT queryswdb.lo -MD -MP -MF .deps/queryswdb.Tpo -c queryswdb.c -o queryswdb.o
mv -f .deps/queryswdb.Tpo .deps/queryswdb.Plo
/bin/bash ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../conf   
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37/include  -fPIC  -Wall
-Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k -Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT posix-util.lo -MD -MP -MF .deps/posix-util.Tpo -c -o posix-util.lo posix-util.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../conf
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37/include -fPIC -Wall
-Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k -Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT posix-util.lo -MD -MP -MF .deps/posix-util.Tpo -c posix-util.c -o posix-util.o
mv -f .deps/posix-util.Tpo .deps/posix-util.Plo
/bin/bash ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../conf   
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37/include  -fPIC  -Wall
-Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k -Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT posix-io.lo -MD -MP -MF .deps/posix-io.Tpo -c -o posix-io.lo posix-io.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../conf
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37/include -fPIC -Wall
-Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k -Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT posix-io.lo -MD -MP -MF .deps/posix-io.Tpo -c posix-io.c -o posix-io.o
posix-io.c: In function '_gpgme_io_spawn':
posix-io.c:577:23: error: void value not ignored as it ought to be
  577 |             while ((i = closefrom (fd)) && errno == EINTR)
      |                       ^
make[1]: *** [Makefile:941: posix-io.lo] Error 1
make[1]: Leaving directory
'/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ext/gpgme/tmp/x86_64-linux-gnu/ports/gpgme/1.13.1/gpgme-1.13.1/src'
make: *** [Makefile:534: all-recursive] Error 1
========================================================================
*** 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=/srv/http/ekylibre/.rbenv/versions/2.6.6/bin/$(RUBY_BASE_NAME)
	--clean
	--use-system-libraries
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mini_portile2-2.8.1/lib/mini_portile2/mini_portile.rb:460:in `block in execute': Failed
to complete compile task (RuntimeError)
	from /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mini_portile2-2.8.1/lib/mini_portile2/mini_portile.rb:426:in `chdir'
	from /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mini_portile2-2.8.1/lib/mini_portile2/mini_portile.rb:426:in `execute'
	from /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mini_portile2-2.8.1/lib/mini_portile2/mini_portile.rb:144:in `compile'
	from /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mini_portile2-2.8.1/lib/mini_portile2/mini_portile.rb:187:in `cook'
	from extconf.rb:129:in `block in <main>'
	from extconf.rb:105:in `tap'
	from extconf.rb:105:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20 for inspection.
Results logged to /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/gpgme-2.0.20/gem_make.out

An error occurred while installing gpgme (2.0.20), and Bundler cannot continue.
Make sure that `gem install gpgme -v '2.0.20' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  gpgme


Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mini_racer-0.6.3/ext/mini_racer_extension
/srv/http/ekylibre/.rbenv/versions/2.6.6/bin/ruby -I /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/2.6.0 -r ./siteconf20230426-202733-1dtopmg.rb
extconf.rb
checking for -lpthread... yes
checking for whether -Wl,--exclude-libs=ALL  is accepted as LDFLAGS... no
creating Makefile

current directory: /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mini_racer-0.6.3/ext/mini_racer_extension
make "DESTDIR=" clean

current directory: /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mini_racer-0.6.3/ext/mini_racer_extension
make "DESTDIR="
compiling mini_racer_extension.cc
cc1plus: warning: command-line option ‘-Wimplicit-int’ is valid for C/ObjC but not for C++
In file included from /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/libv8-node-16.10.0.0-x86_64-linux/vendor/v8/include/v8.h:30,
                 from mini_racer_extension.cc:6:
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/libv8-node-16.10.0.0-x86_64-linux/vendor/v8/include/v8-internal.h: In function ‘VALUE
convert_v8_to_ruby(v8::Isolate*, v8::Local<v8::Context>, v8::Local<v8::Value>)’:
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/libv8-node-16.10.0.0-x86_64-linux/vendor/v8/include/v8-internal.h:364:48: warning:
‘stackCounter.StackCounter::isolate’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  364 |     return *reinterpret_cast<void* const*>(addr);
      |                                                ^
mini_racer_extension.cc:569:18: note: ‘stackCounter.StackCounter::isolate’ was declared here
  569 |     StackCounter stackCounter(isolate);
      |                  ^~~~~~~~~~~~
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1plus: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1plus: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
linking shared-object mini_racer_extension.so
/usr/bin/ld: cannot find
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/libv8-node-16.10.0.0-x86_64-linux/vendor/v8/x86_64-linux/libv8/obj/libv8_monolith.a: No
such file or directory
collect2: error: ld returned 1 exit status
make: *** [Makefile:262: mini_racer_extension.so] Error 1

make failed, exit code 2

Gem files will remain installed in /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mini_racer-0.6.3 for inspection.
Results logged to /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/mini_racer-0.6.3/gem_make.out

An error occurred while installing mini_racer (0.6.3), and Bundler cannot continue.
Make sure that `gem install mini_racer -v '0.6.3' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  mini_racer

@HLFH
Copy link

HLFH commented Apr 26, 2023

New update.

diff --git a/Gemfile b/Gemfile
index 4b4fe9cd8e..1118079856 100644
--- a/Gemfile
+++ b/Gemfile
@@ -92,7 +92,7 @@ gem 'exception_notification', '~> 4.4'
 gem 'redis-namespace', '~> 1.8'
 
 # Manipulate map data
-gem 'charta', path: '../charta' # gitlab: 'ekylibre/charta', branch: 'master'
+gem 'charta', gitlab: 'ekylibre/charta', branch: 'master'
 gem 'geocoder', '~> 1.6'
 gem 'rgeo', '~> 2.2'
 gem 'rgeo-geojson', '~> 2.1'
diff --git a/bin/install/ubuntu_22_04 b/bin/install/ubuntu_22_04
index 2e24658b2e..a42861d87b 100644
--- a/bin/install/ubuntu_22_04
+++ b/bin/install/ubuntu_22_04
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-# This script is a way to set up or update your development environment automatically for Ubuntu 20.04.
+# This script is a way to set up or update your development environment automatically for Ubuntu 22.04.
 
 # Exit if any subcommand fails
 set -e
@@ -43,10 +43,63 @@ rbenv global $RUBY_VERSION
 rbenv rehash
 
 # Install nvm
-# TODO
+if [ -d "$HOME/.nvm" ];
+then
+    echo "✅ Node.js directory exist"
+else
+  echo "🚚 Installing Node.js..."
+  curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
+  export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
+  [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
+  nvm install 14.17.4
+  nvm alias default 14.17.4
+  npm i -g yarn
+  echo "✅ Node.js installed."
+fi
 
 # Install Postgresql / Postgis
-# TODO
+DIR_POSTGRES=/etc/postgresql/13
+if [ -d "$DIR_POSTGRES" ];
+then
+    echo "✅ Postgresql 13 directory exist"
+else
+  # Configure PostGres
+  echo "🚚 Installing Postgresql && Postgis..."
+  sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
+  wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
+  sudo apt-get update
+  sudo apt-get install -qq -y postgresql-13 postgresql-client-13 postgresql-13-postgis-3 postgresql-13-postgis-3-scripts
+  echo "✅ Postgresql 13 && Postgis 3 installed."
+  # sudo -su postgres
+  # createuser -d -P -s ekylibre
+  # psql -c \"CREATE USER ekylibre WITH PASSWORD 'ekylibre';\"
+  # psql -c \"ALTER USER ekylibre SUPERUSER; \"
+  # echo "ALTER USER ekylibre SUPERUSER;" | psql
+  if psql -t -c '\du' | cut -d \| -f 1 | grep -qw ekylibre; then
+    echo "✅ Postgresql role ekylibre already exist."
+  else
+    sudo -u postgres bash -c "psql -c \"CREATE USER ekylibre WITH PASSWORD 'ekylibre';\""
+    sudo -u postgres bash -c "psql -c \"ALTER USER ekylibre SUPERUSER;\""
+    echo "✅ Postgresql role ekylibre created."
+  fi
+
+  # TODO : Edit pg_hba.conf to use md5 password authentication instead of peer authentication for unix sockets
+  # Find and replace in file (local   all  all  peer) by (local  all  all md5)
+  # sudo vim /etc/postgresql/13/main/pg_hba.conf
+  echo "🛠️  Editing pg_hba.conf"
+  file="/etc/postgresql/13/main/pg_hba.conf"
+  sudo sed -i '/^local all all peer/ s/peer/md5/' $file
+  echo "✅ Postgresql 13 setup OK."
+fi
+
+# replace Proj version with version working with Rgeo
+# PROJ_VERSION=pkg-config --modversion proj
+echo "🚚 Configuring Proj specific version ..."
+sudo mkdir -p /opt/proj/share
+sudo tar -xvzf bin/install/proj.tar.gz -C /opt/proj/share
+echo "✅ Proj specific version installed."
 
-# Install Java
-# TODO
+# Java & Redis
+echo 'export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64' >> ~/.bashrc
+echo 'export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64' >> ~/.profile
+echo "✅ Java path configured."
diff --git a/bin/setup b/bin/setup
index fda6409b4b..11ff8d713e 100755
--- a/bin/setup
+++ b/bin/setup
@@ -20,14 +20,16 @@ cat bin/install/alt.txt
 # Install OS-specific packages for MacOS, Debian, and Ubuntu
 if [[ "$OSTYPE" == "darwin"* ]]; then
   # Mac OSX
-  sh bin/install/./macos
+  bash bin/install/./macos
 elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
   # Detecting OS Version
   OS_VERSION=$(lsb_release -ds)
   if [[ "$OS_VERSION" == "Ubuntu 20.04"* ]]; then
-    sh bin/install/./ubuntu_20_04
+    bash bin/install/./ubuntu_20_04
   elif [[ "$OS_VERSION" == "Ubuntu 22.04"* ]]; then
-    sh bin/install/./ubuntu_22_04
+    bash bin/install/./ubuntu_22_04
+    . ~/.bashrc
+    . ~/.profile
   else
     echo "Unsupported Linux OS Version. Cannot install dependencies for $OS_VERSION."
   fi

JAVA_HOME variable was not taken into account if the source command was not set in the bin/setup script.

@HLFH
Copy link

HLFH commented Apr 26, 2023

And...new error.

Installing beardley-xml 1.1.2
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ext/gpgme
/srv/http/ekylibre/.rbenv/versions/2.6.6/bin/ruby -I /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/2.6.0 -r ./siteconf20230426-328172-ga6ctk.rb
extconf.rb
************************************************************************
IMPORTANT!  gpgme gem uses locally built versions of required C libraries,
namely libgpg-error, libassuan, and gpgme.

If this is a concern for you and you want to use the system library
instead, abort this installation process and reinstall gpgme gem as
follows:

    gem install gpgme -- --use-system-libraries

************************************************************************
Extracting libgpg-error-1.37.tar.bz2 into tmp/x86_64-linux-gnu/ports/libgpg-error/1.37... OK
Running 'configure' for libgpg-error 1.37... OK
Running 'compile' for libgpg-error 1.37... OK
Running 'install' for libgpg-error 1.37... OK
Activating libgpg-error 1.37 (from
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37)...
Extracting libassuan-2.5.3.tar.bz2 into tmp/x86_64-linux-gnu/ports/libassuan/2.5.3... OK
Running 'configure' for libassuan 2.5.3... OK
Running 'compile' for libassuan 2.5.3... OK
Running 'install' for libassuan 2.5.3... OK
Activating libassuan 2.5.3 (from
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3)...
Extracting gpgme-1.13.1.tar.bz2 into tmp/x86_64-linux-gnu/ports/gpgme/1.13.1... OK
Running 'configure' for gpgme 1.13.1... OK
Running 'compile' for gpgme 1.13.1... ERROR, review
'/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ext/gpgme/tmp/x86_64-linux-gnu/ports/gpgme/1.13.1/compile.log' to see
what happened. Last lines are:
========================================================================
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../conf
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37/include -fPIC -Wall
-Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k -Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT engine-spawn.lo -MD -MP -MF .deps/engine-spawn.Tpo -c engine-spawn.c -o engine-spawn.o
mv -f .deps/engine-spawn.Tpo .deps/engine-spawn.Plo
/bin/bash ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../conf   
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37/include  -fPIC  -Wall
-Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k -Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT gpgconf.lo -MD -MP -MF .deps/gpgconf.Tpo -c -o gpgconf.lo gpgconf.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../conf
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37/include -fPIC -Wall
-Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k -Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT gpgconf.lo -MD -MP -MF .deps/gpgconf.Tpo -c gpgconf.c -o gpgconf.o
mv -f .deps/gpgconf.Tpo .deps/gpgconf.Plo
/bin/bash ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../conf   
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37/include  -fPIC  -Wall
-Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k -Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT queryswdb.lo -MD -MP -MF .deps/queryswdb.Tpo -c -o queryswdb.lo queryswdb.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../conf
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37/include -fPIC -Wall
-Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k -Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT queryswdb.lo -MD -MP -MF .deps/queryswdb.Tpo -c queryswdb.c -o queryswdb.o
mv -f .deps/queryswdb.Tpo .deps/queryswdb.Plo
/bin/bash ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../conf   
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37/include  -fPIC  -Wall
-Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k -Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT posix-util.lo -MD -MP -MF .deps/posix-util.Tpo -c -o posix-util.lo posix-util.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../conf
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37/include -fPIC -Wall
-Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k -Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT posix-util.lo -MD -MP -MF .deps/posix-util.Tpo -c posix-util.c -o posix-util.o
mv -f .deps/posix-util.Tpo .deps/posix-util.Plo
/bin/bash ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../conf   
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37/include  -fPIC  -Wall
-Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k -Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT posix-io.lo -MD -MP -MF .deps/posix-io.Tpo -c -o posix-io.lo posix-io.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../conf
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libassuan/2.5.3/include
-I/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ports/x86_64-linux-gnu/libgpg-error/1.37/include -fPIC -Wall
-Wcast-align -Wshadow -Wstrict-prototypes -Wno-format-y2k -Wno-missing-field-initializers -Wno-sign-compare -Wno-format-zero-length
-Wno-format-truncation -Wno-sizeof-pointer-div -MT posix-io.lo -MD -MP -MF .deps/posix-io.Tpo -c posix-io.c -o posix-io.o
posix-io.c: In function '_gpgme_io_spawn':
posix-io.c:577:23: error: void value not ignored as it ought to be
  577 |             while ((i = closefrom (fd)) && errno == EINTR)
      |                       ^
make[1]: *** [Makefile:941: posix-io.lo] Error 1
make[1]: Leaving directory
'/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20/ext/gpgme/tmp/x86_64-linux-gnu/ports/gpgme/1.13.1/gpgme-1.13.1/src'
make: *** [Makefile:534: all-recursive] Error 1
========================================================================
*** 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=/srv/http/ekylibre/.rbenv/versions/2.6.6/bin/$(RUBY_BASE_NAME)
	--clean
	--use-system-libraries
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mini_portile2-2.8.1/lib/mini_portile2/mini_portile.rb:460:in `block in execute': Failed
to complete compile task (RuntimeError)
	from /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mini_portile2-2.8.1/lib/mini_portile2/mini_portile.rb:426:in `chdir'
	from /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mini_portile2-2.8.1/lib/mini_portile2/mini_portile.rb:426:in `execute'
	from /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mini_portile2-2.8.1/lib/mini_portile2/mini_portile.rb:144:in `compile'
	from /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mini_portile2-2.8.1/lib/mini_portile2/mini_portile.rb:187:in `cook'
	from extconf.rb:129:in `block in <main>'
	from extconf.rb:105:in `tap'
	from extconf.rb:105:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/gpgme-2.0.20 for inspection.
Results logged to /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/gpgme-2.0.20/gem_make.out

An error occurred while installing gpgme (2.0.20), and Bundler cannot continue.
Make sure that `gem install gpgme -v '2.0.20' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  gpgme


Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mini_racer-0.6.3/ext/mini_racer_extension
/srv/http/ekylibre/.rbenv/versions/2.6.6/bin/ruby -I /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/2.6.0 -r ./siteconf20230426-328172-1cwiiuj.rb
extconf.rb
checking for -lpthread... yes
checking for whether -Wl,--exclude-libs=ALL  is accepted as LDFLAGS... no
creating Makefile

current directory: /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mini_racer-0.6.3/ext/mini_racer_extension
make "DESTDIR=" clean

current directory: /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mini_racer-0.6.3/ext/mini_racer_extension
make "DESTDIR="
compiling mini_racer_extension.cc
cc1plus: warning: command-line option ‘-Wimplicit-int’ is valid for C/ObjC but not for C++
In file included from /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/libv8-node-16.10.0.0-x86_64-linux/vendor/v8/include/v8.h:30,
                 from mini_racer_extension.cc:6:
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/libv8-node-16.10.0.0-x86_64-linux/vendor/v8/include/v8-internal.h: In function ‘VALUE
convert_v8_to_ruby(v8::Isolate*, v8::Local<v8::Context>, v8::Local<v8::Value>)’:
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/libv8-node-16.10.0.0-x86_64-linux/vendor/v8/include/v8-internal.h:364:48: warning:
‘stackCounter.StackCounter::isolate’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  364 |     return *reinterpret_cast<void* const*>(addr);
      |                                                ^
mini_racer_extension.cc:569:18: note: ‘stackCounter.StackCounter::isolate’ was declared here
  569 |     StackCounter stackCounter(isolate);
      |                  ^~~~~~~~~~~~
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1plus: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1plus: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
linking shared-object mini_racer_extension.so
/usr/bin/ld: cannot find
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/libv8-node-16.10.0.0-x86_64-linux/vendor/v8/x86_64-linux/libv8/obj/libv8_monolith.a: No
such file or directory
collect2: error: ld returned 1 exit status
make: *** [Makefile:262: mini_racer_extension.so] Error 1

make failed, exit code 2

Gem files will remain installed in /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mini_racer-0.6.3 for inspection.
Results logged to /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/mini_racer-0.6.3/gem_make.out

An error occurred while installing mini_racer (0.6.3), and Bundler cannot continue.
Make sure that `gem install mini_racer -v '0.6.3' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  mini_racer

I'd say the gpgme gem needs to be at least >= 2.0.21.
https://dev.gnupg.org/T5561
https://dev.gnupg.org/rM4b64774b6d13ffa4f59dddf947a97d61bcfa2f2e

@HLFH
Copy link

HLFH commented Apr 26, 2023

Gemfile fix for gpgme.

diff --git a/Gemfile b/Gemfile
index 4b4fe9cd8e..7b93a22c75 100644
--- a/Gemfile
+++ b/Gemfile
@@ -92,7 +92,7 @@ gem 'exception_notification', '~> 4.4'
 gem 'redis-namespace', '~> 1.8'
 
 # Manipulate map data
-gem 'charta', path: '../charta' # gitlab: 'ekylibre/charta', branch: 'master'
+gem 'charta', gitlab: 'ekylibre/charta', branch: 'master'
 gem 'geocoder', '~> 1.6'
 gem 'rgeo', '~> 2.2'
 gem 'rgeo-geojson', '~> 2.1'
@@ -155,7 +155,7 @@ gem 'caxlsx'
 gem 'charlock_holmes', '~> 0.7.7'
 gem 'combine_pdf', '~> 1.0'
 gem 'ekylibre-ofx-parser', '~> 1.2'
-gem 'gpgme', '~> 2.0'
+gem 'gpgme', '~> 2.0', '>= 2.0.21'
 gem 'holidays' # Deal with statutory and other holidays
 gem 'luhn', '~> 1.0'
 gem 'mimemagic', '~> 0.3.5'

@HLFH
Copy link

HLFH commented Apr 26, 2023

Remaining error:

Installing mini_racer 0.6.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mini_racer-0.6.3/ext/mini_racer_extension
/srv/http/ekylibre/.rbenv/versions/2.6.6/bin/ruby -I /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/2.6.0 -r ./siteconf20230426-359882-vw7amc.rb
extconf.rb
checking for -lpthread... yes
checking for whether -Wl,--exclude-libs=ALL  is accepted as LDFLAGS... no
creating Makefile

current directory: /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mini_racer-0.6.3/ext/mini_racer_extension
make "DESTDIR=" clean

current directory: /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mini_racer-0.6.3/ext/mini_racer_extension
make "DESTDIR="
compiling mini_racer_extension.cc
cc1plus: warning: command-line option ‘-Wimplicit-int’ is valid for C/ObjC but not for C++
In file included from /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/libv8-node-16.10.0.0-x86_64-linux/vendor/v8/include/v8.h:30,
                 from mini_racer_extension.cc:6:
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/libv8-node-16.10.0.0-x86_64-linux/vendor/v8/include/v8-internal.h: In function ‘VALUE
convert_v8_to_ruby(v8::Isolate*, v8::Local<v8::Context>, v8::Local<v8::Value>)’:
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/libv8-node-16.10.0.0-x86_64-linux/vendor/v8/include/v8-internal.h:364:48: warning:
‘stackCounter.StackCounter::isolate’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  364 |     return *reinterpret_cast<void* const*>(addr);
      |                                                ^
mini_racer_extension.cc:569:18: note: ‘stackCounter.StackCounter::isolate’ was declared here
  569 |     StackCounter stackCounter(isolate);
      |                  ^~~~~~~~~~~~
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1plus: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1plus: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
linking shared-object mini_racer_extension.so
/usr/bin/ld: cannot find
/srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/libv8-node-16.10.0.0-x86_64-linux/vendor/v8/x86_64-linux/libv8/obj/libv8_monolith.a: No
such file or directory
collect2: error: ld returned 1 exit status
make: *** [Makefile:262: mini_racer_extension.so] Error 1

make failed, exit code 2

Gem files will remain installed in /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mini_racer-0.6.3 for inspection.
Results logged to /srv/http/ekylibre/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/mini_racer-0.6.3/gem_make.out

An error occurred while installing mini_racer (0.6.3), and Bundler cannot continue.
Make sure that `gem install mini_racer -v '0.6.3' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  mini_racer

Linked to: rubyjs/mini_racer#218
rubyjs/mini_racer#250 (comment)

Probably fixed with:

diff --git a/Gemfile b/Gemfile
index 4b4fe9cd8e..f42142869f 100644
--- a/Gemfile
+++ b/Gemfile
@@ -64,7 +64,7 @@ gem 'jquery-rails', '~> 4.4'
 gem 'jquery-ui-rails', '~> 6.0'
 gem 'momentjs-rails', '>= 2.9.0'
 gem 'simple_calendar', '~> 2.4.0'
-gem 'mini_racer', platforms: :ruby
+gem 'mini_racer', '< 0.5.0', platforms: :ruby
 gem 'turbolinks', '~> 5.2.1'
 gem 'twitter-typeahead-rails', '~> 0.11.1'
 
@@ -92,7 +92,7 @@ gem 'exception_notification', '~> 4.4'
 gem 'redis-namespace', '~> 1.8'
 
 # Manipulate map data
-gem 'charta', path: '../charta' # gitlab: 'ekylibre/charta', branch: 'master'
+gem 'charta', gitlab: 'ekylibre/charta', branch: 'master'
 gem 'geocoder', '~> 1.6'
 gem 'rgeo', '~> 2.2'
 gem 'rgeo-geojson', '~> 2.1'
@@ -155,7 +155,7 @@ gem 'caxlsx'
 gem 'charlock_holmes', '~> 0.7.7'
 gem 'combine_pdf', '~> 1.0'
 gem 'ekylibre-ofx-parser', '~> 1.2'
-gem 'gpgme', '~> 2.0'
+gem 'gpgme', '~> 2.0', '>= 2.0.21'
 gem 'holidays' # Deal with statutory and other holidays
 gem 'luhn', '~> 1.0'
 gem 'mimemagic', '~> 0.3.5'

Next error:

   bin/rails db:create db:migrate
Proj4 is not supported. Some actions won't work
rails aborted!
PG::ConnectionBad: connection to server at "127.0.0.1", port 5432 failed: FATAL:  password authentication failed for user "public,postgis,lexicon"
connection to server at "127.0.0.1", port 5432 failed: FATAL:  password authentication failed for user "public,postgis,lexicon"
/srv/http/ekylibre/app/config/environment.rb:5:in `<main>'
bin/rails:4:in `<main>'
Tasks: TOP => db:create => db:load_config => environment
(See full trace by running task with --trace)

Fixed with:

diff --git a/bin/setup b/bin/setup
index fda6409b4b..150257733e 100755
--- a/bin/setup
+++ b/bin/setup
@@ -20,14 +20,16 @@ cat bin/install/alt.txt
 # Install OS-specific packages for MacOS, Debian, and Ubuntu
 if [[ "$OSTYPE" == "darwin"* ]]; then
   # Mac OSX
-  sh bin/install/./macos
+  bash bin/install/./macos
 elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
   # Detecting OS Version
   OS_VERSION=$(lsb_release -ds)
   if [[ "$OS_VERSION" == "Ubuntu 20.04"* ]]; then
-    sh bin/install/./ubuntu_20_04
+    bash bin/install/./ubuntu_20_04
   elif [[ "$OS_VERSION" == "Ubuntu 22.04"* ]]; then
-    sh bin/install/./ubuntu_22_04
+    bash bin/install/./ubuntu_22_04
+    . ~/.bashrc
+    . ~/.profile
   else
     echo "Unsupported Linux OS Version. Cannot install dependencies for $OS_VERSION."
   fi
@@ -89,7 +91,7 @@ if [ ! -f config/database.yml ]; then
   echo "  pool: 10" >> config/database.yml
   echo "  postgis_extension: []" >> config/database.yml
   echo "  schema_search_path: public,postgis,lexicon" >> config/database.yml
-  echo "  username: public,postgis,lexicon" >> config/database.yml
+  echo "  username: ekylibre" >> config/database.yml
   echo "  password: ekylibre" >> config/database.yml
   echo "  host: 127.0.0.1" >> config/database.yml
   echo "test:" >> config/database.yml

@HLFH
Copy link

HLFH commented Apr 26, 2023

New error:

Cloning into 'db/first_runs'...
The authenticity of host 'github.com (140.82.121.3)' can't be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Fixed with:

diff --git a/bin/setup b/bin/setup
index fda6409b4b..e6890e7eea 100755
--- a/bin/setup
+++ b/bin/setup
@@ -20,14 +20,16 @@ cat bin/install/alt.txt
 # Install OS-specific packages for MacOS, Debian, and Ubuntu
 if [[ "$OSTYPE" == "darwin"* ]]; then
   # Mac OSX
-  sh bin/install/./macos
+  bash bin/install/./macos
 elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
   # Detecting OS Version
   OS_VERSION=$(lsb_release -ds)
   if [[ "$OS_VERSION" == "Ubuntu 20.04"* ]]; then
-    sh bin/install/./ubuntu_20_04
+    bash bin/install/./ubuntu_20_04
   elif [[ "$OS_VERSION" == "Ubuntu 22.04"* ]]; then
-    sh bin/install/./ubuntu_22_04
+    bash bin/install/./ubuntu_22_04
+    . ~/.bashrc
+    . ~/.profile
   else
     echo "Unsupported Linux OS Version. Cannot install dependencies for $OS_VERSION."
   fi
@@ -89,7 +91,7 @@ if [ ! -f config/database.yml ]; then
   echo "  pool: 10" >> config/database.yml
   echo "  postgis_extension: []" >> config/database.yml
   echo "  schema_search_path: public,postgis,lexicon" >> config/database.yml
-  echo "  username: public,postgis,lexicon" >> config/database.yml
+  echo "  username: ekylibre" >> config/database.yml
   echo "  password: ekylibre" >> config/database.yml
   echo "  host: 127.0.0.1" >> config/database.yml
   echo "test:" >> config/database.yml
@@ -127,7 +129,7 @@ else
   else
     echo "⚙️ Pull first run for development..."
     # mkdir -p db/first_runs
-    git clone git@github.com:ekylibre/first_run-demo.git db/first_runs
+    git clone https://github.com/ekylibre/first_run-demo.git db/first_runs
   fi
 
   # Load demo first run unless schema is not present in database

@HLFH
Copy link

HLFH commented Apr 26, 2023

Next error:

Linked to: https://stackoverflow.com/questions/10609217/why-is-postgresql-telling-me-a-schema-doesnt-exist

psql -At -c 'SELECT nspname FROM pg_catalog.pg_namespace;' 
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL:  database "ekylibre" does not exist

Probably fixed with:

diff --git a/bin/setup b/bin/setup
index fda6409b4b..8267689900 100755
--- a/bin/setup
+++ b/bin/setup
@@ -20,14 +20,16 @@ cat bin/install/alt.txt
 # Install OS-specific packages for MacOS, Debian, and Ubuntu
 if [[ "$OSTYPE" == "darwin"* ]]; then
   # Mac OSX
-  sh bin/install/./macos
+  bash bin/install/./macos
 elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
   # Detecting OS Version
   OS_VERSION=$(lsb_release -ds)
   if [[ "$OS_VERSION" == "Ubuntu 20.04"* ]]; then
-    sh bin/install/./ubuntu_20_04
+    bash bin/install/./ubuntu_20_04
   elif [[ "$OS_VERSION" == "Ubuntu 22.04"* ]]; then
-    sh bin/install/./ubuntu_22_04
+    bash bin/install/./ubuntu_22_04
+    . ~/.bashrc
+    . ~/.profile
   else
     echo "Unsupported Linux OS Version. Cannot install dependencies for $OS_VERSION."
   fi
@@ -89,12 +91,13 @@ if [ ! -f config/database.yml ]; then
   echo "  pool: 10" >> config/database.yml
   echo "  postgis_extension: []" >> config/database.yml
   echo "  schema_search_path: public,postgis,lexicon" >> config/database.yml
-  echo "  username: public,postgis,lexicon" >> config/database.yml
+  echo "  username: ekylibre_development" >> config/database.yml
   echo "  password: ekylibre" >> config/database.yml
   echo "  host: 127.0.0.1" >> config/database.yml
   echo "test:" >> config/database.yml
   echo "  <<: *development" >> config/database.yml
   echo "  database: ekylibre_test<%= ENV['TEST_ENV_NUMBER'] %>" >> config/database.yml
+  echo "  username: ekylibre_test" >> config/database.yml
 fi
 
 # Get database name from config/database.yml
@@ -127,7 +130,7 @@ else
   else
     echo "⚙️ Pull first run for development..."
     # mkdir -p db/first_runs
-    git clone git@github.com:ekylibre/first_run-demo.git db/first_runs
+    git clone https://github.com/ekylibre/first_run-demo.git db/first_runs
   fi
 
   # Load demo first run unless schema is not present in database

@HLFH
Copy link

HLFH commented Apr 26, 2023

Note: it does seem the script is meant to run as root and not as the ekylibre user.

@HLFH
Copy link

HLFH commented Apr 26, 2023

Forgot the first issue I got:

bin/install/./ubuntu_22_04: 13: /root/.bashrc: shopt: not found

I guess bash bin/install/./ubuntu_22_04 rather than sh bin/install/./ubuntu_22_04.

@HLFH
Copy link

HLFH commented Apr 26, 2023

  echo "⚙️ Migrating database schema..."
  bin/rails db:migrate
else
  echo "⚙️ Creating database..."
  bin/rails db:create db:migrate
fi
🛠️  Creating config/database.yml...
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL:  role "root" does not exist
⚙️ Creating database...
Proj4 is not supported. Some actions won't work
rails aborted!
PG::ConnectionBad: connection to server at "127.0.0.1", port 5432 failed: FATAL:  password authentication failed for user "ekylibre"
connection to server at "127.0.0.1", port 5432 failed: FATAL:  password authentication failed for user "ekylibre"
/root/ekylibre/config/environment.rb:5:in `<main>'
bin/rails:4:in `<main>'
Tasks: TOP => db:create => db:load_config => environment
(See full trace by running task with --trace)

It is better to put sudo -u postgres -i before psql.

EDIT: So, I did fix various issues related to postgresql in the script.
The last error I have is:

⚙️ Execute demo first run for development...
Proj4 is not supported. Some actions won't work
rails aborted!
RGeo::Error::UnsupportedOperation: Coordinate system 'proj4' is not supported.

@HLFH
Copy link

HLFH commented Apr 27, 2023

The rgeo-proj4 issue is related to the charta gem. I have forked the charta gem and added these changes. https://gitlab.com/HLFH/charta/-/compare/master...master?from_project_id=12321757

Related to: rgeo/rgeo-proj4#4
And: rgeo/rgeo-proj4#10
And with rgeo-proj4 v3: rgeo/rgeo-proj4#24
I'll have to check that: https://github.com/rgeo/rgeo-proj4/blob/master/docs/Upgrading-To-V4.md
And that: https://github.com/rgeo/rgeo/blob/main/doc/Upgrading-to-v3.md

Now getting:

NameError: uninitialized constant RGeo::CoordSys::SRSDatabase

As seen here (https://github.com/rgeo/rgeo/blob/main/doc/Upgrading-to-v3.md), SRSDatabase usage was apparently removed in RGeo Version 3.0.
Related to: rgeo/rgeo#319
And: rgeo/rgeo#314 & rgeo/rgeo@81f5deb

EDIT: I finally stayed on:

  spec.add_dependency 'rgeo', '~> 2.0'
  spec.add_dependency 'rgeo-geojson', '~> 2.0'
  spec.add_dependency 'rgeo-proj4', '~> 3.0'

Fixing this issue rgeo/rgeo-proj4#24 in lib/charta/geometry.rb was easier than updating too much these gems.
Probably has to be fixed in these files as well to avoid a segfault:

  • db/first_runs/demo-production/alamano/georeadings/georeadings.qgs
  • db/first_runs/demo-innovation/alamano/georeadings/georeadings.qgs
  • db/first_runs/demo/alamano/georeadings/georeadings.qgs
  • db/first_runs/demo-gestion/alamano/georeadings/georeadings.qgs
  • lib/ekylibre/first_run/faker/files/trip_simulation.qgs

Because of this line:

git clone https://github.com/ekylibre/first_run-demo.git db/first_runs

I'll have to fork ekylibre/first_run-demo...

@HLFH
Copy link

HLFH commented Apr 27, 2023

It is stated that the dep rgeo depends on proj4. But on Ubuntu 22.04, by default proj 8.2.x is installed so the workaround is to use the proj archive provided by ekylibre. But this archive is causing segfaults.

Search and replace 9072 results in 5 files +no_defs by +no_defs +type=crs:

  • CH
  • IGNF
  • epsg
  • esri
  • other.extra

EDIT: oh, it does seem to work now!!

Hum not yet!

Docsplit::ExtractionFailed: sh: 1: pdftotext: not found

Adding poppler-utils as dep.

@HLFH
Copy link

HLFH commented Apr 27, 2023

New error:

Docsplit::PdfExtractor::OfficeNotFound: No office software found

Adding libreoffice-core-nogui as dep

EDIT: new error...

Errno::ENOENT: No such file or directory @ rb_sysopen - /tmp/paperclip-document-rts8n1d9stne/6e0a9be89a097cecce18facf6597b4fa20230427-1129400-h2b7g4.pdf

Related to:

app/exchangers/ekylibre/sales_exchanger.rb

   def link_document(sale)
        if @attachments_dir.present?
          attachment_potential_path = @attachments_dir.join(sale.client.name.parameterize,
                                                            sale.reference_number + ".*")
          attachment_paths = Dir.glob(attachment_potential_path)
          attachment_paths.each do |attachment_path|
            doc = Document.new(file: File.open(attachment_path))
            sale.attachments.create!(document: doc)
          end
        end
      end

app/models/document.rb

 has_attached_file :file, path: ':tenant/:class/:id_partition/:style.:extension',
                           styles: {
                             default:   { format: :pdf, processors: %i[reader counter freezer], clean: true },
                             thumbnail: { format: :jpg, processors: %i[sketcher thumbnail], geometry: '320x320>' }
                           }

Go here for details > ekylibre/paperclip-document#4

@HLFH
Copy link

HLFH commented May 4, 2023

Fixed. My Ubuntu 22.04 setup is now working.

@ionosphere
Copy link
Member Author

Hi @HLFH ,
Thanks for this return. I will update main branch for eky repository. I will review your change.
We work on a docker compose install for the moment too.

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

Successfully merging this pull request may close these issues.

None yet

3 participants