sciter-sdk / go-sciter

Golang bindings of Sciter: the Embeddable HTML/CSS/script engine for modern UI development
https://sciter.com
2.58k stars 268 forks source link

missed uchar.h on osx #64

Closed nntaoli closed 6 years ago

nntaoli commented 7 years ago

github.com/sciter-sdk/go-sciter

In file included from ./sciter.go:11: In file included from include/sciter-x.h:20: include/sciter-x-types.h:30:12: fatal error: 'uchar.h' file not found

include

       ^

1 error generated.

nntaoli commented 7 years ago

github.com/sciter-sdk/go-sciter

./sciter.go:1118:8: error: field has incomplete type 'VOID' (aka 'void') ./sciter.go:1459:8: error: field has incomplete type 'VOID' (aka 'void')

pravic commented 7 years ago

As for uchar - can you tell me OSX and Xcode version?

simcosoft commented 7 years ago

OSX 10.11.6 Xcode 8.2.1

admin$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
go run callback.go 
# github.com/sciter-sdk/go-sciter
In file included from ../../../sciter-sdk/go-sciter/sciter.go:11:
In file included from include/sciter-x.h:20:
include/sciter-x-types.h:30:12: fatal error: 'uchar.h' file not found
  #include <uchar.h>
           ^
1 error generated.
nntaoli commented 7 years ago

@pravic 16.4.0

Darwin Kernel Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64 x86_64

xcode Version 8.2.1 (8C1002)

pravic commented 7 years ago

I have no OSX right now. Can you search uchar.h in your system or investigate, what's wrong with it? In worst case, you can comment it and replace _char16t with unsigned short.

jjjachyty commented 7 years ago

the same with me,who resolve it?

iazkaban commented 7 years ago

the same with me,who resolve it?

pravic commented 7 years ago

Can you search uchar.h in your system or investigate, what's wrong with it?

iazkaban commented 7 years ago

I Using homebrew,and i found it :

MyMac 😂 ➜ /usr find .|grep uchar ./local/Cellar/gcc/6.1.0/include/c++/6.1.0/cuchar ./local/Cellar/gcc/6.1.0_1/include/c++/6.1.0/cuchar ./local/Cellar/gcc/6.2.0/include/c++/6.2.0/cuchar ./local/Cellar/icu4c/57.1/include/unicode/uchar.h ./local/Cellar/icu4c/57.1/include/unicode/ucharstrie.h ./local/Cellar/icu4c/57.1/include/unicode/ucharstriebuilder.h ./local/Cellar/icu4c/58.1/include/unicode/uchar.h ./local/Cellar/icu4c/58.1/include/unicode/ucharstrie.h ./local/Cellar/icu4c/58.1/include/unicode/ucharstriebuilder.h ./local/Cellar/icu4c/58.2/include/unicode/uchar.h ./local/Cellar/icu4c/58.2/include/unicode/ucharstrie.h ./local/Cellar/icu4c/58.2/include/unicode/ucharstriebuilder.h ./local/Cellar/sphinx-doc/1.3.1/libexec/vendor/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Bucharest ./local/Cellar/sphinx-doc/1.3.4/libexec/vendor/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Bucharest ./local/Cellar/sphinx-doc/1.3.6/libexec/vendor/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Bucharest ./local/Cellar/sphinx-doc/1.4/libexec/vendor/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Bucharest ./local/Cellar/sphinx-doc/1.4.1/libexec/vendor/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Bucharest ./local/Cellar/sphinx-doc/1.4.5/libexec/vendor/lib/python2.7/site-packages/pytz/zoneinfo/Europe/Bucharest ./local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/gucharmap.rb ./local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/uchardet.rb ./local/Library/Taps/homebrew/homebrew-core/Formula/gucharmap.rb ./local/Library/Taps/homebrew/homebrew-core/Formula/uchardet.rb find: ./local/mysql-5.6.24-osx10.8-x86_64/data/geekblog: Permission denied find: ./local/mysql-5.6.24-osx10.8-x86_64/data/mysql: Permission denied find: ./local/mysql-5.6.24-osx10.8-x86_64/data/mytest: Permission denied find: ./local/mysql-5.6.24-osx10.8-x86_64/data/pay_ifensi_com: Permission denied find: ./local/mysql-5.6.24-osx10.8-x86_64/data/performance_schema: Permission denied find: ./local/mysql-5.6.24-osx10.8-x86_64/data/simmaker: Permission denied ./local/share/doc/rust/html/libc/types/os/arch/c95/type.c_uchar.html ./local/share/doc/rust/html/std/os/raw/type.c_uchar.html find: ./sbin/authserver: Permission denied ./share/zoneinfo/Europe/Bucharest

