Professional Web Applications Themes

(Mandrake 9.1) Library headache - two questions - UNIX Programming

Nils Emil P. Ln <neit.dk> writes: > My first question is: How do I get gcc to compile my application so it > can run on my server with glibc 2.2 (upgrading the server is NOT an > option). It is *exceedingly* difficult, to build "backwards compatible" executables. AFAIK, you only have 2 options: o Downgrade the development machine o Install a complete glibc-2.2 "cross-compilation" environment [install glibc-2.2 and all of its header files under e.g. /usr/glibc-2.2 and point your -I and -L there] > I'm having another problem too. I use a library called COMEDILIB to > interface the ...

  1. #1

    Default Re: (Mandrake 9.1) Library headache - two questions

    Nils Emil P. Ln <neit.dk> writes:
    > My first question is: How do I get gcc to compile my application so it
    > can run on my server with glibc 2.2 (upgrading the server is NOT an
    > option).
    It is *exceedingly* difficult, to build "backwards compatible"
    executables. AFAIK, you only have 2 options:

    o Downgrade the development machine
    o Install a complete glibc-2.2 "cross-compilation" environment
    [install glibc-2.2 and all of its header files under
    e.g. /usr/glibc-2.2 and point your -I and -L there]
    > I'm having another problem too. I use a library called COMEDILIB to
    > interface the measurement and control ISA-board in the server.
    > With Mdk 8.2, I used this command to compile my application:
    >
    > gcc -o <program> <object files> -lcomedi -lm
    > ^^^^
    > it dosen't work anymore (in Mdk 9.1) and I have to
    What's the error message?
    > My second question is why I have to type the full path to the library?
    If the library is in /usr/lib, you should not need to do that.
    Does /usr/lib/libcomedi.so also exist?

    Cheers,
    --
    In order to understand recursion you must first understand recursion.
    Paul Pluzhnikov Guest

  2. #2

    Default Re: (Mandrake 9.1) Library headache - two questions

    Nils Emil P. Ln <neit.dk> writes:
    > >It is *exceedingly* difficult, to build "backwards compatible"
    > >executables. AFAIK, you only have 2 options:
    > >
    > >o Downgrade the development machine
    >
    > You mean switching back to Mdk 8.2 - this is of course an opportunity,
    Yes.
    > but is also a major defeat for Linux...
    How so? None of the UNIX-like OSes I know support compiling your
    program on a later release, and running it on an earlier one...
    > >o Install a complete glibc-2.2 "cross-compilation" environment
    > > [install glibc-2.2 and all of its header files under
    > > e.g. /usr/glibc-2.2 and point your -I and -L there]
    >
    > This dosn't sound impossible, but I haven't got a good grasp of the
    > details. Is this what you call exceedingly difficult (or was that a
    > third option)?
    Yes, that is the exceedingly difficult part.
    > BTW can I compile glibc-2.2 with glibc-2.3 on my Mdk 9.1
    > distribution??
    Yes, that should be no problem.
    Configure it with --prefix=/usr/glibc-2.2
    > When glibc-2.2 is installed under /usr/glibc-2.2, what do I then have
    > to do to compile my app.? It is just
    > gcc -o <program> <objectfiles> -I/usr/glibc-2.2 -L/usr/glibc-2.2
    > or will gcc still link to glibc-2.3 ?
    That is the difficult part. You will discover that it is more
    difficult than just:

    gcc -c -I/usr/glibc-2.2/include <source>.c
    gcc -o <program> <objectfiles> -L/usr/glibc-2.2/lib

    because there are also startup files (crt0.o, etc.) and dynamic linker
    /lib/ld-linux.so.2 to worry about. Start with adding '-v' option to the
    command line above, and study the output carefully.

    You will probably have to link with -nostdlib -nostartup and
    explicitly specify everything.

    Also note, that glibc header files include linux *kernel* headers, so
    you may have to install a "backward" copy of these as well (assuming
    MDK9.1 and MDK8.2 do not ship with the exact same kernel version).
    > >> gcc -o <program> <object files> -lcomedi -lm
    >
    > comedi_calibrate(.text+0xcb): )In function 'main':
    > undefined reference to 'comedi_open'
    > (repeated a lot of times for library functions)
    Hmm, that is strange -- if libcomedi.si defines comedi_open().
    > >Does /usr/lib/libcomedi.so also exist?
    >
    > Yes it does. The strange this it that it works perfectly when I type
    > the full path instead of supplying the -lcomedi option!!
    You aren't just supplying full path. You are also selecting *archive*
    version of libcomedi, instead of the shared version that is selected
    by -lcomedi. I bet this:

    gcc -o ... /usr/lib/libcomedi.so -lm

    will also fail with the same error. But I do not know why it fails.
    What is the output from

    nm -D /usr/lib/libcomedi.so | grep comedi_open
    ldd /usr/lib/libcomedi.so

    Cheers,
    --
    In order to understand recursion you must first understand recursion.
    Paul Pluzhnikov Guest

  3. #3

    Default Re: (Mandrake 9.1) Library headache - two questions

    Paul Pluzhnikov <ppluzhnikovearthlink.net> writes:
    > Nils Emil P. Ln <neit.dk> writes:
    >
    > > My first question is: How do I get gcc to compile my application so it
    > > can run on my server with glibc 2.2 (upgrading the server is NOT an
    > > option).
    >
    > It is *exceedingly* difficult, to build "backwards compatible"
    > executables. AFAIK, you only have 2 options:
    >
    > o Downgrade the development machine
    > o Install a complete glibc-2.2 "cross-compilation" environment
    > [install glibc-2.2 and all of its header files under
    > e.g. /usr/glibc-2.2 and point your -I and -L there]
    It is not trivial, but I would not characterize it as "exceedingly
    difficult".

    Read the gcc cross-compilation doentation (e.g. info), install the
    cross-compiler and binutils (linker, assembly) as described there,
    grab the libraries you need to link from the server (all that is
    described in the cross-compilation docs), and go ahead.

    It is *not trivial*, just to emphasize the point again, but it is
    certainly doable.

    --
    Oleg Goldshmidt | [email]pubNOSPAM.goldshmidt.org[/email]
    Oleg Goldshmidt Guest

  4. #4

    Default Re: (Mandrake 9.1) Library headache - two questions

    Hello

    Just to round off I have found a different approach to my problem.
    Since it's to difficult to set up a linux with glibc 3.3 to compile
    for a linux with glibc 3.2, I now do this:

    On a seperate partition I've installed a 3.2 system to compile on. It
    would be very annoying to reboot each time I need to compile, so I
    type this in a terminal:

    chroot /mnt/linextra /bin/bash

    This starts a bash-session with my 3.2 system as root directory.

    This way I can compile my 3.2 binaries without rebooting and without
    having too much headache !

    Thank you for your help !

    Nils Emil P. Ln

    Nils Emil P. Larsen Guest

Similar Threads

  1. Bit of a headache
    By Jansolo in forum Macromedia Dynamic HTML
    Replies: 4
    Last Post: October 14th, 01:14 AM
  2. Replies: 39
    Last Post: October 14th, 02:50 PM
  3. Web Service headache
    By Toby Mathews in forum ASP.NET Web Services
    Replies: 1
    Last Post: October 25th, 02:09 PM
  4. ~/Library/ vs ~/System/Library vs /User/Library/
    By Doug Brown in forum Mac Applications & Software
    Replies: 8
    Last Post: July 20th, 11:56 PM
  5. Replies: 0
    Last Post: July 9th, 07:42 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139