C/C++ Configure does not find certain math functions

byrnejb

Well-Known Member

Reaction score: 27
Messages: 426

I am building a 4GL compiler/vm and the configuration script is reporting this:

Code:
checking for floor... no
checking for pow... no
checking for trunc... no

I am passing this to configure:

Code:
./configure --prefix=$HOME/usr/local \
>             --exec-prefix=$HOME/usr/local \
>             --with-build-cc=/usr/local/bin/gcc \
>             --with-build-cflags=-lm \
>             --with-build-libs="/lib /usr/lib /usr/local/lib" \
>             --with-iodbc=/usr/local/lib \
>             --with-java=/usr/local/openjdk11 \
>             --with-pgsqleng=/var/db/postgres/data11

I am passing -lm to gcc and libm.so exists:

Code:
ls -l /usr/lib/libm.so
lrwxr-xr-x  1 root  wheel  19 Nov  1  2019 /usr/lib/libm.so -> ../../lib/libm.so.5


So, what am I missing here?
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 11,988
Messages: 38,443

Maybe it's looking for some other math library? Are you sure it's depending on libm.so? Normally you don't need to supply /usr/lib and/or /usr/include because these are searched by default. It's typically /usr/local/lib and /usr/local/include it has problems with.

So, what am I missing here?
Often you can find additional configure options if you run ./configure --help. Perhaps it needs to be set with a specific option.
 
OP
B

byrnejb

Well-Known Member

Reaction score: 27
Messages: 426

Code:
  --with-java=path        full path of Java Developers Kit, or no
  --with-build-cc=XXX     the build C compiler ($BUILD_CC)
  --with-build-cflags=XXX the build C compiler-flags
  --with-build-cppflags=XXX the build C preprocessor-flags
  --with-build-ldflags=XXX the build linker-flags
  --with-build-libs=XXX   the build libraries
. . .
Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  LIBS        libraries to pass to the linker, e.g. -l<library>
  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
              you have headers in a nonstandard directory <include dir>
  CPP         C preprocessor

None of the environment variables are set. The other options do not address library locations. The configure insists on gcc and I presume that the -lm switch tells gcc to load /usr/lib/libm.so. I cannot tell why the configure run fails to find the functions.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 11,988
Messages: 38,443

I presume that the -lm switch tells gcc to load /usr/lib/libm.so.
No, it tells the linker to link with libm. GCC doesn't "load" anything (besides the source code itself of course).

Code is compiled using headers, these typically live in /usr/include (and /usr/local/include for ports), their corresponding libraries are found in /usr/lib (and /usr/local/lib). The -l just tells the linker it should the link the resulting executable with a specific library.

But as I said, /usr/lib and /usr/include are searched by default. You don't have to supply those. Most of the time configure scans for a whole bunch of things, it's not always a problem if it can't find certain things. Just because you see a "no" doesn't necessarily mean there's a problem.
 
OP
B

byrnejb

Well-Known Member

Reaction score: 27
Messages: 426

I have managed to get this to compile, but it does not yet produce an error-free program. I am working with the developer to resolve building this on FreeBSD.

The question I have now is: are there limitations on running ptrace or other debugging tools inside jails?
 
Top