1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

problem installing gmp

Discussion in 'Installation and Maintenance of Ports or Packages' started by jnb, Dec 12, 2010.

  1. jnb

    jnb New Member

    Messages:
    14
    Thanks Received:
    0
    hey guys I've just installed gmp 5 via ports but it doesn't work! when I compile a gmp program it complains it can't find gmp.h.

    i've even tried passing
    Code:
    -I/usr/local/include
    (where the header actually is) but i still get the error:

    Code:
    /usr/bin/ld: cannot find -lgmp


    Any thoughts on this one? I'm using FreeBSD 8.1-RELEASE-p1. Thanks!
     
  2. wblock@

    wblock@ Administrator Staff Member Administrator Moderator Developer

    Messages:
    11,503
    Thanks Received:
    2,212
    Your error message says it's looking for "-lgmp", so you maybe have an extra "-l"?
     
  3. jrm

    jrm Member

    Messages:
    800
    Thanks Received:
    225
    Does the following work for you?
    Code:
    gcc -Wall -I/usr/local/include -L/usr/local/lib -lgmp test.c
     
  4. jnb

    jnb New Member

    Messages:
    14
    Thanks Received:
    0
    Hey! Thank you all for your quick replies. Yes if I include

    Code:
    -L/usr/local/lib


    all goes well. But shouldn't these paths be included in gcc's default search paths? if not, how can I include them?

    Thanks.
     
  5. jrm

    jrm Member

    Messages:
    800
    Thanks Received:
    225
    /usr/local/include and /usr/local/lib used to be in gcc's default search paths, but they aren't now for some reason. Maybe someone knows why? You can set the environment variables
    Code:
    C_INCLUDE_PATH
    and
    Code:
    LIBRARY_PATH
    .
     
  6. jrm

    jrm Member

    Messages:
    800
    Thanks Received:
    225
    After a little test... The system gcc looks, by default, in /usr/include and /usr/lib, which makes sense; it's the system compiler. gcc45, installed from ports, looks, by default, in /usr/local/include and /usr/local/lib.
     
    jnb thanks for this.
  7. jnb

    jnb New Member

    Messages:
    14
    Thanks Received:
    0
    Thanks for all your help mingrone! I'll install gcc 4.5 and give it a go!