Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6777583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:09:54+00:00 2026-05-26T16:09:54+00:00

In the book Autotools: A Practioner’s Guide to GNU Autoconf, Automake, and Libtool ,

  • 0

In the book Autotools: A Practioner’s Guide to GNU Autoconf, Automake, and Libtool, chapter 6 (building libraries with libtool), an example of linking library is given.

In the example, a library libjupiter.so is linked to another library libjupcommon.a. The first attempt fails because libjupiter.so needs PIC, but libjupcommon.a is not. The author adds libjupcommon_a_CFLAGS = -fPIC to fix it. It gets much better, but the warning of ‘Linking the shared library libjupiter.la against the static library ../common/libjupcommon.a is not portable!‘ appears.

Therefore the author modifies the Makefile.am’s again, using libtool to build libjupcommon.la. The libjupiter links to the libjupcommon.la.
Like this:

noinst_LTLIBRARIES = libjupcommon.la

libjupcommon_la_SOURCES = jupcommon.h print.c

and

…

libjupiter_la_LIBADD = ../common/libjupcommon.la

This time everything’s OK.


Now, my problem:

I have a library needs another library, just like libjupiter needs libjupcommon. The difference is my libjupcommon is from another project and installed into the system. It is not a noinst_LTLIBRARIES. Both .so and .a version exist. When I try to link the libjupcommon.la like the example shows, the .so is chosen, but I don’t want a dynamic linking relationship. I want to link to the .a, like the example in the book.

Linking to .a explicitly (by using _LIBADD=the .a file) gives a usable library, but the warning of ‘… not portable’ is given.

What’s the proper way to achieve linking to the .a in this case?

PS: Download the example from the book’s official site. In autotools/book/jupiter-libtool-ch6/common, modify the Makefile.am’s noinst_LTLIBRARIES to lib_LTLIBRARIES should be a close mimic to my problem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T16:09:55+00:00Added an answer on May 26, 2026 at 4:09 pm

    There’s a couple things you could try. You could try running configure with the --disable-shared option to turn off compilation of shared libs (and add the static lib to libfoo_LIBADD again). You could try adding -static to libfoo_LDFLAGS to get libtool to build it statically (again with the static lib added to libfoo_LIBADD).

    EDIT: Since both static and shared libs are needed the above won’t work.

    Try adding:

    AC_CHECK_LIB([abc],[some_function_in_libabc])
    

    to configure.ac.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If Book aggregates Chapter which in turn aggregates Page, then what should be the
The book Designing Embedded Hardware in the chapter 9.3. Old Faithful: RS-232C mentions that
The book X Power Tools has a chapter Display Specifications, where it states: Since
In book JavaScript: The Definitive Guide, 5th Edition by David Flanagan, says: before sending
The book Agile development with Rails shows in the second chapter, that you can
A book as the following example and explains that you won't see the line
My book presents a simple example which I'm a bit confused about: It says,
I am reading the book Javascript: The good parts. Now I am reading chapter
The book that I purchased to help with my SSIS understanding seems to have
What book would you recommend to learn test driven development? Preferrably language agnostic.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.