Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while loading Ultralight libraries #25

Closed
izolate opened this issue Oct 10, 2019 · 11 comments
Closed

Error while loading Ultralight libraries #25

izolate opened this issue Oct 10, 2019 · 11 comments

Comments

@izolate
Copy link

izolate commented Oct 10, 2019

Hi,

I've been following the steps in your "Getting Started with Muon" guide but cannot run the binary at the end. I get the following error:

$ ./cra-go
./cra-go: error while loading shared libraries: libWebCore.so: cannot open shared object file: No such file or directory

I assume this means it cannot find the Ultralight libraries in the current directory. However, they are present.

$ pwd
/home/me/muon/examples/create-react-app

$ ls
b0x.yml  cra-go  go.mod  go.sum  libAppCore.so  libUltralightCore.so  libUltralight.so  libWebCore.so  main.go  public  README.md  webfiles

Any help would be greatly appreciated. Thanks!

@stephane-r
Copy link

stephane-r commented Oct 10, 2019

Same result with same example projet 👍

I've try to webfiles folder to test too :)

@ImVexed
Copy link
Owner

ImVexed commented Oct 10, 2019

This is due to how Linux resolves shared objects but I failed to mention it in the getting started document. Right now it's only checking your system /var/lib(?) directory for the libraries not the local directory. This can be immediately resolved by setting the environment variable LD_LIBRARY_PATH=. or whatever folder you have the libraries in.

In the future I'd like to use -rpath to statically set the resolution path in the binary but want to find an easy way to abstract control of the path to end users so for now just use that environment variable.

@ImVexed ImVexed self-assigned this Oct 10, 2019
@ImVexed
Copy link
Owner

ImVexed commented Oct 10, 2019

Added instructions in getting started with: 7b2e8cb

New issue tracked by: #26

@ImVexed ImVexed closed this as completed Oct 10, 2019
@brandonros
Copy link

I think there is an issue here for Mac users too:

$ ls -l
total 128200
-rw-r--r--   1 bros  staff       180 Oct 10 15:27 README.md
-rw-r--r--   1 bros  staff      1704 Oct 10 15:27 b0x.yml
-rwxr-xr-x   1 bros  staff  11805572 Oct 10 16:12 cra-go
-rw-r--r--   1 bros  staff       149 Oct 10 15:27 go.mod
-rw-------   1 bros  staff       725 Oct 10 16:12 go.sum
-rw-r--r--@  1 bros  staff    228772 Oct  8 23:32 libAppCore.dylib
-rw-r--r--@  1 bros  staff    241208 Oct  8 14:01 libUltralight.dylib
-rw-r--r--@  1 bros  staff   1053192 Oct  7 13:56 libUltralightCore.dylib
-rw-r--r--@  1 bros  staff  52280884 Oct  6 23:03 libWebCore.dylib
-rw-r--r--   1 bros  staff       478 Oct 10 15:27 main.go
drwxr-xr-x  10 bros  staff       320 Oct 10 15:28 public
drwxr-x---   3 bros  staff        96 Oct 10 16:11 webfiles
$ go run main.go
dyld: Library not loaded: @rpath/libUltralightCore.dylib
  Referenced from: /var/folders/32/0hc42gv939q0s8hw62_l74jw0000gn/T/go-build523760123/b001/exe/main
  Reason: image not found
signal: abort trap

@ImVexed
Copy link
Owner

ImVexed commented Oct 10, 2019

@brandonros does setting LD_LIBRARY_PATH have no effect on this?

@ImVexed ImVexed removed their assignment Oct 10, 2019
@rareinator
Copy link

@brandonros does setting LD_LIBRARY_PATH have no effect on this?

@ImVexed I just tested this, and it does not seem to make any difference. I also tried setting the DYLD_LIBRARY_PATH. This also did not work

@ImVexed
Copy link
Owner

ImVexed commented Oct 10, 2019

does go build -ldflags="-r ." have any effect? I haven't had time to test, but that should set @rpath to the current directory, if not, try playing around with it until it points to the right directory that libUltralightCore.dylib resides in

@rareinator
Copy link

That actually works like a charm, just can't use it on the go run main.go but if I build it, and then run the ./cra-go it works perfectly. 😄

@ImVexed
Copy link
Owner

ImVexed commented Oct 10, 2019

Awesome, this has been documented at: https://github.com/ImVexed/muon/blob/master/README.md#q-my-program-cant-find-libultralightcoresodylib-even-though-its-in-the-same-directory

@danawoodman
Copy link

@ImVexed this documentation is no longer in the readme and the note on the getting started page isn't helpful. Would be really nice to have better docs on how to get this to work with go run and go build.

That said, go build -ldflags="-r ." also works for me to get the hello world working 👍

@ImVexed
Copy link
Owner

ImVexed commented Nov 8, 2019

@danawoodman It's right here: https://github.com/ImVexed/muon/blob/master/README.md#q-i-get--libwebcoreso-cannot-open-shared-object-file

I just reformatted the phrasing. I'm also not sure that -r has any effect when using go run so I'm unaware of any workarounds at this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants