-
Notifications
You must be signed in to change notification settings - Fork 4.9k
test link against libaio using distutils #1247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,10 +50,14 @@ def extra_ldflags(self): | |
| return ['-laio'] | ||
|
|
||
| def is_compatible(self): | ||
| aio_libraries = ['libaio-dev'] | ||
| aio_compatible = self.libraries_installed(aio_libraries) | ||
| # Check for the existence of libaio by using distutils | ||
| # to compile and link a test program that calls io_submit, | ||
| # which is a function provided by libaio that is used in the async_io op. | ||
| # If needed, one can define -I and -L entries in CFLAGS and LDFLAGS | ||
| # respectively to specify the directories for libaio.h and libaio.so. | ||
| aio_compatible = self.has_function('io_submit', ('aio', )) | ||
| if not aio_compatible: | ||
| self.warning( | ||
| f"{self.NAME} requires the libraries: {aio_libraries} but are missing. Can be fixed by: `apt install libaio-dev`." | ||
| f"{self.NAME} requires libaio but it is missing. Can be fixed by: `apt install libaio-dev`." | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But this is incorrect. It requires some variation of Probably should say:
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess we can address it in #1250 |
||
| ) | ||
| return super().is_compatible() and aio_compatible | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ | |
| import importlib | ||
| from pathlib import Path | ||
| import subprocess | ||
| import distutils.ccompiler | ||
| from abc import ABC, abstractmethod | ||
|
|
||
| YELLOW = '\033[93m' | ||
|
|
@@ -160,6 +161,10 @@ def libraries_installed(self, libraries): | |
| valid = valid or result.wait() == 0 | ||
| return valid | ||
|
|
||
| def has_function(self, funcname, libraries): | ||
| compiler = distutils.ccompiler.new_compiler() | ||
| return compiler.has_function(funcname, libraries=libraries) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what if the user doesn't have the compiler installed? |
||
|
|
||
| def strip_empty_entries(self, args): | ||
| ''' | ||
| Drop any empty strings from the list of compile and link flags | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.