0

I followed the instructions to download and install SAC, however, upon executing the "make fast" command I receive the following error:

maxx@ubuntu:~/sac2c-1.00-beta-linux-x86_64/stdlib$ make fast  
make -f buildfile MODE=lean
cd modules/structures/lib/..; sac2c -v0 -g -O3 -linksetsize 0   ScalarArith.sac -o lib

****ABORT: line 0  file: /usr/include/stdc-predef.h
ABORT: syntax error at pos 36: '3`
ABORT: # 1 "/usr/include/stdc-predef.h" 1 3 4
ABORT:**                                    ^**

*** Compilation failed ***
*** Exit code 1 (Loading SAC program)
*** 1 Error(s), 0 Warning(s)

make[1]: *** [modules/structures/lib/libScalarArithTree.so] Error 1
make: *** [fast] Error 2
maxx@ubuntu:~/sac2c-1.00-beta-linux-x86_64/stdlib$ 

​ I am not sure how to proceed here, I am thinking it may be a problem specific to my environment, but it seems highly specific.

I did some looking around and found this article on gcc which had the following to say:

Pre-processor pre-includes

The GCC pre-processor may now pre-includes a file that defines certain macros for the entirety of the translation unit. This allows fully conformant implementations of C99/C11 and other standards that require compiler or compiler + runtime macros that describe implementation availability.

On linux, is pre-included.

This subtle change means that some more creative uses of the pre-processor may now fail, with the following diagnostic:

/usr/include/stdc-predef.h:0: error: Syntax error near '3' 
As a workaround, the stdc-predef.h preinclude can be disabled with the use of -ffreestanding. For non C/C++ code, use the pre-processor flag -P.

Then I tried recompiling with

make "CPP=gcc -E -ffreestanding" fast

And still no luck. Any ideas? Below is my architecture information

Linux ubuntu 3.13.0-35-generic x86_64 x86_64 x86_64 GNU/Linux
0

It appears to be possible to override the preprocessor definition used by the sac2c binary itself by creating a $HOME/.sac2crc file with appropriate definitions for CPP_STDIN and/or CPP_FILE. I was able to do that by modifying the $SAC2CBASE/setup/sac2crc file i.e. to inhibit line-marker generation by adding the -P flag

sed 's/gcc -E/& -P/' $SAC2CBASE/setup/sac2crc > ~/.sac2crc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.