simonkrauter / NiGui

Cross-platform desktop GUI toolkit written in Nim
MIT License
717 stars 51 forks source link

could not load libgtk-3.0.dylib #162

Open whitebm2024 opened 1 year ago

whitebm2024 commented 1 year ago

On a m2 mac air it compiles fine but this is the error it gives when ran

dlopen(libgtk-3.0.dylib, 0x0002): tried: 'libgtk-3.0.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibgtk-3.0.dylib' (no such file), '/usr/lib/libgtk-3.0.dylib' (no such file, not in dyld cache), 'libgtk-3.0.dylib' (no such file), '/usr/local/lib/libgtk-3.0.dylib' (no such file), '/usr/lib/libgtk-3.0.dylib' (no such file, not in dyld cache) could not load: libgtk-3.0.dylib

I've tried a bunch of things including brew install gtk+3 and putting it in an app bundle and other things mentioned in #63 but it still does not work. A similar thing also happens with nimx so I'm not sure what the problem is.

simonkrauter commented 1 year ago

I have no knowledge about macOS, but maybe you could search for the files on your system and compare the file names. Maybe it's a higher Gtk version or another reason for a different file name.

whitebm2024 commented 1 year ago

I realized when running the file command on the dylib and on NiCalc executable that their architectures were arm64 and x86_64 respectively and I'm pretty sure that's no good so I tried to compile with the --cpu:arm option and it gives me this nice error which seems to be saying the nim and c compiler disagree on the size of a pointer. I have no idea how to fix something like this.

In file included from /Users/brandonwhite/.cache/nim/NiCalc_d/@m..@s..@s..@s..@s.choosenim@stoolchains@snim-1.6.10@slib@spure@salgorithm.nim.cIn file included from :8:
/Users/brandonwhite/.choosenim/toolchains/nim-1.6.10/lib/nimbase.h/Users/brandonwhite/.cache/nim/NiCalc_d/@m..@s..@s..@s..@s.choosenim@stoolchains@snim-1.6.10@slib@ssystem@sassertions.nim.c:In file included from 8/Users/brandonwhite/.cache/nim/NiCalc_d/@m..@s..@s..@s..@s.choosenim@stoolchains@snim-1.6.10@slib@sstd@sprivate@sdigitsutils.nim.c:
:8:
In file included from /Users/brandonwhite/.cache/nim/NiCalc_d/@m..@s..@s..@s..@s.choosenim@stoolchains@snim-1.6.10@slib@ssystem@sdollars.nim.c:8:
/Users/brandonwhite/.choosenim/toolchains/nim-1.6.10/lib/nimbase.h:550:1:/Users/brandonwhite/.choosenim/toolchains/nim-1.6.10/lib/nimbase.h: 550In file included from /Users/brandonwhite/.cache/nim/NiCalc_d/@m..@s..@s..@s..@s.choosenim@stoolchains@snim-1.6.10@slib@ssystem@sio.nim.c::8:1: 550In file included from error: In file included from error: static_assert failed due to requirement 'sizeof(int) == sizeof(void *) && 32 == sizeof(int) * 8' "":
/Users/brandonwhite/.cache/nim/NiCalc_d/@m..@s..@s..@s..@s.choosenim@stoolchains@snim-1.6.10@slib@spure@smath.nim.c::8:
/Users/brandonwhite/.cache/nim/NiCalc_d/@m..@s..@s..@s..@s.choosenim@stoolchains@snim-1.6.10@slib@spure@sparseutils.n1: error: static_assert failed due to requirement 'sizeof(int) == sizeof(void *) && 32 == sizeof(int) * 8' ""
im.c:8:
static_assert failed due to requirement 'sizeof(int) == sizeof(void *) && 32 == sizeof(int) * 8' ""
/Users/brandonwhite/.choosenim/toolchains/nim-1.6.10/lib/nimbase.h
In file included from /Users/brandonwhite/.choosenim/toolchains/nim-1.6.10/lib/nimbase.h:/Users/brandonwhite/.cache/nim/NiCalc_d/@m..@s..@s..@s..@s.choosenim@stoolchains@snim-1.6.10@slib@ssystem.nim.c:550:/Users/brandonwhite/.choosenim/toolchains/nim-1.6.10/lib/nimbase.h550:8:550:
:1: /Users/brandonwhite/.choosenim/toolchains/nim-1.6.10/lib/nimbase.herror: static_assert failed due to requirement 'sizeof(int) == sizeof(void *) && 32 == sizeof(int) * 8' "":1:1 :/Users/brandonwhite/.choosenim/toolchains/nim-1.6.10/lib/nimbase.h :550:550error: ::1
error: 1static_assert failed due to requirement 'sizeof(int) == sizeof(void *) && 32 == sizeof(int) * 8' ""::  error: static_assert failed due to requirement 'sizeof(int) == sizeof(void *) && 32 == sizeof(int) * 8' ""error: 
static_assert failed due to requirement 'sizeof(int) == sizeof(void *) && 32 == sizeof(int) * 8' ""

