Skip to content
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

Make setup test for "sys/un.h" cross-compile-friendly. #979

Merged
merged 1 commit into from
Feb 2, 2017

Conversation

simias
Copy link
Contributor

@simias simias commented Feb 2, 2017

The previous test used compile_and_run but running the test binary on
the build host is not always possible, for instance when
cross-compiling. Furthermore it's not necessary in this case since a
missing "sys/un.h" header would be caught at compile time and the lack
of library support at link time.

Therefore this patch replaces compile_and_run with compile_and_forget
which builds the test program but doesn't run it. compile_and_run is
removed since it's now unused.

The previous test used compile_and_run but running the test binary on
the build host is not always possible, for instance when
cross-compiling. Furthermore it's not necessary in this case since a
missing "sys/un.h" header would be caught at compile time and the lack
of library support at link time.

Therefore this patch replaces compile_and_run with compile_and_forget
which builds the test program but doesn't run it. compile_and_run is
removed since it's now unused.
if not os.path.exists(basedir):
os.makedirs(basedir)
cfile = pjoin(basedir, os.path.basename(src))
shutil.copy(src, cfile)
try:
cc = get_compiler(compiler, **compiler_attrs)
efile = test_compilation(cfile, compiler=cc)
patch_lib_paths(efile, cc.library_dirs)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If these are a problem for cross-compiling, they should only be skipped when cross compiling. Under normal circumstances, these steps should still run.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're never needed though: you don't need to run the code to test for "sys/un.h", it's purely a compile thing.

IIRC previously compile_and_run was used to detect the ZMQ library version, but now detect_zmq calls test_compilation directly. I think this code is simply a leftover from that time, it was never needed for the sys/un test.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, thanks.

@minrk minrk merged commit b080e12 into zeromq:master Feb 2, 2017
@simias
Copy link
Contributor Author

simias commented Feb 2, 2017

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants