[Solaris 11 Express] math.h: No such file or directory

I was looking at running netperf to run some basic network performance benchmarks but I ran into the following problem trying to compile it:

# make
...removed output...
if gcc -DHAVE_CONFIG_H -I. -I. -I..     -g -O2 -MT netlib.o -MD -MP -MF ".deps/netlib.Tpo" \
          -c -o netlib.o `test -f 'netlib.c' || echo './'`netlib.c; \
        then mv -f ".deps/netlib.Tpo" ".deps/netlib.Po"; \
        else rm -f ".deps/netlib.Tpo"; exit 1; \
        fi
netlib.c:70:18: math.h: No such file or directory
...removed output...

Frankly, I thought math.h would just be there on the system, but after checking /usr/include it was not! ls /usr/include/math* returned nothing. However, I got the following clue I needed to install system/library/math/header-math by running:

# pkg list -a | grep -i math
system/library/math                           0.5.11-0.151.0.1 installed  -----
system/library/math/header-math               0.5.11-0.151.0.1 known      -----

The header-math is known but not installed, so after performing the install of header-math:

# pkg install header-math
               Packages to install:     1
           Create boot environment:    No
DOWNLOAD                                  PKGS       FILES    XFER (MB)
Completed                                  1/1       16/16      0.0/0.0

PHASE                                        ACTIONS
Install Phase                                  38/38

PHASE                                          ITEMS
Package State Update Phase                       1/1
Image State Update Phase                         2/2

PHASE                                          ITEMS
Reading Existing Index                           8/8
Indexing Packages                                1/1

math.h was present on the system:

# ls /usr/include/math*
/usr/include/math.h

and my make completed without errors!

# make
make  all-recursive
...removed output...
if gcc -DHAVE_CONFIG_H -I. -I. -I..     -g -O2 -MT netlib.o -MD -MP -MF ".deps/netlib.Tpo" \
          -c -o netlib.o `test -f 'netlib.c' || echo './'`netlib.c; \
        then mv -f ".deps/netlib.Tpo" ".deps/netlib.Po"; \
        else rm -f ".deps/netlib.Tpo"; exit 1; \
        fi
if gcc -DHAVE_CONFIG_H -I. -I. -I..     -g -O2 -MT netsh.o -MD -MP -MF ".deps/netsh.Tpo" \
          -c -o netsh.o `test -f 'netsh.c' || echo './'`netsh.c; \
        then mv -f ".deps/netsh.Tpo" ".deps/netsh.Po"; \
        else rm -f ".deps/netsh.Tpo"; exit 1; \
        fi
if gcc -DHAVE_CONFIG_H -I. -I. -I..     -g -O2 -MT nettest_bsd.o -MD -MP -MF ".deps/nettest_bsd.Tpo" \
          -c -o nettest_bsd.o `test -f 'nettest_bsd.c' || echo './'`nettest_bsd.c; \
        then mv -f ".deps/nettest_bsd.Tpo" ".deps/nettest_bsd.Po"; \
        else rm -f ".deps/nettest_bsd.Tpo"; exit 1; \
...output removed...
gcc  -g -O2   -o netserver  netserver.o netlib.o netsh.o nettest_bsd.o nettest_dlpi.o nettest_unix.o nettest_xti.o nettest_sctp.o nettest_sdp.o nettest_omn
i.o net_uuid.o netcpu_kstat10.o netrt_rtmget.o netdrv_solaris.o netslot_solaris.o netsys_solaris.o netsec_none.o  -lsmbios -ldevinfo -lkstat -lsendfile -ln
sl -lsocket -lm
make[3]: Leaving directory `/tmp/netperf-2.4.5/src'
make[2]: Leaving directory `/tmp/netperf-2.4.5/src'
Making all in doc
make[2]: Entering directory `/tmp/netperf-2.4.5/doc'
Making all in examples
...output removed...
# make install
...output removed...
This entry was posted in *Nix. Bookmark the permalink.

20 Responses to [Solaris 11 Express] math.h: No such file or directory

  1. HueponiK says:

    Thank you for pointing me to header-math package.
    It helped me to compile libevent-2.0.11 on Openindiana b148

  2. Pingback: [Solaris 11 Express] math.h: No such file or directory « Tulsa Labs

  3. Pingback: solaris下编译php | 阿玖博客

  4. wvb says:

    this is a welcome post 🙂
    I’m just learning Solaris and wanted to compile apcusbd but bumped into this error..
    you really helped me out, thanks a lot!

  5. Juergen says:

    Thank you! Helped me compile irssi-silc on openindiana b151.

  6. Thanks for this! I got stuck here, trying to compile transmission in openindiana.

  7. Andrew Burns says:

    Another big THANK YOU!!!
    As another Solaris noob attempting to get a rvm/ruby stack up and running this was very confusing at first.

    THANK YOU THANK YOU!

  8. Vikas says:

    I am getting similar error for random.h …can anyone help me out. pls

  9. chisophugis says:

    saved my ass building libevent. thanks a bunch

  10. anyheck says:

    This tip let me get Netatalk 3 built on OpenIndiana 151a5. Thank you! http://hardforum.com/showthread.php?t=1707996

  11. noob says:

    Thanks a tonne for posting this solution on the forum! Does great service to us newbies..

  12. C says:

    Excellent – thank you!!

  13. Awesome source of info mate. Like the post.

Leave a comment