Just opening GraphQL API in Elixir with Absinthe and realised I need Elixir 1.5.0 / OTP 20 to get the examples running. Is there an up to date version of the sample code anywhere or is there a surefire way of getting OTP 20 running on MacOSX 12.5.1
I’m using ASDF and it’s just spitting out the following and I am just staring blankly. I am not even sure I can get it running under Monterey.
The asdf_20.3.8.26 build has been deleted
Extracting source code
Building Erlang/OTP 20.3.8.26 (asdf_20.3.8.26), please wait...
Build failed.
configure: error:
You are natively building Erlang/OTP for a later version of MacOSX
than current version (12.5.1). You either need to
cross-build Erlang/OTP, or set the environment variable
MACOSX_DEPLOYMENT_TARGET to 12.5.1 (or a lower version).
make: *** No rule to make target `is_cross_configured'. Stop.
make: *** No rule to make target `all'. Stop.
Please see /Users/rl/.asdf/plugins/erlang/kerl-home/builds/asdf_20.3.8.26/otp_build_20.3.8.26.log for full details.
I got a ton of warnings, but I’m a rookie at Elixir so I’m not versed in knowing what to ignore and how to fix others yet. I’ll give another try
warning: :crypto.strong_rand_bytes/1 defined in application :crypto is used by the current application but the current application does not depend on :crypto. To fix this, you must do one of:
1. If :crypto is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs
2. If :crypto is a dependency, make sure it is listed under "def deps" in your mix.exs
3. In case you don't want to add a requirement to :crypto, you may optionally skip this warning by adding [xref: [exclude: [:crypto]]] to your "def project" in mix.exs
Invalid call found at 3 locations:
lib/uuid.ex:383: UUID.uuid4/1
lib/uuid.ex:560: UUID.uuid1_clockseq/0
lib/uuid.ex:583: UUID.uuid1_node/1
Been a while since I last saw one of these, maybe somebody else knows what to do exactly but I think you’re better off doing pt. 2 (just include it in your app and call it a day).
If something is wrong after, try mix deps.get and mix compile and let us know.
99% of everything in Erlang/Elixir is backwards compatible. There were some tremors after migrating to OTP 24 some time ago – related to removed builtin crypto functions – but I think most active libraries added conditional code and it’s fine now.
Ok, I quit. I’m just going to continue with the book and see where I actually fallover. I think I was expecting a skeleton PlateSlate application too but instead it’s an umbrella app with lots of child apps that don’t even have Absinthe as a dependency. Don’t know.
drwxr-xr-x@ 7 rl staff 224 30 Aug 22:38 d_graph
drwxr-xr-x@ 8 rl staff 256 30 Aug 22:38 graph_commons
drwxr-xr-x@ 7 rl staff 224 30 Aug 22:38 graph_compute
drwxr-xr-x@ 7 rl staff 224 30 Aug 22:38 native_graph
drwxr-xr-x@ 7 rl staff 224 30 Aug 22:38 property_graph
drwxr-xr-x@ 7 rl staff 224 30 Aug 22:38 rdf_graph
drwxr-xr-x@ 7 rl staff 224 30 Aug 22:38 tinker_graph
asdf install erlang 25.1.1
asdf global erlang 25.1.1
asdf install elixir 1.14.1-otp-25
asdf global elixir 1.14.1-otp-25
cd your_project_dir
asdf local erlang 25.1.1
asdf local elixir 1.14.1-otp-25
Boom, done. The last two lines produce a .tool-versions file in your project directory. You can .gitignore it if you like or you can put it inside version control (I usually do that).
For each newly installed version of Elixir you need to do this only once:
mix local.rebar --force
mix local.hex --force
From then on you can just do mix deps.get and then mix compile as usual.
+1 on @dimitarvp’s reply above me. Do note before installing an Erlang version you may want to check first passing variable (KERL_CONFIGURE_OPTIONS...) before installing it. Pulled my hair out from not reading the readme in full.
Thank you all, I’ll try again. I’m still confused where the PlateSlate application is. The source zip file doesn’t have an application called PlateSlate in it.
I have asdf installed and I use it for Node and Ruby already. I also have it set up for another project. The umbrella app included in the source file just complains about a ton of stuff I have I think my issue is that what’s in the zip file is not what I am expecting. There is no PlateSlate application in there, nor is there any sign of ecto as a dependency in there either.
One of my apps is using…
Erlang/OTP 25 [erts-13.1.1] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit:ns]
[debug] Loading Initial Jobs from Config
[debug] Adding job
[debug] Adding job
Interactive Elixir (1.13.1) - press Ctrl+C to exit (type h() ENTER for help)
Am I going nuts. Not sure if the zip is missing stuff or am I just missing the plot.
Since it’s not a trade-secret app and just an exercise one, you can make a GitHub repo and share the link here. Somebody will check it out and tell you if there’s anything wrong with it.
I wouldn’t want you to give up on Elixir because of a broken or incomplete ZIP file, i.e. a freaky accident.
Nope I’m working on getting more into it. Sometimes you just need to quit on one line of enquiry and try another. In the end it was my fault.
I guess the other zip was for the Exploring Graphs Beta book which is on my radar after this. Never touched GraphQL and it’s nice to see Chapter One touched on my pain points an creating RESTful APIs in Rails.