Closed kiler129 closed 1 year ago
I attempted to generate code from ancient libnetsnmp and after resolving all missing header errors I finally got to:
libnetsnmp
PHP Notice: Undefined variable: mainOffset in /app/vendor/ircmaxell/php-elf-symbolresolver/lib/Parser.php on line 79 Notice: Undefined variable: mainOffset in /app/vendor/ircmaxell/php-elf-symbolresolver/lib/Parser.php on line 79 PHP Fatal error: Uncaught PHPCParser\Error: Syntax error, unexpected EOF( in /app/vendor/ircmaxell/php-c-parser/lib/ParserAbstract.php:235 Stack trace: #0 /app/vendor/ircmaxell/php-c-parser/lib/ParserAbstract.php(104): PHPCParser\ParserAbstract->doParse() #1 /app/vendor/ircmaxell/php-c-parser/lib/CParser.php(23): PHPCParser\ParserAbstract->parse(Array, Object(PHPCParser\Context)) #2 /app/vendor/ircmaxell/ffime/lib/FFIMe.php(101): PHPCParser\CParser->parse('/Users/greg/Dow...', Object(PHPCParser\Context)) #3 /app/test2.php(15): FFIMe\FFIMe->include('/Users/greg/Dow...') #4 {main} thrown in /app/vendor/ircmaxell/php-c-parser/lib/ParserAbstract.php on line 235 Fatal error: Uncaught PHPCParser\Error: Syntax error, unexpected EOF( in /app/vendor/ircmaxell/php-c-parser/lib/ParserAbstract.php:235 Stack trace: #0 /app/vendor/ircmaxell/php-c-parser/lib/ParserAbstract.php(104): PHPCParser\ParserAbstract->doParse() #1 /app/vendor/ircmaxell/php-c-parser/lib/CParser.php(23): PHPCParser\ParserAbstract->parse(Array, Object(PHPCParser\Context)) #2 /app/vendor/ircmaxell/ffime/lib/FFIMe.php(101): PHPCParser\CParser->parse('/Users/greg/Dow...', Object(PHPCParser\Context)) #3 /app/test2.php(15): FFIMe\FFIMe->include('/Users/greg/Dow...') #4 {main} thrown in /app/vendor/ircmaxell/php-c-parser/lib/ParserAbstract.php on line 235
The code I attempted to use:
(new FFIMe('/app/libnetsnmp/usr/lib/x86_64-linux-gnu/libnetsnmp.so.30')) ->include('/app/libc-dev/usr/include/x86_64-linux-gnu/gnu/stubs.h') ->include('/app/libc-dev/usr/include/x86_64-linux-gnu/sys/cdefs.h') ->include('/app/libc-dev/usr/include/stdio.h') ->include('/app/libnetsnmp-dev/usr/include/net-snmp/library/mib.h') ->include('/app/libnetsnmp-dev/usr/include/net-snmp/library/parse.h') ->codeGen('Test\NetSnmp', __DIR__ . '/test/NetSnmp.php') ;
Since I'm running on macOS I had to download all needed header files and unpack them. While that might pose a problem it actually makes sure I'm not mixing different versions. I used the bog-standard packages from Debian.
For your convince I included unpacked files with this issue. They're originating from amd64 debs from Jessie: https://github.com/ircmaxell/FFIMe/files/4600524/libs.zip
There has been a lot changed in the last months, including much more capabilities for parsing.
Can you please retry? :-)
Closing this stale issue, please reopen if issues still exist.
I attempted to generate code from ancient
libnetsnmp
and after resolving all missing header errors I finally got to:The code I attempted to use:
Since I'm running on macOS I had to download all needed header files and unpack them. While that might pose a problem it actually makes sure I'm not mixing different versions. I used the bog-standard packages from Debian.
For your convince I included unpacked files with this issue. They're originating from amd64 debs from Jessie: https://github.com/ircmaxell/FFIMe/files/4600524/libs.zip