Loading ...
Sorry, an error occurred while loading the content.

Statically linking vim with gcc

Expand Messages
  • Steve Davidson
    Hello, I need a version of vim to run while I am in single-user mode and don t have access to shared libraries. How can I make a statically linked vim? Is
    Message 1 of 4 , Feb 29, 2000
    • 0 Attachment
      Hello,
      I need a version of vim to run while I am in single-user
      mode and don't have access to shared libraries.

      How can I make a statically linked vim?
      Is there an option to 'make' or 'configure'
      that will cause the compiler to produce a
      statically linked vim binary?

      I have tried CFLAGS = -static

      Steve Davidson
      sdn@...
    • Wichert Akkerman
      ... Why don t you have access to shared libraries when you are in single-user mode? You probably only need to compile a minimal vim which only uses libraries
      Message 2 of 4 , Mar 1, 2000
      • 0 Attachment
        Previously Steve Davidson wrote:
        > I need a version of vim to run while I am in single-user
        > mode and don't have access to shared libraries.

        Why don't you have access to shared libraries when you are in
        single-user mode? You probably only need to compile a minimal
        vim which only uses libraries in /lib, which is available in
        single-user mode.

        > I have tried CFLAGS = -static

        The magic word is probably LDFLAGS here, not CFLAGS.

        Wichert.

        --
        ________________________________________________________________
        / Generally uninteresting signature - ignore at your convenience \
        | wichert@... http://www.liacs.nl/~wichert/ |
        | 1024D/2FA3BC2D 576E 100B 518D 2F16 36B0 2805 3CB8 9250 2FA3 BC2D |
      • Stephen P. Wall
        ... I use -Xlinker -Bstatic to switch the linker to static mode. I only do this for the gtk/glib libraries, but if you put it before any -l options, it
        Message 3 of 4 , Mar 1, 2000
        • 0 Attachment
          > From: Steve Davidson <sdn@...>
          >
          > How can I make a statically linked vim?
          >
          > I have tried CFLAGS = -static

          I use "-Xlinker -Bstatic" to switch the linker to static mode. I
          only do this for the gtk/glib libraries, but if you put it before
          any "-l" options, it applies for the entire link. Note that on my
          system, some libraries are not available in a static form (i.e.,
          only the dynamic (.so) library exists). This makes an entirely
          static build a little difficult. 8-]

          --
          ______________________________________________________________________
          ________ ______
          Stephen P. Wall Redcom Laboratories, Inc. / __ /\/ ___/\
          Steve_Wall@... One Redcom Center ___/ /\/ /_/ /\__\/
          (716) 924-7550 Victor, NY 14564 /_____/ /_______/ /
          x300 USA \_____\/\_______\/
          ______________________________________________________________________
        • Jens M. Felderhoff
          ... There should be no problem selecting only a subset of the libraries, i.e. those that are available as static archives, for static linking. With many
          Message 4 of 4 , Mar 3, 2000
          • 0 Attachment
            Stephen P. Wall writes:

            > I use "-Xlinker -Bstatic" to switch the linker to static mode. I
            > only do this for the gtk/glib libraries, but if you put it before
            > any "-l" options, it applies for the entire link. Note that on my
            > system, some libraries are not available in a static form (i.e.,
            > only the dynamic (.so) library exists). This makes an entirely
            > static build a little difficult. 8-]

            There should be no problem selecting only a subset of the libraries,
            i.e. those that are available as static archives, for static linking.

            With many linkers you may place the respective linker options more
            than once in between the -l flags, like:

            libs = -lfoo -Wl,-Bstatic -lbar -lbuzz -Wl,-Bdynamic -lfrob \
            -Wl,-Bstatic -lfred -lfrobozz

            In this example, libfoo and libfrob will be dynamically linked,
            whereas libbar, libbuzz, libfred, and libfrobozz will be linked
            statically.

            The HP-UX linker even allows to specify preferences in arbitrary
            order, i.e., take the static one if available and the dynamic one if
            not, or vice versa. Have a look at ld(1) and see what your linker has
            to offer.

            Cheers

            Jens
          Your message has been successfully submitted and would be delivered to recipients shortly.