I try to build the Bazel C++ Build Tutorial from the Bazel homepage (Getting Started) with this command but without any connection to the internet: bazel build //main:hello-world
The Jenkins Server will not have any connection to the internet so I can't do prefetching or similar. Is there a way how to prepare my C++ project on another computer and transfer the dependencies to the Jenkins Server to do it offline? How? I would just need what I got from the following error message respectively get the tutorial running:
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
INFO: Repository rules_cc instantiated at:
/DEFAULT.WORKSPACE.SUFFIX:267:6: in <toplevel>
C:/users/XXX/_bazel_XXX/dq2p42jq/external/bazel_tools/tools/build_defs/repo/utils.bzl:201:18: in maybe
Repository rule http_archive defined at:
C:/users/XXX/_bazel_XXX/dq2p42jq/external/bazel_tools/tools/build_defs/repo/http.bzl:336:31: in <toplevel>
WARNING: Download from https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/b1c40e1de81913a3c40e5948f78719c28152486d.zip failed: class java.io.IOException Unable to tunnel through proxy. Proxy returns "HTTP/1.1 501 Not Implemented"
WARNING: Download from https://github.com/bazelbuild/rules_cc/archive/b1c40e1de81913a3c40e5948f78719c28152486d.zip failed: class java.io.IOException Unable to tunnel through proxy. Proxy returns "HTTP/1.1 501 Not Implemented"
ERROR: An error occurred during the fetch of repository 'rules_cc':
Traceback (most recent call last):
File "C:/users/XXX/_bazel_XXX/dq2p42jq/external/bazel_tools/tools/build_defs/repo/http.bzl", line 111, column 45, in _http_archive_impl
download_info = ctx.download_and_extract(
Error in download_and_extract: java.io.IOException: Error downloading [https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/b1c40e1de81913a3c40e5948f78719c28152486d.zip, https://github.com/bazelbuild/rules_cc/archive/b1c40e1de81913a3c40e5948f78719c28152486d.zip] to C:/users/XXX/_bazel_XXX/dq2p42jq/external/rules_cc/temp1363696983472254851/b1c40e1de81913a3c40e5948f78719c28152486d.zip: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 501 Not Implemented"
ERROR: Error fetching repository: Traceback (most recent call last):
File "C:/users/XXX/_bazel_XXX/dq2p42jq/external/bazel_tools/tools/build_defs/repo/http.bzl", line 111, column 45, in _http_archive_impl
download_info = ctx.download_and_extract(
Error in download_and_extract: java.io.IOException: Error downloading [https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/b1c40e1de81913a3c40e5948f78719c28152486d.zip, https://github.com/bazelbuild/rules_cc/archive/b1c40e1de81913a3c40e5948f78719c28152486d.zip] to C:/users/XXX/_bazel_XXX/dq2p42jq/external/rules_cc/temp1363696983472254851/b1c40e1de81913a3c40e5948f78719c28152486d.zip: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 501 Not Implemented"
ERROR: Skipping '//main:hello-world': no such package '#rules_cc//cc': java.io.IOException: Error downloading [https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/b1c40e1de81913a3c40e5948f78719c28152486d.zip, https://github.com/bazelbuild/rules_cc/archive/b1c40e1de81913a3c40e5948f78719c28152486d.zip] to C:/users/XXX/_bazel_XXX/dq2p42jq/external/rules_cc/temp1363696983472254851/b1c40e1de81913a3c40e5948f78719c28152486d.zip: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 501 Not Implemented"
WARNING: Target pattern parsing failed.
ERROR: no such package '#rules_cc//cc': java.io.IOException: Error downloading [https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/b1c40e1de81913a3c40e5948f78719c28152486d.zip, https://github.com/bazelbuild/rules_cc/archive/b1c40e1de81913a3c40e5948f78719c28152486d.zip] to C:/users/XXX/_bazel_XXX/dq2p42jq/external/rules_cc/temp1363696983472254851/b1c40e1de81913a3c40e5948f78719c28152486d.zip: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 501 Not Implemented"
INFO: Elapsed time: 30.974s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
currently loading: main
Update:
I tried prefetching and it doesn't work. What I did:
run bazel fetch //...
Copy the prefetched data from bazel info output_base directory from local to jenkins server (I had to recreate one sym link to the install dir).
I run bazel build --fetch=false //main:hello-world on jenkins without refatching. Now I get following error:
Loading:
Loading: 0 packages loaded
WARNING: /DEFAULT.WORKSPACE:1:17: External repository 'bazel_tools' is not up-to-date and fetching is disabled. To update, run the build without the '--nofetch' command line option.
ERROR: error loading package '': Every .bzl file must have a corresponding package, but '#bazel_tools//tools/build_defs/repo:http.bzl' does not have one. Please create a BUILD file in the same or any parent directory. Note that this BUILD file does not need to do anything except exist.
INFO: Elapsed time: 0.298s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
I found one solution for offline building a simple C++ projects with bazel.
First you have to download the rules_cc and rules_java libs, because these where the external dependent libs in the simple Bazel C++ tutorial project. I found no release for rules_cc so I downloaded the zip file from the url which was mentioned in the error message on the console when I was trying to use bazel build offline: https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/b1c40e1de81913a3c40e5948f78719c28152486d.zip. The sha key was also mentioned in the error message when you try to use the lib locally with a wrong sha key (see below). The rules_java lib can be downloaded here: https://github.com/bazelbuild/rules_java/releases. The WORKSPACE specification is also mentioned there.
Then you have to add the following to your WORKSPACE file. Be aware, that you have to point to your local copy of the archive files for rules_cc and rules_java. And for rules_cc you have to mention in strip_prefix the root path of the archive file (the first and only root directory in the .zip file). The rules_java has no root directory:
load("#bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_cc",
urls = ["file:C:/tmp/b1c40e1de81913a3c40e5948f78719c28152486d.zip"],
strip_prefix = "rules_cc-b1c40e1de81913a3c40e5948f78719c28152486d",
sha256 = "d0c573b94a6ef20ef6ff20154a23d0efcb409fb0e1ff0979cec318dfe42f0cdd",
)
http_archive(
name = "rules_java",
url = "file:C:/tmp/rules_java-4.0.0.tar.gz",
sha256 = "34b41ec683e67253043ab1a3d1e8b7c61e4e8edefbcad485381328c934d072fe",
)
You can run bazel fetch //... to fetch data locally on the machine, which has access to the internet. Then you can just copy prefetched data: from bazel info output_base directory on your local PC to bazel info output_base in the jenkins job.
Related
In our organization, we use conan for our c++ package management. We have our local artifactory server which is acting as our remote for day-to-day usage. When we use a new package, we normally first download it from one of the global conan servers and upload it to our local server. I thought that this way we can work with stations that are not connected to the internet or that the connection is less stable there.
However, I encountered an issue with some of the packages. In specific, when I tried to use boost/1.68.0#conan/stable (that was downloaded and installed on our local artifactory server in the past) I received the following error:
ERROR: Error 403 downloading file https://dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.tar.gz
Waiting 5 seconds to retry...
ERROR: boost/1.68.0#conan/stable: Error in source() method, line 75
tools.get(url, sha256=sha256)
ConanException: Error 403 downloading file https://dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.tar.gz
After verifying that my remote is only the local artifactory server (by using conan remote list) - I have searched the dl.bintray.com in the mentioned conan package's folder. I found it in the recipe file: ~/.conan/data/boost/1.68.0/conan/stable/export/conanfile.py in the following function:
def source(self):
if tools.os_info.is_windows:
sha256 = "3b1db0b67079266c40b98329d85916e910bbadfc3db3e860c049056788d4d5cd"
extension = ".zip"
else:
sha256 = "da3411ea45622579d419bfda66f45cd0f8c32a181d84adfa936f5688388995cf"
extension = ".tar.gz"
zip_name = "%s%s" % (self.folder_name, extension)
url = "https://dl.bintray.com/boostorg/release/%s/source/%s" % (self.version, zip_name)
tools.get(url, sha256=sha256)
I thought that the location of the package & the download is managed by conan. Specifying the system to download from another hard-coded location quite miss the point for package management system - doesn't it? Is it a problem with the boost package? Am I using it wrong?
Thanks
This is mentioned that firstly I have created a react-native application using expo init ProjectName and it's run on my device what I wanted. But I am failed to make an APK file from this react native app (expo init ProjectName). This is why I wanna to create a react native using npx react-native init ProjectName and copy all the source code, app.js, package.json, and assets. After moving all the files I have used npm install --force because it's failed to install when I have used npm install. And then I have faced the error to run this code and the error is given bellow,
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1839 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
info Installing the app...
WARNING:: Please remove usages of `jcenter()` Maven repository from your build scripts and migrate your build to other Maven repositories.
This repository is deprecated and it will be shut down in the future.
See http://developer.android.com/r/tools/jcenter-end-of-service for more information.
Currently detected usages in: project ':react-native-picker_picker', project ':react-native-safe-area-context', project ':react-native-screens'
> Task :react-native-community_datetimepicker:compileDebugJavaWithJavac FAILED
66 actionable tasks: 61 executed, 5 up-to-date
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
D:\ReactNative\CovidVisa\node_modules\#react-native-community\datetimepicker\android\src\main\java\com\reactcommunity\rndatetimepicker\RNDatePickerDialogModule.java:23: error: package com.facebook.react.modul
e.annotations does not exist
import com.facebook.react.module.annotations.ReactModule;
^
D:\ReactNative\CovidVisa\node_modules\#react-native-community\datetimepicker\android\src\main\java\com\reactcommunity\rndatetimepicker\RNDatePickerDialogModule.java:31: error: cannot find symbol
#ReactModule(name = RNDatePickerDialogModule.FRAGMENT_TAG)
^
symbol: class ReactModule
D:\ReactNative\CovidVisa\node_modules\#react-native-community\datetimepicker\android\src\main\java\com\reactcommunity\rndatetimepicker\RNTimePickerDialogModule.java:13: error: package com.facebook.react.modul
e.annotations does not exist
D:\ReactNative\CovidVisa\node_modules\#react-native-community\datetimepicker\android\src\main\java\com\reactcommunity\rndatetimepicker\RNDateTimePickerPackage.java:12: error: com.reactcommunity.rndatetimepick
er.RNDateTimePickerPackage is not abstract and does not override abstract method createJSModules() in com.facebook.react.ReactPackage
public class RNDateTimePickerPackage implements ReactPackage {
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
5 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-community_datetimepicker:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 8s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Note: The error is also given on the attached file, please concern about that. Advanced Thanks!
While trying to bootstrap the Corda network getting below error.
Error: Invalid or corrupt jarfile corda.jar
Please find more details below.
root#domestic-lc:/home/POC_DomesticLC# java -jar corda-tools-network-bootstrapper-4.0.jar --dir build/nodes
Bootstrapping local test network in /home/POC_DomesticLC/build/nodes
Using corda.jar in root directory
Generating node directory for PartyB
Generating node directory for BankB
Generating node directory for Notary
Generating node directory for BankA
Generating node directory for PartyA
Nodes found in the following sub-directories: [PartyA, PartyB, BankB, BankA, Notary]
Found the following CorDapps: []
Not copying CorDapp JARs as --copy-cordapps is set to FirstRunOnly, and it looks like this network has already been bootstrapped.
Waiting for all nodes to generate their node-info files...
#### Error while generating node info file /home/POC_DomesticLC/build/nodes/PartyA/logs ####
Error: Invalid or corrupt jarfile corda.jar
#### Error while generating node info file /home/POC_DomesticLC/build/nodes/PartyB/logs ####
Error: Invalid or corrupt jarfile corda.jar
#### Error while generating node info file /home/POC_DomesticLC/build/nodes/BankA/logs ####
Error: Invalid or corrupt jarfile corda.jar
#### Error while generating node info file /home/POC_DomesticLC/build/nodes/BankB/logs ####
Error: Invalid or corrupt jarfile corda.jar
#### Error while generating node info file /home/POC_DomesticLC/build/nodes/Notary/logs ####
Error: Invalid or corrupt jarfile corda.jar
Error while generating node info file. Please check the logs in /home/POC_DomesticLC/build/nodes/PartyA/logs.
Did you get over this issue?
I've tried with bootstrap 4.0 but I didn't see any issue, so my suggestions are:
check your java version, make sure it is 1.8.171+
make sure the corda.jar (in your build /nodes/notary/corda.jar) is correct because bad network may cause the incomplete corda.jar downloaded
make sure you've got the tools from official website instead of copying from other way where the bootstrap jar file might be broken
last, as always, please try to use the latest version bootstrap: 4.3, to utilise the best Corda:
https://software.r3.com/artifactory/corda-releases/net/corda/corda-tools-network-bootstrapper/4.3/
I had a similar problem (not with that particular JAR file, but I'm using that file's name in my examples). Here's how I worked out what was wrong.
These troubleshooting steps may help others who find this issue (but not the OP as the dates show it can't be this issue).
I started by trying to validate the JAR file by inspecting its contents:
$ jar -tf corda.jar
This showed me that it was indeed invalid. In my case, I saw:
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:225)
at java.util.zip.ZipFile.<init>(ZipFile.java:155)
at java.util.zip.ZipFile.<init>(ZipFile.java:126)
at sun.tools.jar.Main.list(Main.java:1115)
at sun.tools.jar.Main.run(Main.java:293)
at sun.tools.jar.Main.main(Main.java:1288)
I then looked at the size of the file:
$ ls -alh corda.jar
In my case, it was 133 bytes, which seems a bit small for a JAR file, so I cated it and saw this:
$ cat corda.jar
501 HTTPS Required.
Use https://repo1.maven.org/maven2/
More information at https://links.sonatype.com/central/501-https-required
It turned out that my script (a Dockerfile in fact) was downloading the file with curl -o but from a URL which was no longer supported. As https://links.sonatype.com/central/501-https-required says:
Effective January 15, 2020, The Central Repository no longer supports insecure communication over plain HTTP and requires that all requests to the repository are encrypted over HTTPS.
If you're receiving this error, then you need to replace all URL references to Maven Central with their canonical HTTPS counterparts:
Replace http://repo1.maven.org/maven2/ with https://repo1.maven.org/maven2/
Replace http://repo.maven.apache.org/maven2/ with https://repo.maven.apache.org/maven2/
If for any reason your environment cannot support HTTPS, you have the option of using our dedicated insecure endpoint at http://insecure.repo1.maven.org/maven2/
For further context around the move to HTTPS, please see https://blog.sonatype.com/central-repository-moving-to-https.
This is fairly specific, but may help someone.
I have downloaded the last version of WSO2 API manager and try to run the tutorial.
When trying to build the PizzaShack sample with maven, I get this error
Downloading: http://maven.wso2.org/nexus/content/groups/wso2-public/org/apache/httpcomponents/wso2/httpclient/4.1.1-wso2v1/httpclient-4.1.1-wso2v1.pom
[INFO] BUILD FAILURE
[ERROR] Failed to execute goal on project pizza-shack-web: Could not resolve dependencies for project com.pizzashack.client.web:pizza-shack-web:war:1.0.0:
Failed to collect dependencies at org.apache.httpcomponents.wso2:httpclient:jar:4.1.1-wso2v1:
Failed to read artifact descriptor for org.apache.httpcomponents.wso2:httpclient:jar:4.1.1-wso2v1: Could not transfer artifact org.apache.httpcomponents.wso2:httpclient:pom:4.1.1-wso2v1 from/to wso2-nexus (http://maven.wso2.org/nexus/content/groups/wso2-public/): maven.wso2.org: Unknown host maven.wso2.org -> [Help 1]
Error says Unknown host maven.wso2.org
Make sure your computer has access to maven.wso2.org
I have a SUSE ES 11 SP3 Amazon EC2 instance and I need to install the php5-openssl package, but I'm getting in trouble when using "zypper install". I should have upgraded the insance infrastructure update (more details here), but I missed the deadline and I am now with a useless instance, because I can not install anything .
Whenever I use zypper install I got:
Refreshing service 'susecloud'.
Problem retrieving the repository index file for service 'susecloud':
Download (curl) error for 'http://sa-east-1-ec2-update.susecloud.net/repo/repoindex.xml?cookies=0':
Error code: Connection failed
Error message: Couldn't resolve host 'sa-east-1-ec2-update.susecloud.net'
Check if the URI is valid and accessible.
Error building the cache:
[|] Valid metadata not found at specified URL(s)
Warning: Disabling repository 'php' because of the above error.
Download (curl) error for 'http://sa-east-1-ec2-update.susecloud.net/repo/update/SLE11-SDK-SP3-Pool/sle-11-x86_64/repodata/repomd.xml':
Error code: Connection failed
Error message: Couldn't resolve host 'sa-east-1-ec2-update.susecloud.net'
Abort, retry, ignore? [a/r/i/? shows all options] (a): a
Problem retrieving files from 'SLE11-SDK-SP3-Pool'.
Download (curl) error for 'http://sa-east-1-ec2-update.susecloud.net/repo/update/SLE11-SDK-SP3-Pool/sle-11-x86_64/repodata/repomd.xml':
Error code: Connection failed
Error message: Couldn't resolve host 'sa-east-1-ec2-update.susecloud.net'
Please see the above error message for a hint.
Warning: Disabling repository 'SLE11-SDK-SP3-Pool' because of the above error.
Download (curl) error for 'http://sa-east-1-ec2-update.susecloud.net/repo/update/SLE11-SDK-SP3-Updates/sle-11-x86_64/repodata/repomd.xml':
Error code: Connection failed
Error message: Couldn't resolve host 'sa-east-1-ec2-update.susecloud.net'
If I try updating the update infrascructure I got:
Adding repository 'tmp_instance_infrastructure_upgrade' [done]
Repository 'tmp_instance_infrastructure_upgrade' successfully added
Enabled: Yes
Autorefresh: No
GPG check: Yes
URI: dir:///usr/share/instance_infrastructure_upgrade/repo
Repository 'tmp_instance_infrastructure_upgrade' priority has been set to 1.
Retrieving repository 'tmp_instance_infrastructure_upgrade' metadata [done]
Building repository 'tmp_instance_infrastructure_upgrade' cache [done]
Specified repositories have been refreshed.
Refreshing service 'susecloud'.
Problem retrieving the repository index file for service 'susecloud':
Download (curl) error for 'http://sa-east-1-ec2-update.susecloud.net/repo/repoindex.xml?cookies=0':
Error code: Connection failed
Error message: Couldn't resolve host 'sa-east-1-ec2-update.susecloud.net'
Check if the URI is valid and accessible.
Error building the cache:
[|] Valid metadata not found at specified URL(s)
Warning: Disabling repository 'php' because of the above error.
Download (curl) error for 'http://sa-east-1-ec2-update.susecloud.net/repo/update/SLE11-SDK-SP3-Pool/sle-11-x86_64/repodata/repomd.xml':
Error code: Connection failed
Error message: Couldn't resolve host 'sa-east-1-ec2-update.susecloud.net'
...
--> Updating packages failed
I tried to install each php5-openssl dependency, downloading each RPM and installing with rpm -i, but every time I resolve one dependency another appears. I also tried the suse forum (post here) but with no success until now.
So my questions are:
Is there some way to fix zypper repositories manually? Even if only to install the php5-openssl package.
Is there some way to use RPM to manage the dependencies for php5-openssl?
Is there another alternative to install php5-openssl in my suse instance?
in short:
you cannot fix these repositories; since they don't exist anymore (try browsing to http://sa-east-1-ec2-update.susecloud.net/).
rpm cannot look for dependencies because rpm does not use repositories (that's where zypper comes in). You can look for rpms on the internet, and then install the manually using rpm; but rpm won't locate the missing rpms.
Yes; as said in point 2; you can look for the rpms; download them and install them manually; or else you can even look for repositories that contain the rpms you want, and add that repository. However be careful with that; since those repositories probably aren't made for Amazon EC2. If you do this; try to find a repository as close as possible to suse 11 EC2...