Skip to content

Unlock build using Elixir 1.15#4726

Merged
jjrodrig merged 2 commits intoapache:mainfrom
jjrodrig:elixir-15
Aug 15, 2023
Merged

Unlock build using Elixir 1.15#4726
jjrodrig merged 2 commits intoapache:mainfrom
jjrodrig:elixir-15

Conversation

@jjrodrig
Copy link
Contributor

Overview

Elixir 1.5 introduces some changes in the compilation process tha affects to the execution of our test suite. The problem has been reported here #4706

It seems that we are facing one of the incompatibility problems documented in the Elixir 1.15 release notes

Potential incompatibilities
Due to the code path pruning, if you have an application or dependency that does not specify its dependencies on Erlang and Elixir application, it may no longer compile successfully in Elixir v1.15. You can temporarily disable code path pruning by setting prune_code_paths: false in your mix.exs, although doing so may lead to runtime bugs that are only manifested inside a mix release.

Previous to this PR, if we try to run the elixir test suite with Elixir 1.15, the following error appears in any test that uses jiffy.

> make clean couch elixir

 1) test Basic reduce functions (ReduceTest)
     test/elixir/test/reduce_test.exs:16
     ** (UndefinedFunctionError) function :jiffy.decode/2 is undefined (module :jiffy is not available)
     stacktrace:
       (jiffy 1.0.9) :jiffy.decode("{\"ok\":true}\n", [:return_maps])

This PR indroduces the suggested temporary fix in the mix.exs by adding prune_code_paths: false to the build config. With this change we can use Elixir 1.15 in our build process. I've tried to find the problem with our dependency declaration without sucess. This should be a temporary solution until we find the root of the problem.

This PR introduces a second change in the Makefile clean target by adding aditional cleanup for elixir build artifacts.

Testing recommendations

  • Install Erlang >= 24
  • Install Elixir 1.15
  • make clean couch elixir

The elixir test suite should run without problems. Then check the cleanup.

  • make clean
  • find . -name "_build" (No _build folder should be found)
  • MIX_ENV=integration mix deps (should inform that every dependency needs to be compiled/updated)

Related Issues or Pull Requests

This PR proposes a temporary solution for #4706

Checklist

  • Code is written and works correctly
  • Changes are covered by tests
  • Any new configurable parameters are documented in rel/overlay/etc/default.ini
  • Documentation changes were made in the src/docs folder
  • Documentation changes were backported (separated PR) to affected branches

Copy link
Contributor

@big-r81 big-r81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@pgj
Copy link
Contributor

pgj commented Aug 15, 2023

+1 from me as well. I have tested the changes with Elixir 1.14.5 and 1.15.4 and there was no problem. Thank you!

@jjrodrig jjrodrig merged commit e60e275 into apache:main Aug 15, 2023
@jjrodrig
Copy link
Contributor Author

Thanks @pgj and @big-r81

@nickva
Copy link
Contributor

nickva commented Aug 17, 2023

Thanks for fixing it @jjrodrig!

I did notice in the last main full CI build for .deb packages failed to build with this error:

https://ci-couchdb.apache.org/blue/organizations/jenkins/jenkins-cm1%2FFullPlatformMatrix/detail/main/816/pipeline/552/

apache-couchdb-3.3.2-e60e275 (clean)

[2023-08-15T23:19:06.443Z] warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8. Please ensure your locale is set to UTF-8 (which can be verified by running "locale" in your shell)

[2023-08-15T23:19:07.182Z] Could not find Hex, which is needed to build dependency :junit_formatter

[2023-08-15T23:19:07.183Z] Shall I install Hex? (if running non-interactively, use "mix local.hex --force") [Yn] ** (Mix) Could not find an SCM for dependency :junit_formatter from CouchDBTest.Mixfile

[2023-08-15T23:19:07.183Z] Makefile:463: recipe for target 'clean' failed

[2023-08-15T23:19:07.183Z] make[4]: *** [clean] Error 1

[2023-08-15T23:19:07.183Z] make[4]: Leaving directory '/home/jenkins/workspace/kins-cm1_FullPlatformMatrix_main/bionic/couchdb/apache-couchdb-3.3.2-e60e275'

[2023-08-15T23:19:07.183Z] dh_auto_clean: make -j1 distclean returned exit code 2

[2023-08-15T23:19:07.183Z] debian/rules:20: recipe for target 'override_dh_auto_clean' failed

[2023-08-15T23:19:07.183Z] make[3]: *** [override_dh_auto_clean] Error 2

[2023-08-15T23:19:07.183Z] make[3]: Leaving directory '/home/jenkins/workspace/kins-cm1_FullPlatformMatrix_main/bionic/couchdb/apache-couchdb-3.3.2-e60e275'

[2023-08-15T23:19:07.183Z] debian/rules:17: recipe for target 'clean' failed

[2023-08-15T23:19:07.183Z] make[2]: *** [clean] Error 2

[2023-08-15T23:19:07.183Z] make[2]: Leaving directory '/home/jenkins/workspace/kins-cm1_FullPlatformMatrix_main/bionic/couchdb/apache-couchdb-3.3.2-e60e275'

[2023-08-15T23:19:07.183Z] dpkg-buildpackage: error: fakeroot debian/rules clean subprocess returned exit status 2

[2023-08-15T23:19:07.183Z] Makefile:241: recipe for target 'dpkg' failed

[2023-08-15T23:19:07.183Z] make[1]: *** [dpkg] Error 2

[2023-08-15T23:19:07.183Z] make[1]: Leaving directory '/home/jenkins/workspace/kins-cm1_FullPlatformMatrix_main/bionic/couchdb-pkg'

[2023-08-15T23:19:07.183Z] Makefile:41: recipe for target 'all' failed

[2023-08-15T23:19:07.184Z] make: *** [all] Error 2

script returned exit code 2

It mentions hex so was wondering if it's related perhaps to this PR. I'll try to re-run the CI build again to see if fails in the same way.

nickva pushed a commit that referenced this pull request Nov 24, 2023
* Unlock support for Elixir 1.15 builds
* Include elixir build folders into the make clean target
nickva pushed a commit that referenced this pull request Nov 27, 2023
* Unlock support for Elixir 1.15 builds
* Include elixir build folders into the make clean target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments