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

Build problems with using Go modules #1

Open
prologic opened this issue Dec 23, 2019 · 2 comments · May be fixed by #2
Open

Build problems with using Go modules #1

prologic opened this issue Dec 23, 2019 · 2 comments · May be fixed by #2

Comments

@prologic
Copy link

I think this is some weird path problems when depending on your library using Go modules

See:

prologic@Jamess-iMac
Tue Dec 24 09:16:35
~/Projects/ubrowser
 0
$ ls SDK/include/AppCore/
App.h  AppCore.h  CAPI.h  Defines.h  JSHelpers.h  Monitor.h  Overlay.h  Window.h

prologic@Jamess-iMac
Tue Dec 24 09:16:37
~/Projects/ubrowser
 0
$ go build -v .
github.com/raff/ultralight-go
# github.com/raff/ultralight-go
../../go/pkg/mod/github.com/raff/[email protected]/ultralight.go:6:10: fatal error: 'AppCore/CAPI.h' file not found
#include <AppCore/CAPI.h>
         ^~~~~~~~~~~~~~~~
1 error generated.

prologic@Jamess-iMac
Tue Dec 24 09:16:39
~/Projects/ubrowser
 2
$ ls -l
total 28
-rw-r--r--  1 prologic staff  109 Dec 23 18:27 Makefile
drwxr-xr-x  5 prologic staff  160 Dec 24 08:43 SDK
drwxr-xr-x 11 prologic staff  352 Dec 23 18:27 assets
-rw-r--r--  1 prologic staff  119 Dec 23 18:27 go.mod
-rw-r--r--  1 prologic staff  233 Dec 23 18:27 go.sum
-rw-r--r--  1 prologic staff  240 Dec 23 18:27 main.go
-rw-r--r--  1 prologic staff 1475 Dec 23 18:27 tab.go
-rw-r--r--  1 prologic staff 6412 Dec 23 18:27 ui.go

The hard-coded -I ./SDK/... in ultralight.go can't locate the include files.

To be honest I'm not really sure what to do about this besides forking/hacking your library for my own uses.

@prologic
Copy link
Author

I managed to get pat the "file not found" issue by doing:

  • Clone this repo outside of $GOPATH
  • Ran go mod init github.com/raff/ultralight-go

And:

prologic@Jamess-iMac
Tue Dec 24 09:25:35
~/tmp/ultralight-go
 (master) 0
$ go run examples/resize.go
# github.com/raff/ultralight-go
./ultralight.go:318:32: not enough arguments in call to _Cfunc_ulCreateApp
	have (_Ctype_ULConfig)
	want (*_Ctype_struct_C_Settings, *_Ctype_struct_C_Config)

Looks like your bindings are slightly out-of-date?

@prologic
Copy link
Author

Was able to get the examples/resizer.go working with this patch:

prologic@Jamess-iMac
Tue Dec 24 09:28:32
~/tmp/ultralight-go
 (master) 0
$ git diff
diff --git a/ultralight.go b/ultralight.go
index 228d80e..afdaf12 100644
--- a/ultralight.go
+++ b/ultralight.go
@@ -118,13 +118,14 @@ static inline JSObjectRef make_function_callback(JSContextRef ctx, JSStringRef n
 }
 */
 import "C"
-import "unsafe"
-import "unicode/utf16"
-import "unicode/utf8"
-import "reflect"
-import "bytes"
-
-import "log"
+import (
+       "bytes"
+       "log"
+       "reflect"
+       "unicode/utf16"
+       "unicode/utf8"
+       "unsafe"
+)

 type JSType int

@@ -315,7 +316,7 @@ func decodeJSString(s C.JSStringRef) string {
 //
 // Note: You should only create one of these per application lifetime.
 func NewApp() *App {
-       return &App{app: C.ulCreateApp(C.ulCreateConfig()), windows: map[C.ULWindow]*Window{}}
+       return &App{app: C.ulCreateApp(C.ulCreateSettings(), C.ulCreateConfig()), windows: map[C.ULWindow]*Window{}}
 }

 // Destroy destroys the App instance.

@prologic prologic linked a pull request Dec 23, 2019 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant