ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A

Ament Build with Proxy Setup

Hey Guys,

How do you get ament to bypass a proxy/firewall during the build process?

I am installing ament dependencies and I found that I keep failing when building ros2 particularly in building poco:

     timeout='600 seconds'
CMake Error at poco-1.7.7-stamp/download-poco-1.7.7.cmake:27 (message):
  error: downloading

    status_code: 7
    status_string: "Couldn't connect to server"
    log:   Trying

  connect to port 443 failed: Connection timed out


  connect to port 443 failed: Connection timed out

  Failed to connect to port 443: Connection timed out

  Closing connection 0

To help you effectively I’ll need a little more information. Can you clarify what sort of proxy/firewall you’re using? Is it a transparent proxy or are you blocked from outbound connections by a firewall and require all requests to use the proxy? If you’re firewalled, how are you configuring your machine to use the proxy?

It’s a firewall proxy, yes.

To allow the machine to use the internet, I uncommented the relevant lines in /etc/wget like so:

http_proxy =
http_proxy =
ftp_proxy =

While building with ament, it seems there is a wget instruction that is trying to run. Somehow it’s not able to route downloads through the proxy. What do you have in mind?

If you’re only changing /etc/wget (Hopefully /etc/wgetrc actually according to the docs I can see for wget) that will only effect the wget program. CMake’s ExternalProject_Add uses libcurl under the hood you you will need to set the proxy settings for curl not wget.

Curl uses the standard environment variables http_proxy and https_proxy: See here for how to set them.

1 Like

Relying only on environment variables is tricky for such things.

I remember when I built ROS for Yocto, there were so many meta-build systems involved that, at some point, the info got lost and then the download didn’t work. I believe it had to do with the way python distutils were called from catkin, or something the like. Also, some version control systems like SVN and also some dependency resolution systems like maven don’t look at the environment variables.

If possible, it would be preferable if we could have configuration variables for that directly within ament, which are filled from http_proxy and https_proxy by default. This way, they could be passed on to to the downstream tools in the proper way.

It would be great to avoid relying on the environment variables. However this is libcurl, being called by a standard CMake function from a pure CMake package. And the top searches for cmake and proxy seem to suggest that they also recommend the environment varialbe approach too. 1 2 There’s some recent traffic for making it a setting in the cmake-gui but that’s also been stated as unlikely. As far as I know there’s no standard way besides using an environment variable to use a proxy within a CMake build. It also appears to be the recommended approach to for distutils or setuptoolsin python.

When we integrate a tool that doesn’t use/respect the environment variables we should definitely make sure to pass it through appropriately but until then I don’t think we’ll want to increase the complexity and just let the environment variables pass through, and that can likely be specific to that buildsystem’s integration implementation.