zonkyio / embedded-postgres

Java embedded PostgreSQL component for testing
Apache License 2.0
352 stars 47 forks source link

Cannot use custom version of postgres on Mac #54

Closed NikolayMetchev closed 3 years ago

NikolayMetchev commented 3 years ago

If I try and specify a custom version of Postgres then my tests fail as outlined below. If I use the default version 10.11.0 then everything works fine.

I am using Gradle 6.8 I have added the following to my build.gradle

    configurations.all {
        resolutionStrategy.eachDependency { DependencyResolveDetails details ->
            if (details.requested.group == 'io.zonky.test.postgres') {
                details.useVersion '10.12.0'
            }
        }

Here is the error message that I get:

2021-01-19 12:07:17,716 [Test worker] INFO  io.zonky.test.db.postgres.embedded.EmbeddedPostgres - Detected a Darwin x86_64 system
2021-01-19 12:07:17,728 [Test worker] INFO  io.zonky.test.db.postgres.embedded.DefaultPostgresBinaryResolver - Detected distribution: 'Unknown'
2021-01-19 12:07:17,734 [Test worker] INFO  io.zonky.test.db.postgres.embedded.DefaultPostgresBinaryResolver - System specific postgres binaries found: postgres-darwin-x86_64.txz
2021-01-19 12:07:17,863 [Test worker] INFO  io.zonky.test.db.postgres.embedded.EmbeddedPostgres - Postgres binaries at /var/folders/p_/chr_twfx2rb_dh293j74hvgm0000gn/T/embedded-pg/PG-27d0af23b0ec8a6e6a4559592ef64d02
2021-01-19 12:07:17,911 [initdb:pid(33613)] INFO  io.zonky.test.db.postgres.embedded.EmbeddedPostgres - dyld: Library not loaded: @loader_path/../lib/libz.1.dylib
2021-01-19 12:07:17,913 [initdb:pid(33613)] INFO  io.zonky.test.db.postgres.embedded.EmbeddedPostgres -   Referenced from: /private/var/folders/p_/chr_twfx2rb_dh293j74hvgm0000gn/T/embedded-pg/PG-27d0af23b0ec8a6e6a4559592ef64d02/lib/libxml2.2.dylib
2021-01-19 12:07:17,913 [initdb:pid(33613)] INFO  io.zonky.test.db.postgres.embedded.EmbeddedPostgres -   Reason: no suitable image found.  Did find:
2021-01-19 12:07:17,913 [initdb:pid(33613)] INFO  io.zonky.test.db.postgres.embedded.EmbeddedPostgres -     file system relative paths not allowed in hardened programs
2021-01-19 12:07:17,914 [initdb:pid(33613)] INFO  io.zonky.test.db.postgres.embedded.EmbeddedPostgres - no data was returned by command ""/private/var/folders/p_/chr_twfx2rb_dh293j74hvgm0000gn/T/embedded-pg/PG-27d0af23b0ec8a6e6a4559592ef64d02/bin/postgres" -V"
2021-01-19 12:07:17,914 [initdb:pid(33613)] INFO  io.zonky.test.db.postgres.embedded.EmbeddedPostgres - The program "postgres" is needed by initdb but was not found in the
2021-01-19 12:07:17,914 [initdb:pid(33613)] INFO  io.zonky.test.db.postgres.embedded.EmbeddedPostgres - same directory as "/private/var/folders/p_/chr_twfx2rb_dh293j74hvgm0000gn/T/embedded-pg/PG-27d0af23b0ec8a6e6a4559592ef64d02/bin/initdb".
2021-01-19 12:07:17,914 [initdb:pid(33613)] INFO  io.zonky.test.db.postgres.embedded.EmbeddedPostgres - Check your installation.
tomix26 commented 3 years ago

You have to use version 10.15.0-1 that fixes the problem with the missing libz library. More info in the following thread: https://github.com/zonkyio/embedded-postgres-binaries/issues/21

NikolayMetchev commented 3 years ago

@tomix26 Thank you.