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



## aminbaik88 (Mar 6, 2021)

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.


----------



## a6h (Mar 7, 2021)

No comment on pfsense








						GhostBSD, pfSense, TrueNAS, and all other FreeBSD Derivatives
					

Questions about 'derivative FreeBSDs', like  GhostBSD DesktopBSD TrueNAS XigmaNAS OPNsense pfSense PacBSD BSD Router Project NomadBSD helloSystem  should be asked on the forums and/or mailing lists for these specific products. See below for links.  If you still think your questions should be...




					forums.freebsd.org
				




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

2. FreeBSD uses BSD Toolchain Project.


			BSDToolchain - FreeBSD Wiki
		


3. Clang sub-projects from LLVM is the main compiler.


			BuildingFreeBSDWithClang - FreeBSD Wiki


----------



## zirias@ (Mar 7, 2021)

/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.


----------



## Deleted member 66267 (Mar 7, 2021)

Zirias said:


> /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.


----------



## memreflect (Mar 7, 2021)

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.


----------



## Deleted member 66267 (Mar 7, 2021)

memreflect said:


> 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.


----------



## memreflect (Mar 7, 2021)

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.



also-ran said:


> 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.


----------



## Deleted member 66267 (Mar 8, 2021)

memreflect said:


> 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.


----------

