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

tutorial doesn't launch app on macOS #55

Open
shakfu opened this issue Oct 4, 2022 · 3 comments
Open

tutorial doesn't launch app on macOS #55

shakfu opened this issue Oct 4, 2022 · 3 comments

Comments

@shakfu
Copy link

shakfu commented Oct 4, 2022

I went to the end of the tutorial and complete building the executable successfully, but the executable fails with an Reason: image not found error, basically failing to link to the dylib even though it is copied to the folder in which it resides:

$ pwd
$HOME/Downloads/src/muon/examples/create-react-app

create-react-app $ ls
README.md                    libglib-2.0.dylib@
b0x.yml                      libgmodule-2.0.0.dylib
cra-go*                      libgmodule-2.0.dylib@
go.mod                       libgobject-2.0.0.dylib
go.sum                       libgobject-2.0.dylib@
libAppCore.dylib             libgstreamer-full-1.0.dylib
libUltralight.dylib          libgthread-2.0.0.dylib
libUltralightCore.dylib      libgthread-2.0.dylib@
libWebCore.dylib             main.go
libgio-2.0.0.dylib           public/
libgio-2.0.dylib@            webfiles/
libglib-2.0.0.dylib

create-react-app $ ./cra-go
dyld: Library not loaded: @rpath/libUltralightCore.dylib
  Referenced from: $HOME/Downloads/src/muon/examples/create-react-app/./cra-go
  Reason: image not found
Abort trap: 6

create-react-app $ otool -L cra-go
cra-go:
	@rpath/libUltralightCore.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libWebCore.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libUltralight.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libAppCore.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1677.104.0)
	/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 59306.140.5)

create-react-app $ otool -L libUltralightCore.dylib
libUltralightCore.dylib:
	@rpath/libUltralightCore.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.200.5)

I resolved this by the following

$ export DYLD_LIBRARY_PATH=$PWD

but running ./cra-go after that produces no error but does nothing

Any idea what the issue is?

@shakfu shakfu changed the title tutorial results in 'image not found' on macOS tutorial doesn't launch app on macOS Oct 4, 2022
@ImVexed
Copy link
Owner

ImVexed commented Oct 4, 2022

Does using go build -ldflags "-r ." have any effect?

@shakfu
Copy link
Author

shakfu commented Oct 4, 2022

Thanks for your advice.

After deleting cra-go and running go build -ldflags "-r ." I get the cra-go as above: running it does nothing. or it runs and then closes (without explicit errors).

is there any way to switch on logging in cra-go?

@sha0urya
Copy link

sha0urya commented Oct 4, 2023

To enable logging in your Go program (cra-go in this case), you can use the log package in Go to print information to the console or write it to a file. Here's a simple example of how you can integrate logging in your

Go code: -

  1. Import the log package at the beginning of your Go file:

Go code :-

import ( "log" )

  1. Add logging statements at relevant places in your code. For example, you can use log.Println:

Go code :-

func main() { log.Println("Starting cra-go...") // Your existing code... log.Println("Exiting cra-go.") }

  1. Run your program, and you should see log statements printed to the console.

If the program runs and then closes without explicit errors, adding logging statements can help you trace the execution flow and identify where it might be encountering issues. You can include log statements in functions, loops, or any part of your code that you suspect might be causing the problem.

After adding logging, re-run your program and check the console output for any log messages. These messages can provide insights into the program's behavior and help you identify the root cause of the issue.

I hope that this will work in your case.

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

3 participants