Forum Discussion

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

Building an application

I'm trying to build ipsec-tools using buildroot.

After doing some patches on config.sub to include host nios2 I run make and got some errors:

main.c: In function `main':

main.c:221: warning: implicit declaration of function `daemon'

make[4]: ** [main.o] Erro 1

make[4]: Leaving directory `/home/marcelo/buildroot/build_nios2/ipsec-tools-0.6. 6/src/racoon'

make[3]: ** [all-recursive] Erro 1

make[3]: Leaving directory `/home/marcelo/buildroot/build_nios2/ipsec-tools-0.6. 6/src'

make[2]: ** [all-recursive] Erro 1

make[2]: Leaving directory `/home/marcelo/buildroot/build_nios2/ipsec-tools-0.6. 6'

make[1]: ** [all] Erro 2

make[1]: Leaving directory `/home/marcelo/buildroot/build_nios2/ipsec-tools-0.6. 6'

make: ** [/home/marcelo/buildroot/build_nios2/ipsec-tools-0.6.6/src/setkey/setke y] Erro 2

I tried to compile different versions of buildroot an different versions of ipsec-tools and I got the same errors.

Can someone please help me?!

4 Replies

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

    I edited unistd.h on $STAGING_DIR/include directory and saw this:

    # ifdef __ARCH_USE_MMU__

    /* Put the program in the background, and dissociate from the controlling

    terminal. If NOCHDIR is zero, do `chdir ("/")'. If NOCLOSE is zero,

    redirects stdin, stdout, and stderr to /dev/null. */

    extern int daemon (int __nochdir, int __noclose) __THROW __wur;# endif

    Then I comment the lines that use this function in the program but I get the same error with the function fork.

    Can someone please help me?

    What I can do?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    fork is not allowed with MMU less architectures.

    You can try:

    --with-cflags="-D__uClinux__ -DUSE_VFORK -Dfork=vfork"

    May be it compiles then but if it works is not for sure,

    in most cases vfork can be used instead of fork,

    I think the difference is that in case of vfork the child shares code and memory with the parent.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks for your answer nacide.

    I had already realized this and used the solution that you propose. But I didn't use "-DUSE_VFORK". I didn't need it.

    Then I had a lot of problems after this and I finally compiled it sucessfully.

    I&#39;m thinking to post it on the Wiki page to help other users. Thanks anyway! http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/biggrin.gif