static_assert failed due to requirement 'sizeof(int) == sizeof(void *) && 32 == sizeof(int) * 8' ""
NIM_STATIC_ASSERT(sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(NI)*8, "");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/brandonwhite/.choosenim/toolchains/nim-1.6.10/lib/nimbase.h:276:35: note: expanded from macro 'NIM_STATIC_ASSERT'
#define NIM_STATIC_ASSERT(x, msg) _Static_assert((x), msg)
                                  ^               ~
NIM_STATIC_ASSERT(sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(NI)*8, "");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/brandonwhite/.choosenim/toolchains/nim-1.6.10/lib/nimbase.h:276:35: note: NIM_STATIC_ASSERT(sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(NI)*8, "");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NIM_STATIC_ASSERT(sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(NI)*8, "");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/brandonwhite/.choosenim/toolchains/nim-1.6.10/lib/nimbase.h:276:35: note: expanded from macro 'NIM_STATIC_ASSERT'
#define NIM_STATIC_ASSERT(x, msg) _Static_assert((x), msg)
                                  ^               ~
NIM_STATIC_ASSERT(sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(NI)*8, "");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/brandonwhite/.choosenim/toolchains/nim-1.6.10/lib/nimbase.h:276:35: note: expanded from macro 'NIM_STATIC_ASSERT'
#define NIM_STATIC_ASSERT(x, msg) _Static_assert((x), msg)
                                  ^               ~
NIM_STATIC_ASSERT(sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(NI)*8, "");
NIM_STATIC_ASSERT(sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(NI)*8, "");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/brandonwhite/.choosenim/toolchains/nim-1.6.10/lib/nimbase.h:276:35: note: expanded from macro 'NIM_STATIC_ASSERT'
NIM_STATIC_ASSERT(sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(NI)*8, "");#define NIM_STATIC_ASSERT(x, msg) _Static_assert((x), msg)

                                  ^               ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/brandonwhite/.choosenim/toolchains/nim-1.6.10/lib/nimbase.h:276:35: note: expanded from macro 'NIM_STATIC_ASSERT'
#define NIM_STATIC_ASSERT(x, msg) _Static_assert((x), msg)
                                  ^               ~
/Users/brandonwhite/.choosenim/toolchains/nim-1.6.10/lib/nimbase.hexpanded from macro 'NIM_STATIC_ASSERT':276:35:

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/brandonwhite/.choosenim/toolchains/nim-1.6.10/lib/nimbase.h:276:35: note: expanded from macro 'NIM_STATIC_ASSERT'
#define NIM_STATIC_ASSERT(x, msg) _Static_assert((x), msg)
                                  ^               ~
#define NIM_STATIC_ASSERT(x, msg) _Static_assert((x), msg)
                                  ^               ~
 note: expanded from macro 'NIM_STATIC_ASSERT'
#define NIM_STATIC_ASSERT(x, msg) _Static_assert((x), msg)
                                  ^               ~
1 error generated.
1 error generated1 error generated.
1 error generated.
.
1 error generated.
1 error generated.
Error: execution of an external compiler program 'clang -c  -w -ferror-limit=3   -I/Users/brandonwhite/.choosenim/toolchains/nim-1.6.10/lib -I'/Users/brandonwhite/Documents/code projects/NiCalc/src' -o /Users/brandonwhite/.cache/nim/NiCalc_d/@m..@s..@s..@s..@s.choosenim@stoolchains@snim-1.6.10@slib@ssystem@sdollars.nim.c.o /Users/brandonwhite/.cache/nim/NiCalc_d/@m..@s..@s..@s..@s.choosenim@stoolchains@snim-1.6.10@slib@ssystem@sdollars.nim.c' failed with exit code: 1

1 error generated.                                                                                                                                          
brandonwhite@Brandons-MacBook-Air NiCalc % 1 error generated.
simonkrauter commented 1 year ago

Oh yes, the M2 is an Arm CPU. I think you should look for information how to compile Nim code for this CPU in general, not related to NiGui or Gtk. I don't have any device with Arm CPU to test.