CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2015
    Posts
    3

    Question linux to freebsd cross compiler

    I was trying to compile a gcc cross compiler for linux x86_64 (build and host) to freebsd x86_64.
    I tried to follow this http://marcelog.github.io/articles/articles.html and then some other guides around the web, but I continue to get this:
    Code:

    Code:
    ...
    make[3]: Leaving directory '/home/nick/Scaricati/build-gcc/x86_64-freebsd10.1/libgcc'
    DEFINES='' HEADERS='' \
       ../../../gcc-4.9.2/libgcc/mkheader.sh > tmp-libgcc_tm.h
    /bin/bash ../../../gcc-4.9.2/libgcc/../move-if-change tmp-libgcc_tm.h libgcc_tm.h
    echo timestamp > libgcc_tm.stamp
    /home/nick/Scaricati/build-gcc/./gcc/xgcc -B/home/nick/Scaricati/build-gcc/./gcc/ -B/usr/local/cross/x86_64-freebsd10.1/bin/ -B/usr/local/cross/x86_64-freebsd10.1/lib/ -isystem /usr/local/cross/x86_64-freebsd10.1/include -isystem /usr/local/cross/x86_64-freebsd10.1/sys-include  -g -O2 -O2  -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -fpic -pthread -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -Dinhibit_libc  -fpic -pthread -I. -I. -I../.././gcc -I../../../gcc-4.9.2/libgcc -I../../../gcc-4.9.2/libgcc/. -I../../../gcc-4.9.2/libgcc/../gcc -I../../../gcc-4.9.2/libgcc/../include  -DHAVE_CC_TLS  -o _muldi3.o -MT _muldi3.o -MD -MP -MF _muldi3.dep -DL_muldi3 -c ../../../gcc-4.9.2/libgcc/libgcc2.c -fvisibility=hidden -DHIDE_EXPORTS
    In file included from ../../../gcc-4.9.2/libgcc/../gcc/tsystem.h:44:0,
      from ../../../gcc-4.9.2/libgcc/libgcc2.c:27:
    /home/nick/Scaricati/build-gcc/gcc/include/stddef.h:56:24: fatal error: sys/_types.h: No such file or directory
     #include <sys/_types.h>
      ^
    compilation terminated.
    Makefile:463: recipe for target '_muldi3.o' failed
    make[2]: *** [_muldi3.o] Error 1
    make[2]: Leaving directory '/home/nick/Scaricati/build-gcc/x86_64-freebsd10.1/libgcc'
    Makefile:12757: recipe for target 'all-target-libgcc' failed
    make[1]: *** [all-target-libgcc] Error 2
    make[1]: Leaving directory '/home/nick/Scaricati/build-gcc'
    Makefile:869: recipe for target 'all' failed
    make: *** [all] Error 2
    this is the lasts logs of make process of gcc-4.9.2 sources with TARGET=x86_64-freebsd10.1

    what I'm doing wrong? Any ideas?

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: linux to freebsd cross compiler

    Code:
    #include <sys/_types.h>
    The problem is here. The compiler cannot find the file sys/_types.h. This is either because the compiler cannot find the directory sys within the defined include paths or within the sys directory the file _types.h does not exist.

    Does the file _types.h exist on the system somewhere and if it does has the required include directories been specified properly?
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  3. #3
    Join Date
    Mar 2015
    Posts
    3

    Re: linux to freebsd cross compiler

    Quote Originally Posted by 2kaud View Post
    Code:
    #include <sys/_types.h>
    The problem is here. The compiler cannot find the file sys/_types.h. This is either because the compiler cannot find the directory sys within the defined include paths or within the sys directory the file _types.h does not exist.

    Does the file _types.h exist on the system somewhere and if it does has the required include directories been specified properly?
    Yes, I know, and I found _types.h in /usr/include/freebsd/sys.
    Now?

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: linux to freebsd cross compiler

    Quote Originally Posted by NickF_93 View Post
    Yes, I know, and I found _types.h in /usr/include/freebsd/sys.
    Now?
    Change the #include so it finds the path or set up the includes path to include this path.

  5. #5
    Join Date
    Mar 2015
    Posts
    3

    Resolved Re: linux to freebsd cross compiler

    Quote Originally Posted by Arjay View Post
    Change the #include so it finds the path or set up the includes path to include this path.
    Obviously this is not a good way because I'm building a program like gcc for another target.

    However I found the solution and so, also, my error: I didn't set up properly sysroot.

    I had to dowload (or take it from a build and working system) the target system on my machine and then I was able to set --with-sysroot in configuration process of binutils and gcc sources, and then run

    $ make
    and
    # make install

    And finally I got my toolchain!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured