ULAFF / LAFF-On-PfHP

Repository for "LAFF-On Programming for High Performance"
BSD 3-Clause "New" or "Revised" License
39 stars 30 forks source link

Compiling error for the Week0 Hello World Example #1

Open adricortes opened 5 years ago

adricortes commented 5 years ago

There is an incompatibility between using "struct timespec" in the GNU compiler with the -std=c99 option (Linux OS). The compiler complains that

FLA_Clock.c: In function ‘FLA_Clock_helper’: FLA_Clock.c:41:21: error: storage size of ‘ts’ isn’t known struct timespec ts;

A quick fix that worked is using -std=gnu99 instead.

rvdg commented 5 years ago

Andriano,

Thank you. I will put a note in the notes.

Robert

On Apr 13, 2019, at 4:17 AM, Adriano Cortes notifications@github.com wrote:

There is an incompatibility between using "struct timespec" in the GNU compiler with the -std=c99 option (Linux OS). The compiler complains that

FLA_Clock.c: In function ‘FLA_Clock_helper’: FLA_Clock.c:41:21: error: storage size of ‘ts’ isn’t known struct timespec ts;

A quick fix that worked is using -std=gnu99 instead.

rvdg commented 5 years ago

Adriano,

Can you do me a favor. Can you see what happens if the -std=c99 option is simply removed? (I don’t think specifying it for our course material is particularly important.)

Thanks Robert

On Apr 13, 2019, at 4:17 AM, Adriano Cortes notifications@github.com wrote:

There is an incompatibility between using "struct timespec" in the GNU compiler with the -std=c99 option (Linux OS). The compiler complains that

FLA_Clock.c: In function ‘FLA_Clock_helper’: FLA_Clock.c:41:21: error: storage size of ‘ts’ isn’t known struct timespec ts;

A quick fix that worked is using -std=gnu99 instead.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ULAFF/LAFF-On-PfHP/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/AFa8J4p5ZswTITm3_EvTrxEup2m8slvyks5vgT43gaJpZM4ctypb.

adricortes commented 5 years ago

Robert,

It compiled fine removing -std=c99. My GCC is the newest version (8.3), and according to the man page by default it uses the -std=gnu17 ("GNU dialect of ISO C17. This is the default for C code"). I found an explanation of the compiling error here https://gcc-help.gcc.gnu.narkive.com/8xCaKI6r/problem-with-struct-timespec-and-c99-standard Following it I put #define _POSIX_C_SOURCE 199309L in the beginning of FLA_Clock.c and it worked fine with the -std=c99 options.

Best. Adriano.

rvdg commented 5 years ago

Thank you very much. I am copying Field, who can insert this into libflame as well, if appropriate.

We appreciate the feedback.

On Apr 13, 2019, at 11:26 PM, Adriano Cortes notifications@github.com wrote:

Robert,

It compiled fine removing -std=c99. My GCC is the newest version (8.3), and according to the man page by default it uses the -std=gnu17 ("GNU dialect of ISO C17. This is the default for C code"). I found an explanation of the compiling error here https://gcc-help.gcc.gnu.narkive.com/8xCaKI6r/problem-with-struct-timespec-and-c99-standard https://gcc-help.gcc.gnu.narkive.com/8xCaKI6r/problem-with-struct-timespec-and-c99-standard Following it I put #define _POSIX_C_SOURCE 199309L in the beginning of FLA_Clock.c and it worked fine with the -std=c99 options.

Best. Adriano.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ULAFF/LAFF-On-PfHP/issues/1#issuecomment-482890316, or mute the thread https://github.com/notifications/unsubscribe-auth/AFa8JwdqU3_Ysc_p1lZnhs9LaJDur9mMks5vgkuXgaJpZM4ctypb.