ui icon indicating copy to clipboard operation
ui copied to clipboard

How to install on OSX 10.11.4

Open cospotato opened this issue 8 years ago • 11 comments

I just run go get command, the go compiler said can not find ui.h, then I put the files in libui to the root of the github.com/andlabs/ui and redo the go get the compiler return this

CosPotato-Mac:~ CosPotato$ go get github.com/andlabs/ui
# github.com/andlabs/ui
ld: library not found for -lui
clang: error: linker command failed with exit code 1 (use -v to see invocation)

And my go version and gcc version

CosPotato-Mac:~ CosPotato$ go version
go version go1.6 darwin/amd64
CosPotato-Mac:~ CosPotato$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.3.0 (clang-703.0.29)
Target: x86_64-apple-darwin15.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
CosPotato-Mac:~ CosPotato$ 

How can i build the enviroment greatly appreciated

cospotato avatar Apr 05 '16 06:04 cospotato

You cannot just drop the libui source tree into the ui source tree. You have to build libui, then drop its output dylibs into the ui source tree. The instructions are in ui's README.

andlabs avatar Apr 05 '16 06:04 andlabs

I did all the steps in README, make the libui, copy the libui.A.dylib to the root of this repo and symlink it as libui.dylib in the same path. Then go install worked. But when i run the application, another error show up

CosPotato-Mac:~ CosPotato$ $GOBIN/hello
dyld: Library not loaded: @rpath/libui.A.dylib
  Referenced from: /Users/CosPotato/GoProjects/bin/hello
  Reason: image not found
Trace/BPT trap: 5

cospotato avatar Apr 08 '16 10:04 cospotato

I had the same problem. The solution is simple: the generated file from libui is not libui.A.dylib but libui.0.dylib :-) @see https://github.com/andlabs/ui/issues/112 for all my problems.

sharpner avatar Apr 08 '16 11:04 sharpner

@sharpner But I found that the file in libui/out are libui.A.dylib and maybe a hard link file libui.dylib. Now the problem solved by copy the libui.A.dylib to $GOBIN,it's work! :)

cospotato avatar Apr 10 '16 05:04 cospotato

You can also use a Mac OS X app folder:

ls  GoApp.app/Contents/MacOS
goapp         libui.A.dylib

and the go binary is compiled with:

tool -L GoApp.app/Contents/MacOS/goapp
GoApp.app/Contents/MacOS/goapp:
    @rpath/libui.A.dylib (compatibility version 0.0.0, current version 0.0.0)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1256.14.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)

sharpner avatar Apr 10 '16 08:04 sharpner

libui.dylib is a symbolic link, not a hard link.

andlabs avatar Apr 10 '16 09:04 andlabs

I can run the example now in terminal or just double click it. But I can not debug in idea with go plugin.Because the plugin does not copy the dylib to the runtime folder. :-) The libui.dylib in libui/out IS a symbolic link, i did not read the information carefully before. I'm so sorry. Greatly Appreciate:)

cospotato avatar Apr 10 '16 10:04 cospotato

I wouldn't know how to fix IDEA; sorry. Perhaps there are some IDEA folks who can help, though?... I don't see why it wouldn't be possible; this isn't the only project that relies on a .so in the executable directory (it might be the first in Go though; it might not need to be in the future if distros make libui available in package repositories).

andlabs avatar Apr 10 '16 18:04 andlabs

Does it work naturally in IDEA now?

andlabs avatar Jun 06 '16 02:06 andlabs

Asking again now that libui is statically linked (and has been for a while): is IDEA fixed?

andlabs avatar Mar 26 '18 13:03 andlabs

Friendly poke

andlabs avatar Jan 04 '19 15:01 andlabs