Newbie: ieee.math_real + ghdl

Discussion in 'VHDL' started by Andreas, Jan 6, 2006.

  1. Andreas

    Andreas Guest

    User-Agent: OSXnews 2.07
    Xref: number1.nntp.dca.giganews.com comp.lang.vhdl:57850



    Hi all,

    I've got a linking problem using the ieee.math_real package with ghdl. I
    removed nearly all code from my Application (see below) and it compiles
    as far as I remove the 'use ieee.math_real.all'. Here's what I got
    from the console (without removing the ieee.math_real.all)
    So here is what I got from the console:
    >ghdl -a CompMy.vhdl
    > ghdl -e CompMy

    /usr/bin/ld:
    /Developer/Simulator/GHDL/lib/gcc/powerpc-apple-darwin8.2.1/4.0.2/vhdl/lib/v93/ieee/math_real-body.o has external relocation
    entries in non-writable section (__TEXT,__text) for symbols:_atanh
    _acosh
    _atan2
    _acos
    _asin
    _log
    _exp
    _sqrt
    collect2: ld returned 1 exit status
    ghdl: compilation error


    MyComp.vhdl:

    library ieee;
    use ieee.std_logic_1164.all;
    use ieee.math_real.all;

    entity compMy is
    port( clk : in std_logic);
    end compMy;

    architecture behaviour of compMy is
    begin
    StateMy: process(clk)
    begin
    if(clk = '1' and clk'event) then
    wait 1 ns;
    end if;
    end process StateMy;
    end behaviour;

    I'm using ghdl 0.20 (20051015) on Mac OSX 10.4.3 with Xcode 2.0

    Looking at google had no success and the ghdl doc's aren't very
    detailed, so anybody got a hint for me?
    Thanks says
    Andreas
     
    Andreas, Jan 6, 2006
    #1
    1. Advertising

  2. Andreas wrote:

    > entity compMy is
    > port( clk : in std_logic);
    > end compMy;
    >
    > architecture behaviour of compMy is
    > begin
    > StateMy: process(clk)
    > begin
    > if(clk = '1' and clk'event) then
    > wait 1 ns;


    > Looking at google had no success and the ghdl doc's aren't very
    > detailed, so anybody got a hint for me?


    get rid of the wait or the process list.
    It's either one or the other.

    -- Mike Treseler
     
    Mike Treseler, Jan 6, 2006
    #2
    1. Advertising

  3. Andreas

    john Doef Guest

    Andreas a écrit :

    > User-Agent: OSXnews 2.07
    > Xref: g2news1.google.com comp.lang.vhdl:1636
    >
    >
    >
    > Hi all,
    >
    > I've got a linking problem using the ieee.math_real package with ghdl. I
    > removed nearly all code from my Application (see below) and it compiles
    > as far as I remove the 'use ieee.math_real.all'. Here's what I got
    > from the console (without removing the ieee.math_real.all)
    > So here is what I got from the console:
    > >ghdl -a CompMy.vhdl
    > > ghdl -e CompMy

    > /usr/bin/ld:
    > /Developer/Simulator/GHDL/lib/gcc/powerpc-apple-darwin8.2.1/4.0.2/vhdl/lib/v93/ieee/math_real-body.o has external relocation
    > entries in non-writable section (__TEXT,__text) for symbols:_atanh
    > _acosh
    > _atan2
    > _acos
    > _asin
    > _log
    > _exp
    > _sqrt
    > collect2: ld returned 1 exit status
    > ghdl: compilation error


    > I'm using ghdl 0.20 (20051015) on Mac OSX 10.4.3 with Xcode 2.0
    >
    > Looking at google had no success and the ghdl doc's aren't very
    > detailed, so anybody got a hint for me?

    Hi,

    >From ghdl mailing list, you should add -Wl,-lm during elaboration.


    JD.
     
    john Doef, Jan 6, 2006
    #3
  4. Andreas

    Andreas Guest

    User-Agent: OSXnews 2.07
    Xref: number1.nntp.dca.giganews.com comp.lang.vhdl:57861


    >Mike Treseler <> wrote:
    >
    >get rid of the wait or the process list.
    >It's either one or the other.


    Hi Mike,

    thanks for the hint, but I don't think it's the wait statement or the
    process list, since the file compiles without the 'use ieee.math_real.all;
    ' line and works as expected.So this produces no errors:

    library ieee;
    use ieee.std_logic_1164.all;

    entity compMy is
    port( clk : in std_logic);
    end compMy;
    ...

    and this does produce the errors mentioned in my original posting:

    library ieee;
    use ieee.std_logic_1164.all;
    use ieee.math_real.all;

    entity compMy is
    port( clk : in std_logic);
    end compMy;
    ...

    So if there's a problem with wait or the process it should arise in both
    cases,isn't it?
    Andreas
     
    Andreas, Jan 6, 2006
    #4
  5. > ghdl -e CompMy
    >
    > /usr/bin/ld:
    > /Developer/Simulator/GHDL/lib/gcc/powerpc-apple-darwin8.2.1/4.0.2/vhdl/lib/v93/ieee/math_real-body.o has external relocation
    > entries in non-writable section (__TEXT,__text) for symbols:_atanh
    > _acosh
    > _atan2
    > _acos
    > _asin
    > _log
    > _exp
    > _sqrt
    > collect2: ld returned 1 exit status
    > ghdl: compilation error


    The linker tells you that the object code of your compiled design
    references math functions that can't be resolved.
    You want to pass the approriate option to the linker so that libm is
    considered during linking:

    $ ghdl -e -Wl,-lm CompMy


    Best regards

    Arnim
     
    Arnim Laeuger, Jan 6, 2006
    #5
  6. Andreas

    Andreas Guest

    User-Agent: OSXnews 2.07
    Xref: number1.nntp.dca.giganews.com comp.lang.vhdl:57863


    Arnim Laeuger <> wrote:
    >The linker tells you that the object code of your compiled design
    >references math functions that can't be resolved.
    >You want to pass the approriate option to the linker so that libm is
    >considered during linking:
    >
    >$ ghdl -e -Wl,-lm CompMy


    Hi Arnim,
    that's more the direction my thought go to. But it seems that libm isn't
    the right library, since I got the same error again. Maybe I have to
    pass the math_real library to the compiler, but I couldn't find the
    library files, just the object files (the ones that the linker mentioned)
    Best regards
    Andreas
     
    Andreas, Jan 6, 2006
    #6
  7. Hi!

    >>You want to pass the approriate option to the linker so that libm is
    >>considered during linking:
    >>
    >>$ ghdl -e -Wl,-lm CompMy

    >


    > that's more the direction my thought go to. But it seems that libm isn't
    > the right library, since I got the same error again. Maybe I have to
    > pass the math_real library to the compiler, but I couldn't find the
    > library files, just the object files (the ones that the linker mentioned)


    Strange, elaboration works here with the mentioned option while it fails
    without.
    Is the gcc tool-chain set-up properly on your machine? Can you compile
    the following C-code:

    #include <stdio.h>
    #include <math.h>

    int main (int argc, char *argv[]) {
    printf("sin(0): %f\n", sin(0));
    return(0);
    }

    $ gcc -o tm -lm tm.c


    Besides that, googling for the error message reveals a lot of reports
    describing this problem on powerpc-apple-* systems. One common solution
    is to pass option -lcc_dynamic to the linker:

    http://sourceforge.net/mailarchive/forum.php?forum_id=3200&style=flat&viewday=6&viewmonth=200307
    http://null.perl-hackers.net/archives/programming/

    No idea what it is required for.

    This translates to the following elaboration command:

    $ ghdl -e -Wl,-lm -Wl,-lcc_dynamic CompMy

    Sorry, here you're on your own as I have no possibility to test such
    things myself.


    Cheers

    Arnim
     
    Arnim Laeuger, Jan 6, 2006
    #7
  8. Andreas

    Phil Tomson Guest

    In article <dplteo$5o1$01$-online.com>,
    Andreas <-saarland.de> wrote:
    >
    >Arnim Laeuger <> wrote:
    >>The linker tells you that the object code of your compiled design
    >>references math functions that can't be resolved.
    >>You want to pass the approriate option to the linker so that libm is
    >>considered during linking:
    >>
    >>$ ghdl -e -Wl,-lm CompMy


    That recommendation would be for the case where you were trying to write some
    foreign models in C and were trying to call functions in C's libm. Not the
    case here. He's trying to call some functions from math_real.

    >
    >Hi Arnim,
    >that's more the direction my thought go to. But it seems that libm isn't
    >the right library, since I got the same error again. Maybe I have to
    >pass the math_real library to the compiler, but I couldn't find the
    >library files, just the object files (the ones that the linker mentioned)


    Yes, I think you need to recompile math_real. Did you recently upgrade to a
    newer GHDL version? I would look for math_real.vhd somewhere on the web and
    try putting it in your directory and then math_real.vhd before you do the
    linking step.

    Phil
     
    Phil Tomson, Jan 6, 2006
    #8
  9. Andreas

    Phil Tomson Guest

    In article <dpkdme$b79$02$-online.com>,
    Andreas <-saarland.de> wrote:
    >
    >
    >Hi all,
    >
    >I've got a linking problem using the ieee.math_real package with ghdl. I
    >removed nearly all code from my Application (see below) and it compiles
    >as far as I remove the 'use ieee.math_real.all'. Here's what I got
    >from the console (without removing the ieee.math_real.all)
    >So here is what I got from the console:
    > >ghdl -a CompMy.vhdl
    >> ghdl -e CompMy

    >/usr/bin/ld:
    >/Developer/Simulator/GHDL/lib/gcc/powerpc-apple-darwin8.2.1/4.0.2/vhdl/lib/v93/ieee/math_real-body.o has external relocation
    >entries in non-writable section (__TEXT,__text) for symbols:_atanh
    >_acosh
    >_atan2
    >_acos
    >_asin
    >_log
    >_exp
    >_sqrt
    >collect2: ld returned 1 exit status
    >ghdl: compilation error
    >
    >
    >MyComp.vhdl:
    >
    >library ieee;
    >use ieee.std_logic_1164.all;
    >use ieee.math_real.all;
    >
    >entity compMy is
    > port( clk : in std_logic);
    >end compMy;
    >
    >architecture behaviour of compMy is
    >begin
    > StateMy: process(clk)
    > begin
    > if(clk = '1' and clk'event) then
    > wait 1 ns;
    > end if;
    > end process StateMy;
    >end behaviour;
    >
    >I'm using ghdl 0.20 (20051015) on Mac OSX 10.4.3 with Xcode 2.0
    >
    >Looking at google had no success and the ghdl doc's aren't very
    >detailed, so anybody got a hint for me?
    >Thanks says
    >Andreas
    >


    here's my guess:

    Did you build ghdl on OSX, or did you get a ready-made executable?

    First off, try this:
    > gcc_select


    If it returns a message that says something about the current default gcc is
    4.0.x, then try the following:

    > sudo gcc_select 3.3


    (that will change the gcc version used from then on to 3.3 instead of
    Tiger's default 4.x) From the error listing above, it looks like you're using
    4.0.2:
    >/Developer/Simulator/GHDL/lib/gcc/powerpc-apple-darwin8.2.1/4.0.2


    Then run your ghdl -a, ghdl -e commands over again.

    My guess is that maybe the ghdl executable and libraries you downloaded were
    built with gcc 3.3 and thus will not work if you're using gcc 4.0.x.

    Or possibly, it's the other way around, maybe the ghdl package you downloaded
    was compiled with gcc 4.0.x and you've done a gcc_select 3.3 somewhere along
    the line? If gcc_select told you that the default gcc is 3.3, then try
    setting the default back to 4.0:

    > sudo gcc_select 4.0


    ....and then run the analysis and elaboration again...

    (I still have ghdl 0.17 installed on my OSX machine, so I can't quite
    reproduce what you're seeing because 0.17 didn't seem to come with a
    math_real library at all.)

    Phil
     
    Phil Tomson, Jan 7, 2006
    #9
  10. Andreas

    Phil Tomson Guest

    In article <>,
    Phil Tomson <> wrote:
    >In article <dpkdme$b79$02$-online.com>,
    >Andreas <-saarland.de> wrote:
    >>
    >>
    >>Hi all,
    >>
    >>I've got a linking problem using the ieee.math_real package with ghdl. I
    >>removed nearly all code from my Application (see below) and it compiles
    >>as far as I remove the 'use ieee.math_real.all'. Here's what I got
    >>from the console (without removing the ieee.math_real.all)
    >>So here is what I got from the console:
    >> >ghdl -a CompMy.vhdl
    >>> ghdl -e CompMy

    >>/usr/bin/ld:
    >>/Developer/Simulator/GHDL/lib/gcc/powerpc-apple-darwin8.2.1/4.0.2/vhdl/lib/v93/ieee/math_real-body.o has external relocation
    >>entries in non-writable section (__TEXT,__text) for symbols:_atanh
    >>_acosh
    >>_atan2
    >>_acos
    >>_asin
    >>_log
    >>_exp
    >>_sqrt
    >>collect2: ld returned 1 exit status
    >>ghdl: compilation error
    >>
    >>
    >>MyComp.vhdl:
    >>
    >>library ieee;
    >>use ieee.std_logic_1164.all;
    >>use ieee.math_real.all;
    >>
    >>entity compMy is
    >> port( clk : in std_logic);
    >>end compMy;
    >>
    >>architecture behaviour of compMy is
    >>begin
    >> StateMy: process(clk)
    >> begin
    >> if(clk = '1' and clk'event) then
    >> wait 1 ns;
    >> end if;
    >> end process StateMy;
    >>end behaviour;
    >>
    >>I'm using ghdl 0.20 (20051015) on Mac OSX 10.4.3 with Xcode 2.0
    >>
    >>Looking at google had no success and the ghdl doc's aren't very
    >>detailed, so anybody got a hint for me?
    >>Thanks says
    >>Andreas
    >>

    >
    >here's my guess:
    >
    > Did you build ghdl on OSX, or did you get a ready-made executable?
    >
    >First off, try this:
    >> gcc_select

    >
    >If it returns a message that says something about the current default gcc is
    >4.0.x, then try the following:
    >
    >> sudo gcc_select 3.3

    >
    >(that will change the gcc version used from then on to 3.3 instead of
    >Tiger's default 4.x) From the error listing above, it looks like you're using
    >4.0.2:
    >>/Developer/Simulator/GHDL/lib/gcc/powerpc-apple-darwin8.2.1/4.0.2

    >
    >Then run your ghdl -a, ghdl -e commands over again.
    >
    >My guess is that maybe the ghdl executable and libraries you downloaded were
    >built with gcc 3.3 and thus will not work if you're using gcc 4.0.x.
    >
    >Or possibly, it's the other way around, maybe the ghdl package you downloaded
    >was compiled with gcc 4.0.x and you've done a gcc_select 3.3 somewhere along
    >the line? If gcc_select told you that the default gcc is 3.3, then try
    >setting the default back to 4.0:
    >
    >> sudo gcc_select 4.0

    >
    >...and then run the analysis and elaboration again...
    >
    >(I still have ghdl 0.17 installed on my OSX machine, so I can't quite
    >reproduce what you're seeing because 0.17 didn't seem to come with a
    >math_real library at all.)
    >


    Sorry to answer my own post, but here's another datapoint:

    I installed 0.20 and set gcc_select to 3.3 and I get the following:

    l% sudo gcc_select 3.3
    Default compiler has been set to:
    gcc version 3.3 20030304 (Apple Computer, Inc. build 1809)
    % ghdl -a CompMy.vhd
    % ghdl -e compMy
    ld: warning prebinding disabled because of undefined symbols
    ld: Undefined symbols:
    _fprintf$LDBLStub
    _vprintf$LDBLStub
    ghdl: compilation error

    (BTW: you need to get rid of the wait statement in your VHDL file)

    Then I switched to 4.0 and tried it:

    % sudo gcc_select 4.0
    Default compiler has been set to:
    gcc version 4.0.0 20041026 (Apple Computer, Inc. build 4061)
    % ghdl -a CompMy.vhd
    % ghdl -e compMy
    /usr/bin/ld:
    /Developer/Simulator/GHDL/lib/gcc/powerpc-apple-darwin8.2.1/4.0.2/vhdl/lib/v93/ieee/math_real-body.o
    relocation overflow for relocation entry 294 in section (__TEXT,__text)
    (displacement too large)


    (commenting out the line: use ieee.math_real.all; leads to success, so the
    problem is with that library)

    I would send an email to Felix Bertram:


    He's the maintainer of the ghdl OSX package.

    Phil
     
    Phil Tomson, Jan 7, 2006
    #10
  11. Andreas

    Phil Tomson Guest

    In article <>,
    john Doef <> wrote:
    >
    >Andreas a écrit :
    >
    >> User-Agent: OSXnews 2.07
    >> Xref: g2news1.google.com comp.lang.vhdl:1636
    >>
    >>
    >>
    >> Hi all,
    >>
    >> I've got a linking problem using the ieee.math_real package with ghdl. I
    >> removed nearly all code from my Application (see below) and it compiles
    >> as far as I remove the 'use ieee.math_real.all'. Here's what I got
    >> from the console (without removing the ieee.math_real.all)
    >> So here is what I got from the console:
    >> >ghdl -a CompMy.vhdl
    >> > ghdl -e CompMy

    >> /usr/bin/ld:
    >>

    >/Developer/Simulator/GHDL/lib/gcc/powerpc-apple-darwin8.2.1/4.0.2/vhdl/lib/v93/ieee/math_real-body.o has external relocation
    >> entries in non-writable section (__TEXT,__text) for symbols:_atanh
    >> _acosh
    >> _atan2
    >> _acos
    >> _asin
    >> _log
    >> _exp
    >> _sqrt
    >> collect2: ld returned 1 exit status
    >> ghdl: compilation error

    >
    >> I'm using ghdl 0.20 (20051015) on Mac OSX 10.4.3 with Xcode 2.0
    >>
    >> Looking at google had no success and the ghdl doc's aren't very
    >> detailed, so anybody got a hint for me?

    >Hi,
    >
    >>From ghdl mailing list, you should add -Wl,-lm during elaboration.


    Didn't seem to work, but maybe I'm getting a different error:

    l% ghdl -e -Wl,-lm compMy
    /usr/bin/ld:
    /Developer/Simulator/GHDL/lib/gcc/powerpc-apple-darwin8.2.1/4.0.2/vhdl/lib/v93/ieee/math_real-body.o
    relocation overflow for relocation entry 294 in section (__TEXT,__text)
    (displacement too large)

    Phil
     
    Phil Tomson, Jan 8, 2006
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Juan Carlos Allica

    PACKAGE MATH_REAL problems

    Juan Carlos Allica, Jul 13, 2005, in forum: VHDL
    Replies:
    2
    Views:
    1,731
    David Bishop
    Jul 13, 2005
  2. create

    logarithms PACKAGE MATH_REAL

    create, Jan 28, 2008, in forum: VHDL
    Replies:
    1
    Views:
    660
  3. Nicolas Matringe

    Synthesis of math_real package

    Nicolas Matringe, Feb 5, 2008, in forum: VHDL
    Replies:
    9
    Views:
    2,606
    Nicolas Matringe
    Feb 6, 2008
  4. Sean Durkin
    Replies:
    2
    Views:
    1,128
    Sean Durkin
    Sep 10, 2009
  5. Bart Fox
    Replies:
    2
    Views:
    1,051
    Vignesh2207
    Mar 19, 2014
Loading...

Share This Page