Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

Managed Libraries

I am running into a bit of a problem with the Managed Libraries. I have existing common code that I am trying to build into a library. But this code uses the types defined in alt_types.h. So, since this is part of the HAL, it won't build. This seems like a serious limitation. In the Software Dev, Guide it states that we should use these types and then Altera prevents us from using them in a library. I am totally off them mark here or should I just forget using Managed Libraries?

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I think there is a little bug in the library makefiles that prevents the inclusion of alt_types.h . It is in one of the topics I sent recently on the forum.

    go into components/altera_hal/build/lib.mk

    search the line

    <div class='quotetop'>QUOTE </div>

    --- Quote Start ---

    CPPFLAGS += -I.. -I$(GTF_GENERATED)

    $(foreach dir, $(HAL_INC_DIRS), -I$(dir))[/b]

    --- Quote End ---

    and change it in

    <div class='quotetop'>QUOTE </div>

    --- Quote Start ---

    CPPFLAGS += -I..

    $(foreach dir, $(HAL_INC_DIRS), -I$(dir))[/b]

    --- Quote End ---

    ...and enjoy :-)

    ... in general, the standard libraries will allow you to include only the header files into altera_hal and altera_nios2.

    If you need more, you need some more hacking in the library makefiles :-)

    bye

    PJ
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Has this been reported as a bug to Altera? Paolo.gai&#39;s post is from 15 months ago, yet we also just encountered this problem still in NIOS 6.0SP1.

    It&#39;s amusing what goes wrong. When GTF_GENERATED is undefined the buggy line introduces a "-I" with no directory argument suffix. GCC then interprets this as an include directive using its space-separated syntax, and gobbles the the next valid -I<alteralib> directive as gibberish, thus removing the valid library path that ought to have been included.

    I&#39;m always loath to modify the system files for fear of breaking on the next upgrade, so we&#39;ve worked around this problem by predefining GTF_GENERATED as ".".