freebsd to ubuntu - BSD

This is a discussion on freebsd to ubuntu - BSD ; Hi everybody, I have to make a C program, built on freeBSD 5.3, compiling and working well on Linux Ubuntu Dapper-Drake (6.0 if I remember) I have never done that before, and I don't know how to proceed... Does someone ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: freebsd to ubuntu

  1. freebsd to ubuntu

    Hi everybody,

    I have to make a C program, built on freeBSD 5.3, compiling and working
    well on Linux Ubuntu Dapper-Drake (6.0 if I remember)

    I have never done that before, and I don't know how to proceed... Does
    someone know a good way ?


    NB:
    If I try to compile my code on ubuntu, gcc wasn't able to find the
    id_dl.h library.

    After a little search, I have found that the "oskit package" was
    including it:
    ( http://packages.ubuntu.com/ -> search if_dl.h )

    I have installed it ( to see... ) and compiled my code with -I option,
    but ubuntu found errors in the library (syntax error near __dead2 ...)

    Do you think it is a solution ?



    Thanks in advance





  2. Re: freebsd to ubuntu

    Begin <45abad61$0$18987$426a34cc@news.free.fr>
    On 2007-01-15, akiuni wrote:
    > I have to make a C program, built on freeBSD 5.3, compiling and working
    > well on Linux Ubuntu Dapper-Drake (6.0 if I remember)
    >
    > I have never done that before, and I don't know how to proceed... Does
    > someone know a good way ?


    If you need to write a program that compiles and runs under both,
    the best bet is to follow the relevant standard (the Single Unix
    Specification, formerly POSIX) as best as you can. And test your
    program on both, of course.

    If you have to provide binaries, you get to do all of the above, plus
    install a cross-building environment on the FreeBSD box. I'd start with
    the source thing; cross-building can be done but requires a good deal of
    knowledge of both platforms to set up.


    > NB:
    > If I try to compile my code on ubuntu, gcc wasn't able to find the
    > id_dl.h library.


    ``id_dh.h'' sounds like a header file; perhaps a header file for a library,
    but in and of itself it is not a library. It isn't on my system, so I'd
    guess it isn't part of the FreeBSD base system. It might be in a port.

    You need to learn to distinguish things like that before you try to do
    cross-building. If the program isn't yours, you might try and ask the
    author for assistence. With the information you supplied, there is not
    much more advice I can offer.


    --
    j p d (at) d s b (dot) t u d e l f t (dot) n l .
    This message was originally posted on Usenet in plain text.
    Any other representation, additions, or changes do not have my
    consent and may be a violation of international copyright law.

  3. Re: freebsd to ubuntu

    In article <45abad61$0$18987$426a34cc@news.free.fr> akiuni
    writes:
    >
    >I have to make a C program, built on freeBSD 5.3, compiling and working
    >well on Linux Ubuntu Dapper-Drake (6.0 if I remember)
    >
    >I have never done that before, and I don't know how to proceed... Does
    >someone know a good way ?


    A good understanding of what the program does, why, and how, is
    generally a prerequisite...

    >NB:
    >If I try to compile my code on ubuntu, gcc wasn't able to find the
    >id_dl.h library.


    I assume this is a typo, since you write if_dl.h below. Paying attention
    to detail is another important thing - in this case you threw someone
    who was willing to help off the track by this mistake. Anyway, just
    compiling to see if it works can be a good start in porting, but when it
    fails you really need to dig in and see what the "deeper" problem is.

    As jpd wrote, a .h file is not a library but a header file, which
    generally provides declarations needed for using a library or system
    calls. In this case it defines the AF_LINK address family and associated
    sockaddr_dl address structure, plus a couple of utility functions in the
    (FreeBSD) C library that use them.

    As far as I know AF_LINK and sockaddr_dl are specific to *BSD (at least
    they don't seem to exist on Linux), and more precisely are only
    meningful if you are running on a kernel that supports them. I.e. you
    can't just "add them" to a system that doesn't have them, rather you'll
    have to find some other way to do whatever it is the program does with
    these, and then probably use suitable #ifdef's to select which parts of
    the source should be used on FreeBSD vs Linux.

    >After a little search, I have found that the "oskit package" was
    >including it:
    >( http://packages.ubuntu.com/ -> search if_dl.h )


    As the package description says, this is for kernel developers - i.e. it
    won't help you in porting a userland program.

    --Per Hedeland
    per@hedeland.org

  4. Re: freebsd to ubuntu

    Hi,

    Thank you for your answers.

    The program that I have to port on Unbuntu is quite small (about 1500
    lines). I've started to re-write it using Linux "headers".

    As you have guessed, I'm not a real C programmer, but sometimes you
    don't have the choice ! ;-)

    many thanks

    PS: the header file is if_dl.h



    Per Hedeland a écrit :
    > In article <45abad61$0$18987$426a34cc@news.free.fr> akiuni
    > writes:
    >> I have to make a C program, built on freeBSD 5.3, compiling and working
    >> well on Linux Ubuntu Dapper-Drake (6.0 if I remember)
    >>
    >> I have never done that before, and I don't know how to proceed... Does
    >> someone know a good way ?

    >
    > A good understanding of what the program does, why, and how, is
    > generally a prerequisite...
    >
    >> NB:
    >> If I try to compile my code on ubuntu, gcc wasn't able to find the
    >> id_dl.h library.

    >
    > I assume this is a typo, since you write if_dl.h below. Paying attention
    > to detail is another important thing - in this case you threw someone
    > who was willing to help off the track by this mistake. Anyway, just
    > compiling to see if it works can be a good start in porting, but when it
    > fails you really need to dig in and see what the "deeper" problem is.
    >
    > As jpd wrote, a .h file is not a library but a header file, which
    > generally provides declarations needed for using a library or system
    > calls. In this case it defines the AF_LINK address family and associated
    > sockaddr_dl address structure, plus a couple of utility functions in the
    > (FreeBSD) C library that use them.
    >
    > As far as I know AF_LINK and sockaddr_dl are specific to *BSD (at least
    > they don't seem to exist on Linux), and more precisely are only
    > meningful if you are running on a kernel that supports them. I.e. you
    > can't just "add them" to a system that doesn't have them, rather you'll
    > have to find some other way to do whatever it is the program does with
    > these, and then probably use suitable #ifdef's to select which parts of
    > the source should be used on FreeBSD vs Linux.
    >
    >> After a little search, I have found that the "oskit package" was
    >> including it:
    >> ( http://packages.ubuntu.com/ -> search if_dl.h )

    >
    > As the package description says, this is for kernel developers - i.e. it
    > won't help you in porting a userland program.
    >
    > --Per Hedeland
    > per@hedeland.org


+ Reply to Thread