This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: “error: too many #pragma options align=reset” on mac with gcc 4.8


On Tue, Oct 22, 2013 at 8:43 AM, ken han <j609444@gmail.com> wrote:
>
> I used macports to update gcc to version 4.8.1. I would like to use
> that version to build libusbx 1.0.17. But when I './configure' and
> then 'make' libusbx I get "error: too many #pragma options
> align=reset" (see error bellow), and it fails to build. If I configure
> libusbx with 'CC=clang ./configure' and then 'make' it works fine but
> that is building with gcc 4.2, and that is not what I want. Is there
> any way to build libusbx with gcc 4.8 on mac?
>
> Reading through gcc docs
> (http://gcc.gnu.org/onlinedocs/gcc/Pragmas.html) it seems that gcc
> understands both "#pragma pack(1)" and "#pragma options align=reset,"
> so I am not sure why I am getting this error. It seems to be related
> to this bug - http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50909, but I
> am not sure since this is an old bug and gcc 4.2 that comes with mac
> works. I am looking for a way to edit the header file, I do not want
> to patch and rebuild gcc. Thanks for any suggestions.
>
> In USB.h file the pragma's are in this form.
>
> #pragma pack(1)
> ... struct ....
> #pragma options align=reset

The current GCC implementation expects align=reset to follow some
other options align=XXX.  It sounds like USB.h expects options
align=reset to undo a pack(1).  I assume that the GCC implementation
ought to be extended for this; consider opening a bug report.

For GCC, to undo pack(1), you can just use pack().  So it sounds like
you could compile your library by changing the "#pragma options
align=reset" to "#pragma pack()".

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]