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 8446135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:50:54+00:00 2026-06-10T09:50:54+00:00

I spent almost an hour googling for the solution, but the documentation for numpy.distutils

  • 0

I spent almost an hour googling for the solution, but the documentation for numpy.distutils is very sparse.

I have a f2py-wrapped module. It consists basically of 3 files:

a.f90
a.pyf
lib.a <- this is a static library that contains most of the computational code

The module is well compiled with the following shell-script command.

f2py --build-dir temp -c a.pyf a.f90 lib.a --fcompiler=gnu95   
--fcompiler-flags="Zillions of compiler options"

As a result, I have the python module a.so (the name is specified in the .pyf file).

How do I do that with numpy.distutils (or some other python-oriented building tools)?
A less important question is, can I also include the dependence from lib.a (and rebuild it when necessary?)

  • 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-10T09:50:56+00:00Added an answer on June 10, 2026 at 9:50 am

    So, it is not 1 hour of Googling, it took 2 days of Googling, but finally I found the way to do that.
    Hope, it will be helpful to someone.

      def configuration(parent_package='',top_path=None):
          from numpy.distutils.misc_util import Configuration, get_info
          config = Configuration('a', parent_package, top_path)
          lib = ['./libdir/lib.a']
          src = ['a.f90','a.pyf']
          inc_dir = ['libdir']              
          config.add_extension('mya',sources=src,depends=lib_tt,
                          include_dirs=inc_dir,extra_objects="lib.a")
          #The main trick was to use extra_objects keyword
          return config
    
      if __name__ == '__main__':
          from numpy.distutils.core import setup
          setup(**configuration(top_path='').todict())
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have spent an hour trying to solve this - but to no avail. I'm
My project that I've spent almost 40hrs on is almost complete, but I have
Sorry to be posting this question. :( But I have spent almost the entire
I have spent almost 24hours trying to figure out what I'm doing wrong, but
I have spent almost the whole day trying to find a solution to this
I have spent a lot of time looking for a solution, but could not
I just spent almost an hour trying to figure out an issue with having
It must be obvious, but I can't figure it out. I spent almost a
I spent almost a day but couldn't figure out how to use IdentityReducer in
Have spent a week trying to wrap my head around Yii framework, but while

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.