Comments (12)
Hi, thanks for the report, the error you're getting looks like this:
$ c-for-go libproc.yaml
processing libproc.yaml ⠦[ERR] /usr/include/net/if.h:163:17: cannot determine size of struct if_data (and 5 more errors)
It's a result of CC was unable to understand header file, as some defines are not there. In this case it's required to run c-for-go with defines copied from GCC environment:
$ c-for-go -ccdefs libproc.yaml
I'm currently investigating what's the problem now with these defs
processing libproc.yaml ⠦[ERR] /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_fd_def.h:54:1: unexpected '{', expected one of [',', ';', '=']
from c-for-go.
-
Please update c-for-go by running
go get -u github.com/xlab/c-for-go
, I added a non-related fix -
If you wish to proceed, you can remove the function at
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_fd_def.h:54
it will generate with no problems after that. I'll study the problem with that function
UPD: resolved with 4af7464
from c-for-go.
IncludePaths: ["/usr/include",
This is also redundant
from c-for-go.
/* This inline avoids argument side-effect issues with FD_ISSET() */
/* static __inline int
__darwin_fd_isset(int _n, const struct fd_set *_p)
{
return (_p->fds_bits[(unsigned long)_n/__DARWIN_NFDBITS] & ((__int32_t)(((unsigned long)1)<<((unsigned long)_n % __DARWIN_NFDBITS))));
}*/
seems to not generate after changing that file to look like this ^ ?
Tejas-Macbook:_reference tejas$ c-for-go libproc.yaml
processing libproc.yaml ⠼[ERR] /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/net/if.h:163:17: cannot determine size of struct if_data (and 7 more errors)
from c-for-go.
if.h on my computer https://gist.github.com/tejasmanohar/9511878258b4ec21440316592ef7cfd2
from c-for-go.
I addressed this exact issue in previous comment:
it's required to run c-for-go with defines copied from GCC environment:
$ c-for-go -ccdefs libproc.yaml
note the -ccdefs
flag, please try with it
P.S. flag doc:
Options:
-ccdefs
Use built-in defines from a hosted C-compiler.
it steals defines from host GCC.
from c-for-go.
Oops, sorry. I only saw your 2nd, 3rd comment. Not your first.
I tried with that flag and got
processing libproc.yaml ⠴[ERR] /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/sys/_types/_fd_def.h:54:1: unexpected '{', expected one of [',', ';', '=']
(another fd_def.h) -> so I changed that fd_def.h the same way but I got
processing libproc.yaml ⠼[ERR] /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/sys/mount.h:400:29: unexpected identifier __attribute, expected one of ['(', ')', ',', ':', ';', '=', '[', '{', _Bool, _Complex, _Noreturn, _Static_assert, asm, auto, char, const, double, enum, extern, float, inline, int, long, register, restrict, short, signed, static, struct, typedef, typedefname, typeof, union, unsigned, void, volatile]
Maybe CC doesn't support __attribute function syntax?
from c-for-go.
I'm still using this config:
GENERATOR:
PackageName: libproc
PackageDescription: "Package vorbis provides Go bindings for OggVorbis implementation by the Xiph.Org Foundation"
PackageLicense: "THE AUTOGENERATED LICENSE. ALL THE RIGHTS ARE RESERVED BY ROBOTS."
Includes: ["libproc.h"]
Options:
SafeStrings: true
PARSER:
IncludePaths: ["/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/"]
SourcesPaths: ["/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdks/MacOSX.sdk/usr/include/libproc.h"]
Defines:
TRANSLATOR:
MemTips:
- {target: ^proc_$, self: raw}
Rules:
global:
- {transform: lower}
- {action: accept, from: "^proc_"}
- {action: replace, from: "^proc_", to: _}
- {transform: export}
const:
- {action: accept, from: "^PROC_"}
- {action: replace, from: "^PROC_", to: _}
type:
- {action: replace, from: "_t$"}
private:
- {transform: unexport}
post-global:
- {action: replace, from: _$}
- {load: snakecase}
And getting nothing about Frameworks/Kernel.framework
. Have you added some additional paths?
Btw, added support for __attribute
, please update go get -u github.com/xlab/c-for-go
from c-for-go.
@tejasmanohar I also just fixed issue with _fd_def.h
, you can uncomment that snippet back.
from c-for-go.
that worked thanks! i added "/System/Library/Frameworks/OpenCL.framework/Versions/A/lib/clang/2.0/include/" instead of something in /Applications for stdbool.h now
from c-for-go.
Oh no, you could just create fake stdbool.h like this:
#ifndef STDBOOL_H
#define STDBOOL_H
typedef int bool;
#define true 1
#define false 0
#endif // STDBOOL_H
in the project's folder. No need to add extra deps
from c-for-go.
ah nice idea
from c-for-go.
Related Issues (20)
- How to handle a function returning a struct as value
- Type translation does not respect systems data model HOT 1
- Verbose argument to print more logs
- Avoid lock / unlock for some function call
- Wiki need to be updated
- panic: unknown type _Float128 HOT 2
- Non int return function pointer not recognized
- Generator uses underlying type of typedef when used as a parameter
- Website down HOT 3
- It would be nice to at least have an example of the YML required in the readme since the website does not work HOT 1
- build HOT 5
- [OS X / Ubuntu ARM64] include file not found: <string> HOT 3
- Extracting SAL annotations from declarations HOT 2
- Example where C const get translated into Go typed const
- Callback generation HOT 2
- THIS IS NOT AN ISSUE!!!
- Avoid symbol lookup error
- Passing in an array to a C function and reading the data - incorrect autogenerated Go code
- Write rules against the location of the type/define rather than the name
- Fails to parse vulkan_beta.h
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from c-for-go.