在 2017年4月25日,下午11:43,pravic notifications@github.com 写道:

Can you search uchar.h in your system or investigate, what's wrong with it?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sciter-sdk/go-sciter/issues/64#issuecomment-297072860, or mute the thread https://github.com/notifications/unsubscribe-auth/AA7UQUr0GE6GRlrHux1h1cFslASJeUbMks5rzhSTgaJpZM4MaJ68.

pravic commented 7 years ago

Well, Linux has uchar.h (#63), but OSX — does not.

May be it is easier to replace char16_t with unsigned short in include/sciter-x-types.h.

iazkaban commented 7 years ago

Now,I replaced:

char16_t with unsigned short size_t with unsigned int

then i got:

MyMac 😂 ➜ download git:(master) ✗ go build # github.com/sciter-sdk/go-sciter cgo-gcc-prolog:1091:8: error: field has incomplete type 'VOID' (aka 'void') cgo-gcc-prolog:1430:8: error: field has incomplete type 'VOID' (aka 'void')

pravic commented 7 years ago

Any more details of this error? Surrounding lines may be? I could not figure out which field has type VOID.

iazkaban commented 7 years ago

All I showed is the whole message

but i think it's sciter-x-types.h 's line 148

hey,it's too late for me,i will goto sleep,i will reply you tomrrow if you need~

pravic commented 7 years ago

No, it is about some struct with VOID field.

iazkaban commented 7 years ago

waiting for a version can run on osx~

xpsuper commented 7 years ago

the same with me,who resolve it?

raundn commented 7 years ago

I've struggled with this issue for a day or so and have managed to compile and (successfully) run a couple of sciter programs (the ones from the examples/ directory) on my Mac.

Here's what I've done:

  1. I've replaced
    #include <uchar.h>

    with

    
    #include <stddef.h>
    #include <stdint.h>

typedef uint16_t char16_t; typedef uint32_t char32_t;

The first include is for `size_t`, the second one is for `uint16_t` and `uint32_t`. I'm not sure this is the _best_ way to fix this (I suspect it isn't), but it _is_ a fast one.

2. I've then compiled and installed the sciter lib (not the apps, mind you!) with a newer gcc:

CC=/opt/local/bin/gcc-mp-4.9 CXX=/opt/local/bin/g++-mp-4.9 go install

As the `-mp-4.9` suffixes indicate, my GCC was installed from MacPorts, but I think any sufficiently recent version will do.

If you get the "field has incomplete type 'VOID' (aka 'void')" error doing this, you're using a wrong compiler.

Also, note that I've said 'go install', not 'go build' here.

3. Lastly, I've compiled a sample app using Apple's (stock) version of clang:

$ which clang /usr/bin/clang $ which clang++ /usr/bin/clang++ $ clang --version Apple LLVM version 8.1.0 (clang-802.0.42) Target: x86_64-apple-darwin16.6.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

If, doing this, you get an error like this one:

/System/Library/Frameworks/CoreData.framework/Headers/NSPersistentContainer.h:37:18: error: unknown property attribute before ',' token @property (strong, readonly) NSPersistentStoreCoordinator *persistentStoreCoordinator;


(note the `@property`), you're using a wrong compiler.

To summarize, the sciter lib has to be compiled with (a recent version of) GCC, while for compiling apps one has to use stock clang. This is why it's crucial to say 'go install' at step 2. Otherwise attempting to compile an app would attempt to (re)compile the library, which would fail under clang.
pravic commented 7 years ago

@raundn Big thanks!

I updated that header, it is compiled fine under Linux and Windows. Checked with Go 1.8 (gcc 6.3.0 and mingw 5.3.0).