[CMake] SWIG syntax errors
Adam A Smith
aasmith at cs.wisc.edu
Mon Jun 8 04:15:23 EDT 2009
On Mon, 8 Jun 2009, Adam A Smith wrote:
> On Sun, 7 Jun 2009, Mathieu Malaterre wrote:
>
>> On Sat, Jun 6, 2009 at 2:19 AM, Adam A Smith<aasmith at cs.wisc.edu> wrote:
>>> I'm curious if someone has run into this before:
>>>
>>> I'm using CMake to make some SWIG .i files. I then use SWIG on those
>>> files,
>>> and it tells me that I have a syntax error. (I don't know SWIG syntax
>>> that
>>> well, but I'm learning.) I thought I'd ask all of you if this is
>>> something
>>> you were familiar with.
>>>
>>> Details:
>>>
>>> There are several .cpp files in the C++ library I'm trying to translate to
>>> Perl, Python, etc. (Doesn't matter what language I specify--the same
>>> error
>>> comes up.) For example, I might tell it:
>>>
>>> $ swig -c++ -perl5 TextTools.cpp.i
>>>
>>> and get this error:
>>>
>>> TextTools.cpp.i:49: Error: Syntax error in input(1).
>>>
>>> The .i file made from each .cpp file differs, of course. But the syntax
>>> error is always here:
>>>
>>> namespace std __attribute__ ((__visibility__ ("default"))) {
>>> # 245 "/usr/include/c++/4.3/i486-linux-gnu/bits/c++config.h" 3
>>> }
>>>
>>> SWIG lists the first line (namespace std ...) as being the one with the
>>> error. (So in my above example, that's line 49.)
>>>
>>> Does anybody have an idea?
>>
>> this is clearly a question for the swig mailing list, right ?
>>
>> anyway I would add the following in my swig interface file:
>>
>> #define __attribute__(x)
>>
>> 2cts
>> --
>> Mathieu
>> Ps: I am pretty sure this is not the root of the problem, you should
>> check the very begining of the errors reported...
>>
>
> Thanks for the reply. :)
>
> Yes, I asked the SWIG mailing list as well. But I was wondering if perhaps
> it was a bug in the CMake output, since the code in the .i file doesn't
> compile at all. My main question (on this mailing list) wasn't so much "Can
> somebody fix this?" as "Has anybody seen such a problem before?"
>
> Regardless, I sent the *complete* set of error messages. There's just this
> single syntax error.
>
> Thank you,
> Adam
Sorry--forgot to tell you the actual *results* of trying that. It kind of
worked. It eliminated that error, but then told me of a new syntax error
down the line. This is a little confusing to me--since the .i file is all
automatically generated.
Could you tell me what adding that #define line does? Does it just tell
it to expect a function/macro called __attribute__, and that the program
shouldn't choke on it?
Thanks again,
Adam
More information about the CMake
mailing list