pablobm created an issue (openstreetmap/openstreetmap-website#6287)
At the moment, the test suite fails when running in a Docker container on Apple
Silicon.
I cloned the repo for the first time today and setup it up using the Docker
instructions. I am using a MacBook Pro on Apple silicon. In my environment, the
test suite is showing a few of these:
```
Error:
TraceTest#test_import_handles_gz:
NoMethodError: undefined method `gdImageCreate' for GD2::GD2FFI:Module
lib/gpx.rb:81:in `block in picture'
lib/gpx.rb:80:in `picture'
app/models/trace.rb:258:in `block in import'
app/models/trace.rb:205:in `import'
test/models/trace_test.rb:255:in `test_import_handles_gz'
```
After looking a bit into it, it appears that the `gd2-ffij` gem doesn't handle
the possibility of `libgd` living under `/usr/lib/aarch64-linux-gnu`. This is
the offending code:
[/lib/gd2-ffij.rb](https://github.com/dark-panda/gd2-ffij/blob/039480b72246463d9ad8acc6aed0536a1a31ec50/lib/gd2-ffij.rb#L35)
I'm not sure there is a non-horrible way to solve this. There's a recent PR in
the `gd2-ffij` repo that would help
(https://github.com/dark-panda/gd2-ffij/pull/28) but the repo hasn't had new
commits since 2021, so I'm not hopeful that it will be merged any time soon.
For the moment, anyone with a setup similar to mine may have to resort to
hacks. For example, I can get things going by adding the following environment
variable in `docker-compose.yml`. However this not portable at all so I can't
just create a PR:
```diff
diff --git a/docker-compose.yml b/docker-compose.yml
index e98824e50..d8293a0f9 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -4,6 +4,7 @@ services:
context: .
environment:
PIDFILE: /tmp/pids/server.pid
+ GD2_LIBRARY_PATH: /usr/lib/aarch64-linux-gnu
volumes:
- .:/app
# Prevent these directories from mounting so they're not shared between
host OS and Docker
```
Thoughts? At least I guess this issue may help as a guide to others who find
the same issue.
By the way, the "horrible ideas" that cross my mind are:
1. Fork `gd2-ffij`.
2. Monkey-patch `GD2::GD2FFI.gd_library_name`.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/6287
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/issues/[email protected]>_______________________________________________
rails-dev mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/rails-dev