[Glass] CHeader and CPreprocessor paths as arguments
Smalltalk at JGFoster.net
Smalltalk at JGFoster.net
Thu Jun 25 13:48:34 PDT 2020
Yes, a failure to parse a valid header file would be a defect in the Smalltalk code that parses C header files. The best way to confirm that is to create a single file (with no include directives) that demonstrates the problem.
> On Jun 25, 2020, at 1:25 PM, bruno buzzi brassesco via Glass <glass at lists.gemtalksystems.com> wrote:
>
> Is a bug in the C parser ?
>
> On 25/6/2020 13:03, Smalltalk at JGFoster.net <mailto:Smalltalk at JGFoster.net> wrote:
>> My guess is that it is not so much that it is expecting only one argument as that it failed to parse the second argument (struct structName **parameteName).
>>
>>> On Jun 25, 2020, at 6:56 AM, bruno buzzi brassesco via Glass <glass at lists.gemtalksystems.com <mailto:glass at lists.gemtalksystems.com>> wrote:
>>>
>>> Hi,
>>>
>>> These are the C declarations:
>>> LIBSSH_API enum ssh_known_hosts_e ssh_session_has_known_hosts_entry(ssh_session session);
>>> LIBSSH_API enum ssh_known_hosts_e ssh_session_get_known_hosts_entry(ssh_session session,
>>> struct ssh_knownhosts_entry **pentry);
>>> LIBSSH_API enum ssh_known_hosts_e ssh_session_is_known_server(ssh_session session);
>>>
>>> The second is failing so it seems that is expecting only one argument as the others two declarations.
>>> Not sure why...
>>>
>>> regards,
>>> bruno
>>>
>>> On 25/6/2020 10:31, bruno buzzi brassesco via Glass wrote:
>>>> Hi,
>>>>
>>>> On GS 3.5 with a default installation (apt-get install libssh-dev) the wrapper is generated correctly.
>>>>
>>>> But on a manually compiled installation I got the error below.
>>>> Which situation could lead to this problem?
>>>>
>>>> The problem is with the following declaration:
>>>> LIBSSH_API enum ssh_known_hosts_e ssh_session_get_known_hosts_entry(ssh_session session,
>>>> struct ssh_knownhosts_entry **pentry);
>>>>
>>>> The token is a coma , but is expecting a right parenthesis ). For some reason it is expecting the end of the declaration but as you can see above the declaration has 2 arguments. So somehow it is expecting another declaration .... still researching this...
>>>>
>>>> a Error occurred (error 2710), expected ')' near line 592 in file /gemstone/3rd-party-bin/
>>>> libssh-0.9.4/include/libssh.h
>>>> Error (AbstractException) >> _signalWith: @6 line 25
>>>> Error (AbstractException) >> signal: @3 line 7
>>>> Error class (AbstractException class) >> signal: @3 line 4
>>>> CDeclaration >> error: @8 line 3
>>>> CDeclaration >> readDirectDeclarator @43 line 24
>>>> CDeclaration >> readDeclarator @12 line 14
>>>> CDeclaration >> readDeclaration @5 line 12
>>>> CHeader >> readOneUnderStorageHandler: @7 line 9
>>>> CHeader >> readExternLinkageDeclarationsUnderStorageRegimeFrom: @19 line 19
>>>> [] in ExecBlock1 (CHeader) >> readOne @12 line 7
>>>> CHeader >> readOneUnderStorageHandler: @9 line 11
>>>> CHeader >> readOne @3 line 3
>>>> CHeader >> initialize: @25 line 18
>>>> CHeader class >> preprocessor: @3 line 4
>>>> CHeader class >> path: @3 line 3
>>>> Executed Code @3 line 2
>>>> GsNMethod class >> _gsReturnToC @1 line 1
>>>> On 24/6/2020 14:01, James Foster via Glass wrote:
>>>>> Another idea is to generate the wrapper in 3.5.x and then back-port it to 3.3.x.
>>>>>
>>>>>> On Jun 24, 2020, at 9:58 AM, Dale Henrichs via Glass <glass at lists.gemtalksystems.com <mailto:glass at lists.gemtalksystems.com>> wrote:
>>>>>>
>>>>>> Bruno,
>>>>>>
>>>>>> Here's our advice:
>>>>>>
>>>>>> I would think that editing CPreprocessor>>defaultSearchPaths would be a good workaround
>>>>>>
>>>>>> Keep in mind that 3.5 is using the native preprocessor /usr/bin/cpp
>>>>>> for all of the macro expansion and then reading the output of cpp
>>>>>> with our CPreprocessor code. 3.3 is trying to do all of the macro
>>>>>> expansion in CPreprocessor and that has quite a few bugs that may
>>>>>> be triggered by system header files in newer versions of Linux than what 3.3
>>>>>> was originally tested with.
>>>>>> If you encounter such bugs with 3.3, you might need to run
>>>>>> /usr/bin/cpp on the header files of interest and then feed the resulting
>>>>>> output to CPreprocessor .
>>>>>> Dale
>>>>>>
>>>>>> On 6/24/20 5:09 AM, bruno buzzi brassesco via Glass wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> In GS 3.5 it is possible to pass paths as arguments:
>>>>>>> CHeader>>path:searchPaths:
>>>>>>>
>>>>>>> In GS 3.3.x that method is not present but it will have the same effect if we add our paths to:
>>>>>>> CPreprocessor>>defaultSearchPaths
>>>>>>> Can this be a workaround for the error below ?
>>>>>>>
>>>>>>> Trying to generate a wrapper with:
>>>>>>> UserGlobals at: #'LibSsh094' put: (CHeader path: '/customized/path/libssh.h').
>>>>>>>
>>>>>>> Answer the error:
>>>>>>> Unhandled exception: GS Server Error - GbsGemStoneError - a UserDefinedError occurred (error 2740), Include file sys/cdefs.h not found!
>>>>>>> [1] GS: UserDefinedError (AbstractException) >> _signalWith: @6 line 25
>>>>>>> [2] GS: UserDefinedError (AbstractException) >> signal: @3 line 7
>>>>>>> [3] GS: UserDefinedError class (AbstractException class) >> signal: @3 line 4
>>>>>>> [4] GS: CPreprocessor >> include:afterMe: @55 line 39
>>>>>>> [5] GS: CPreprocessor >> applyDirectiveToken: @27 line 10
>>>>>>> [6] GS: CPreprocessor >> applyToken: @4 line 3
>>>>>>> [7] GS: CPreprocessor >> doIf: @11 line 12
>>>>>>> [8] GS: CPreprocessor >> ifdef:defined: @22 line 8
>>>>>>> [9] GS: CPreprocessor >> applyDirectiveToken: @19 line 8
>>>>>>> [10] GS: CPreprocessor >> applyToken: @4 line 3
>>>>>>> [11] GS: CPreprocessor >> doIf: @11 line 12
>>>>>>> [12] GS: CPreprocessor >> ifdef:defined: @22 line 8
>>>>>>> [13] GS: CPreprocessor >> applyDirectiveToken: @19 line 8
>>>>>>> [14] GS: CPreprocessor >> applyToken: @4 line 3
>>>>>>> [15] GS: CPreprocessor >> doIf: @11 line 12
>>>>>>> [16] GS: CPreprocessor >> ifdef:defined: @22 line 8
>>>>>>> [17] GS: CPreprocessor >> applyDirectiveToken: @19 line 8
>>>>>>> [18] GS: CPreprocessor >> applyToken: @4 line 3
>>>>>>> [19] GS: CPreprocessor >> readTillEnd @6 line 7
>>>>>>> [20] GS: [] in ExecBlock0 (CPreprocessor) >> includePath: @20 line 12
>>>>>>> [21] GS: ExecBlock0 (ExecBlock) >> ensure: @2 line 12
>>>>>>> [22] GS: CPreprocessor >> includePath: @16 line 13
>>>>>>> [23] GS: [] in ExecBlock1 (CPreprocessor) >> include:afterMe: @68 line 34
>>>>>>> [24] GS: OrderedCollection (Collection) >> do: @6 line 10
>>>>>>> [25] GS: CPreprocessor >> include:afterMe: @41 line 26
>>>>>>> [26] GS: CPreprocessor >> applyDirectiveToken: @27 line 10
>>>>>>> [27] GS: CPreprocessor >> applyToken: @4 line 3
>>>>>>> [28] GS: CPreprocessor >> doIf: @11 line 12
>>>>>>> [29] GS: CPreprocessor >> ifdef:defined: @22 line 8
>>>>>>> [30] GS: CPreprocessor >> applyDirectiveToken: @19 line 8
>>>>>>> [31] GS: CPreprocessor >> applyToken: @4 line 3
>>>>>>> [32] GS: CPreprocessor >> readTillEnd @6 line 7
>>>>>>> [33] GS: [] in ExecBlock0 (CPreprocessor) >> includePath: @20 line 12
>>>>>>> [34] GS: ExecBlock0 (ExecBlock) >> ensure: @2 line 12
>>>>>>> [35] GS: CPreprocessor >> includePath: @16 line 13
>>>>>>> [36] GS: [] in ExecBlock1 (CPreprocessor) >> include:afterMe: @68 line 34
>>>>>>> [37] GS: OrderedCollection (Collection) >> do: @6 line 10
>>>>>>> [38] GS: CPreprocessor >> include:afterMe: @41 line 26
>>>>>>> [39] GS: CPreprocessor >> applyDirectiveToken: @27 line 10
>>>>>>> [40] GS: CPreprocessor >> applyToken: @4 line 3
>>>>>>> [41] GS: CPreprocessor >> doIf: @11 line 12
>>>>>>> [42] GS: CPreprocessor >> ifdef:defined: @22 line 8
>>>>>>> [43] GS: CPreprocessor >> applyDirectiveToken: @15 line 7
>>>>>>> [44] GS: CPreprocessor >> applyToken: @4 line 3
>>>>>>> [45] GS: CPreprocessor >> doIf: @11 line 12
>>>>>>> [46] GS: CPreprocessor >> ifdef:defined: @22 line 8
>>>>>>> [47] GS: CPreprocessor >> applyDirectiveToken: @19 line 8
>>>>>>> [48] GS: CPreprocessor >> applyToken: @4 line 3
>>>>>>> [49] GS: CPreprocessor >> readTillEnd @6 line 7
>>>>>>> [50] GS: [] in ExecBlock0 (CPreprocessor) >> includePath: @20 line 12
>>>>>>> [51] GS: ExecBlock0 (ExecBlock) >> ensure: @2 line 12
>>>>>>> [52] GS: CPreprocessor >> includePath: @16 line 13
>>>>>>> [53] GS: CPreprocessor class >> parseFileAt: @3 line 4
>>>>>>> [54] GS: CHeader class >> path: @2 line 3
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Glass mailing list
>>>>>>> Glass at lists.gemtalksystems.com <mailto:Glass at lists.gemtalksystems.com>
>>>>>>> https://lists.gemtalksystems.com/mailman/listinfo/glass <https://lists.gemtalksystems.com/mailman/listinfo/glass>
>>>>>> _______________________________________________
>>>>>> Glass mailing list
>>>>>> Glass at lists.gemtalksystems.com <mailto:Glass at lists.gemtalksystems.com>
>>>>>> https://lists.gemtalksystems.com/mailman/listinfo/glass <https://lists.gemtalksystems.com/mailman/listinfo/glass>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Glass mailing list
>>>>> Glass at lists.gemtalksystems.com <mailto:Glass at lists.gemtalksystems.com>
>>>>> https://lists.gemtalksystems.com/mailman/listinfo/glass <https://lists.gemtalksystems.com/mailman/listinfo/glass>
>>>>
>>>>
>>>> _______________________________________________
>>>> Glass mailing list
>>>> Glass at lists.gemtalksystems.com <mailto:Glass at lists.gemtalksystems.com>
>>>> https://lists.gemtalksystems.com/mailman/listinfo/glass <https://lists.gemtalksystems.com/mailman/listinfo/glass>
>>> _______________________________________________
>>> Glass mailing list
>>> Glass at lists.gemtalksystems.com <mailto:Glass at lists.gemtalksystems.com>
>>> https://lists.gemtalksystems.com/mailman/listinfo/glass <https://lists.gemtalksystems.com/mailman/listinfo/glass>
>>
> _______________________________________________
> Glass mailing list
> Glass at lists.gemtalksystems.com
> https://lists.gemtalksystems.com/mailman/listinfo/glass
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gemtalksystems.com/mailman/private/glass/attachments/20200625/fcfd5e1b/attachment-0001.htm>
More information about the Glass
mailing list