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

  • Home
  • SEARCH
  • 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 9091295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:34:34+00:00 2026-06-16T22:34:34+00:00

I have the same problem as others have: I have a *.la file generated

  • 0

I have the same problem as others have:

  • I have a *.la file generated by libtool in an Automake project (e.g. module.la),
  • but I need the *.so of it to use it for dlopen() (eg. module.so).

But: project is configured and built with --disable-shared to make sure the created main binary is one big statically linked program, e.g. main.x (easier for deployment and debugging). Thus *.so files are not created.

The program main.x is a huge framework-like application which is capable of loading extensions (modules) via dlopen() — despite it being linked statically.

This works fine when I build module.so by hand. But putting this to work in Makefile.am seems impossible to me. Yes, I can write lib_LTLIBRARIES, but with my standard --disable-shared I do not get a *.so file.

lib_LTLIBRARIES = module.la
module_so_SOURCES = module.cpp

The file module.la is created, which dlopen() refuses to load (of course).

I tried to put rules into Makefile.am building it manually and that works:

# Makefile.am (yes, .am)
all: mm_cpp_logger.so

SUFFIXES = .so

%.so: %.cpp
    $(CXX) $(CXXFLAGS) -fPIC -fpic -c -I $(top_srcdir)/include -o $@  $<

%.so: %.o
    $(CXX) $(LDFLAGS) -shared -fPIC -fpic -o $@  $<

But this can only be a workaround. I do not get all the nice auto-features like dependency-checking and installation.

How can I build module.so with still building the main program with --disable-shared (or with the same effect) in the Makefile.am-way?

  • can I postprocess *.la files to *.so files with a special automake rule?
  • can I tweak the lib_LTLIBRARIES process to create *.so files in any case?
  • 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-06-16T22:34:35+00:00Added an answer on June 16, 2026 at 10:34 pm

    What you are looking for is called a module. You can tell Autotools to create a static binary (executable) by adding -all-static to the LDFLAGS of the application. I think this is the preferred way over using --disable-shared configure flag (which really is aimed at the libraries rather than the executable)

    Something like this should do the trick:

    AM_CPPFLAGS=-I$(top_srcdir)/include
    
    lib_LTLIBRARIES = module.la
    module_la_LDFLAGS = -module -avoid-version -shared
    module_la_SOURCES = mm_cpp_logger.cpp
    
    bin_PROGRAMS = application
    application_LDFLAGS = -all-static
    application_SOURCES = main.cpp
    

    The .so file will (as usual) end up in the .libs/ subdirectory (unless you install it, of course).

    And you can build both your application and plugins in one go (even with a single Makefile.am), so there is no need to call configure multiple times.

    The use of -fPIC (and friends) should be auto-detected by Autotools.


    Update: here’s a little trick to make the shared-libraries available where you expect them. Since all shlibs end up in .libs/, it is sometimes nice to have them in a non-hidden directory.

    The following makefile snippet creates convenience links (on platforms that support symlinks; otherwise they are copied). Simply adding the snippet to your makefile (i usually use an -include convenience-link.mk) should be enough (you might need an AC_PROG_LN_S in your configure.ac)

    .PHONY: convenience-link clean-convenience-link
    
    convenience-link: $(lib_LTLIBRARIES)
        @for soname in `echo | $(EGREP) "^dlname=" $^ | $(SED) -e "s|^dlname='\(.*\)'|\1|"`; do  \
            echo "$$soname: creating convenience link from $(abs_builddir)/.libs to $(top_builddir)"; \
            rm -f $(top_builddir)/$$soname ; \
            test -e $(abs_builddir)/.libs/$$soname && \
            cd $(top_builddir) && \
            $(LN_S) $(abs_builddir)/.libs/$$soname $$soname || true;\
        done 
    
    clean-convenience-link:
        @for soname in `echo | $(EGREP) "^dlname=" $(lib_LTLIBRARIES) | $(SED) -e "s|^dlname='\(.*\)'|\1|"`; do  \
            echo "$$soname: cleaning convenience links"; \
            test -L $(top_builddir)/$$soname && rm -f $(top_builddir)/$$soname || true; \
        done 
            
    all-local:: convenience-link
    
    clean-local:: clean-convenience-link
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read the other threads regarding this same problem but I still don't
I have the same problem described here on the e-office blog , but in
I have some automatically generated Ant build scripts that I need to use to
I have the same problem that is listed in the following thread. WSDL first
I have the same problem as described in ( Last record of Join table
I have the same problem as in the following post . So I am
Solution: if you have the same problem, addElement() instead of addChild() is what did
Does anyone have the same problem as I do? ... I've upgraded to the
I have essentially the same problem discussed here: http://khason.net/blog/dependency-property-getters-and-setters-in-multithreaded-environment/ public static readonly DependencyProperty MyPropertyProperty
I have basically the same problem outlined in this question, however I am using

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.