configure: error: C preprocessor "/lib/cpp" fails sanity check

Hello,
i am using pfsense freebsd 12 system
i install gcc and i download the source code of snort and i tried to ./configure .
i run:
./configure --host x64
always i get this error:
C preprocessor "/lib/cpp" fails sanity check
i tried to do same thing with dac and i have same problem too.
Thanks.
 
No comment on pfsense

1. But in FreeBSD, you can install (compile) snort from the Ports Collection.
security/snort

2. FreeBSD uses BSD Toolchain Project.

3. Clang sub-projects from LLVM is the main compiler.
 
/lib/cpp would be a very "strange" location for the preprocessor, it's typically expected in /usr/bin/cpp. So my guess is that your /lib/cpp isn't a preprocessor at all (therefore of course failing a sanity check).

If this file is supposed to exist on pfsense, you should definitely ask in a pfsense forum or the like. It doesn't exist on FreeBSD.
 
/lib/cpp would be a very "strange" location for the preprocessor, it's typically expected in /usr/bin/cpp. So my guess is that your /lib/cpp isn't a preprocessor at all (therefore of course failing a sanity check).

If this file is supposed to exist on pfsense, you should definitely ask in a pfsense forum or the like. It doesn't exist on FreeBSD.
No. Not strange. It's a bug of GNU autotools, the configure script looked for the wrong preprocessor location on FreeBSD. The FreeBSD's cpp is not compatible with the GNU's cpp either, they together created this mess. I know it because I used to try compiling a GCC based compiler on FreeBSD without using ports and failed with exactly this error. Later I abandon this habit I had when still using Linux and let the ports take care of these. Life is much easier since then.
 
I don't know about pfSense, but ./configure --host x64 doesn't look right to me at all, regardless of platform, and you should be aware that typically ./configure by itself will work fine with no need to specify --host=TRIPLET since it should default to the triplet of the machine that is currently running. This is not always true, but specifying an incorrect host triplet and getting it to compile doesn't mean it will work correctly either.

If ./configure by itself doesn't work, you will want to use something like (guessing) ./configure --host=amd64-unknown-pfsense; the "Target" output by clang --version may help to point you to the correct host value.

You can also use environment variables to specify locations of some of the necessary programs if they're installed in strange places, such as in CPP=/path/to/my/cpp ./configure --host=FOO-BAR-BAZ. The command ./configure --help will display the full list.
 
I don't know about pfSense, but ./configure --host x64 doesn't look right to me at all, regardless of platform, and you should be aware that typically ./configure by itself will work fine with no need to specify --host=TRIPLET since it should default to the triplet of the machine that is currently running. This is not always true, but specifying an incorrect host triplet and getting it to compile doesn't mean it will work correctly either.

If ./configure by itself doesn't work, you will want to use something like (guessing) ./configure --host=amd64-unknown-pfsense; the "Target" output by clang --version may help to point you to the correct host value.

You can also use environment variables to specify locations of some of the necessary programs if they're installed in strange places, such as in CPP=/path/to/my/cpp ./configure --host=FOO-BAR-BAZ. The command ./configure --help will display the full list.
The problems is actually down to autotools and the configure script. FreeBSD's cpp is not compatible with GNU's cpp. But even when we specify the correct path to GNU's cpp via the CPP environment variable, the configure script still not pick it up and complains with the same error. At least with my case. I have no workaround for this so far.
 
After more investigation, the problem seems to be the fact that pfSense doesn't offer a typical compilation environment like FreeBSD does, so the search for a C preprocessor fails. Differences like this are why FreeBSD derivatives aren't supported here.

The problems is actually down to autotools and the configure script. FreeBSD's cpp is not compatible with GNU's cpp. But even when we specify the correct path to GNU's cpp via the CPP environment variable, the configure script still not pick it up and complains with the same error. At least with my case. I have no workaround for this so far.
I understand that FreeBSD's cpp (clang) is not 100% compatible with GNU's cpp, but specifying the path to GNU cpp should work. I've also used something like CPP='gcc9 -E' on some occasions. Another possibility is the configure script or supporting files are outdated. If you suspect that might be the case, and you have Autoconf and Perl installed, you can make a copy of the source directory and run autoreconf -i in that directory.
 
I understand that FreeBSD's cpp (clang) is not 100% compatible with GNU's cpp, but specifying the path to GNU cpp should work. I've also used something like CPP='gcc9 -E' on some occasions. Another possibility is the configure script or supporting files are outdated. If you suspect that might be the case, and you have Autoconf and Perl installed, you can make a copy of the source directory and run autoreconf -i in that directory.
Ah, I did set the CPP environment variable but to GNU's cpp I installed together with the gcc package, not to 'gcc9 -E' like you. This could be the reason why it doesn't work for me.
 
Back
Top