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

CMake: TRY_RUN() invoked in cross-compiling mode #3292

Closed
bagder opened this issue Nov 20, 2018 · 10 comments

Comments

Projects
None yet
2 participants
@bagder
Copy link
Member

commented Nov 20, 2018

I did this

Build for android using the cmake build files. See #3268 and in particular this build failure.

Towards the end of the cmake run it says

-- Performing Test HAVE_POLL_FINE
CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
   HAVE_POLL_FINE_EXITCODE (advanced)
   HAVE_POLL_FINE_EXITCODE__TRYRUN_OUTPUT (advanced)
For details see C:/projects/curl/build/TryRunResults.cmake
-- Performing Test HAVE_POLL_FINE - Failed

I expected the following

The build to succeed

curl/libcurl version

git master

operating system

a build for Android on Windows

@snikulov

This comment has been minimized.

Copy link
Member

commented Jan 14, 2019

@bagder regarding this issue.
Is this really need run executable to understand that poll is present on target OS?
Aren't compilation and linking (or symbol presence) enough?

@snikulov

This comment has been minimized.

Copy link
Member

commented Jan 14, 2019

Looks like the issue is related to this
line

@bagder

This comment has been minimized.

Copy link
Member Author

commented Jan 14, 2019

The check tries to see if the poll() implementation works by running a small test, designed to detect a particular known problem with old macOS poll() implementations. Since we can't run programs for cross-compiled systems, a sensible default is probably the only thing we can do...

@snikulov

This comment has been minimized.

Copy link
Member

commented Jan 14, 2019

@bagder hmm... but according to reference I've provided this check is disabled for APPLE targets...
if(NOT APPLE) will disable this check on macOS and perform it for all others OS.
What I can suggest is add to this check additional condition something like
if(NOT APPLE AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)

@bagder

This comment has been minimized.

Copy link
Member Author

commented Jan 14, 2019

Right, now it comes back to me.

We once introduced that check in order to detect a working poll() but when macOS broke their poll again in 10.12 we gave up (configure change a34c7ce that was also done to cmake in 6aa9cfa).

It is questionable if that check is useful right now...

@snikulov

This comment has been minimized.

Copy link
Member

commented Jan 14, 2019

@bagder Anyway my proposal is the same - should remove check_c_source_runs if CMake generates for cross-compilation.
So if you've no objections I can provide PR for this.
Other checks for MacOS will not be performed since I've no Mac to check them :)

@snikulov

This comment has been minimized.

Copy link
Member

commented Jan 14, 2019

BTW, someone should enable T=cmake for os=osx on travis-ci...

@bagder

This comment has been minimized.

Copy link
Member Author

commented Jan 14, 2019

should remove check_c_source_runs if CMake generates for cross-compilation.

👍

someone should enable T=cmake for os=osx on travis-ci...

👍 See #3467 !

@snikulov

This comment has been minimized.

Copy link
Member

commented Jan 15, 2019

@bagder Going back to our discussion.
Looks like for cross-compilation poll will never be used.
Even in autoconfig HAVE_POLL_FINE will be set only if poll is able to run.
But run disabled by condition if test "x$cross_compiling" != "xyes".
Am I correct? Is it good for curl on embedded targets? Or it is not so important for client sockets?
Maybe it is better to explicitly state what to use?
For example ./configure --enable-poll --disable-select?

@bagder

This comment has been minimized.

Copy link
Member Author

commented Jan 15, 2019

Looks like for cross-compilation poll will never be used.

Yeah. I think that's a mistake but I figure it is also rarely a big deal if poll or select is used...

Maybe it is better to explicitly state what to use?
For example ./configure --enable-poll --disable-select?

For cross-compiling that would certainly help, or users have to edit lib/curl_config.h after configure ran.

@snikulov snikulov self-assigned this Jan 15, 2019

@lock lock bot locked as resolved and limited conversation to collaborators Apr 16, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.