Skip to content

[cmake] check for internet connection. Fixes #8292#8520

Merged
bellenot merged 10 commits intoroot-project:masterfrom
bellenot:check-internet-connection
Jul 15, 2021
Merged

[cmake] check for internet connection. Fixes #8292#8520
bellenot merged 10 commits intoroot-project:masterfrom
bellenot:check-internet-connection

Conversation

@bellenot
Copy link
Copy Markdown
Member

@bellenot bellenot commented Jun 23, 2021

This should fix an issue with external packages requiring an internet connection when working offline.
If there is no internet connection, they are either automatically disabled or raise a FATAL_ERROR if the fail-on-missing flag is ON

This should fix an issue with external packages requiring an internet connection when working offline.
If there is no internet connection, they are either automatically disabled or raise a `FATAL_ERROR` if the `fail-on-missing` flag is `ON`
@bellenot bellenot self-assigned this Jun 23, 2021
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

message(FATAL_ERROR "No internet connection. Please check your connection, or either disable the 'builtin_gsl' option or the 'fail-on-missing' to automatically disable options requiring internet access")
else()
message(STATUS "No internet connection, disabling 'builtin_gsl' option")
set(builtin_gsl OFF CACHE BOOL "Disabled because there no internet connection" FORCE)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think "is" is missing; one should read "Disabled because there is no internet connection"
The same for all the other messages.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Indeed, thanks @pamputt !

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

Copy link
Copy Markdown
Collaborator

@oshadura oshadura left a comment

Choose a reason for hiding this comment

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

@bellenot super!!! By the way what about other exit codes? I don't remember if there is anything to take in account except of 6? Maybe just to check if exit code is 0 -> TRUE and for others is FALSE?

@bellenot
Copy link
Copy Markdown
Member Author

bellenot commented Jun 23, 2021

@oshadura Well, then I would have to really download a file (that's the only way to get 0 as return code) and then delete it if it is successful. I can do it that way if you prefer (that was my first approach) but I find it a bit too restrictive IMHO...
That was:

#---Try to download a file to check internet connection-----------------------------------------
file(DOWNLOAD https://root.cern/files/test.txt ${CMAKE_CURRENT_BINARY_DIR}/test.txt
  TIMEOUT 100 STATUS DOWNLOAD_STATUS
)
# Get the status code from the download status
list(GET DOWNLOAD_STATUS 0 STATUS_CODE)
# Check if download was successful.
if(${STATUS_CODE} EQUAL 0)
  # success: remove the file and reset the NO_CONNECTION flag
  file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test.txt)
  set(NO_CONNECTION FALSE)
else()
  # failure: set the NO_CONNECTION flag
  set(NO_CONNECTION TRUE)
endif()


#---Check for GSL library---------------------------------------------------------------
if(mathmore OR builtin_gsl)
if(builtin_gsl AND NO_CONNECTION)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

humm ... we might be missing support for the following scenario:

  • download and configure (and possibly build once) on a node that has network access
  • re-configure on the same build directory but from a node that had no network access.

This scenario should be supported as it is a means to download and build on a non-network accessible node.

I.e. we might also need to check whether the buitin has already been download before failing.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks @pcanal for the nice suggestion. i also thought that our CMake system was not complex enough... I'll try to come with something. I already spent several days with the dependencies hell, I can spend several more to try all possible combinations 😉

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@pcanal is there documentation somewhere that would explain how to do what you talk about? I may be interested by such option in some cases.
PS: I can start a message on the ROOT forum not to pollute Github with this discussion.

Copy link
Copy Markdown
Member

@Axel-Naumann Axel-Naumann Jun 23, 2021

Choose a reason for hiding this comment

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

@pcanal I think it's fine to not support this until there is demand, and keep the build system simpler. If people need to build without network we can always ask them to not use builtins. We also have way more important things to work on than a hypothetical corner case of a rare build context...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is there documentation somewhere that would explain how to do what you talk about? I

Not really. It is just: 'on machine that has access to the internet on the disk you need to build on, do a git clone and then a configuration. In some cases that is sufficient and you can continue the build on a machine that has no access to the internet, sometimes you need to do a first (successully) build on the machine with internet access.

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

CMakeLists.txt Outdated

#---Try to download a dummy (non-existing) file to check internet connection--------------------
file(DOWNLOAD https://root.cern/files/dummy.txt ${CMAKE_CURRENT_BINARY_DIR}/dummy.txt
TIMEOUT 100 STATUS DOWNLOAD_STATUS
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is that 100 seconds? I think 10 is enough :-) People might get seriously worried if their CMake just sits there for two minutes. It might also be nice to show

message(STATUS "Checking internet connectivity...")
...
if(...)
  message(STATUS "Yes")
else()
  message(STATUS "No: will not automatically download external dependencies")
endif()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@Axel-Naumann :wow: you're right, sorry, I would say that even 3 seconds would be enough... And I will add the messages, thanks for the suggestion

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-debian10-i386/cxx14.
Running on pcepsft10.dyndns.cern.ch:/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-debian10-i386/cxx14.
Running on pcepsft11.dyndns.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-debian10-i386/cxx14.
Running on pcepsft10.dyndns.cern.ch:/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-debian10-i386/cxx14.
Running on pcepsft10.dyndns.cern.ch:/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2021-07-13T16:57:45.133Z] stderr: error: could not read '.git/rebase-apply/head-name': No such file or directory

Failing tests:

@bellenot bellenot merged commit 49d0be0 into root-project:master Jul 15, 2021
pzhristov pushed a commit to alisw/root that referenced this pull request Aug 27, 2021
…project#8520)

* [cmake] check for internet connection. Fixes root-project#8292

This should fix an issue with external packages requiring an internet connection when working offline.
If there is no internet connection, they are either automatically disabled or raise a `FATAL_ERROR` if the `fail-on-missing` flag is `ON`

* Add forgotten "is" (thanks @pamputt)

* Add internet check for the forgotten 'davix' and 'ssl' options

* Change the timeout value and add information messages (thanks Axel)

* Let's download an existing file to test internet access

* Disable also clad if there is no internet connection

* Do not add the clad directory in case of no internet access

* Change the logic for clad with no internet connection

* disable clad early enough if there is no internet connection

* Disable also xrootd when disabling builtin_xrootd
@bellenot bellenot deleted the check-internet-connection branch February 7, 2022 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Installation without internet access Compilation error on redhat 8.3 / no internet

6 participants