Protoc error in Windows - cygwin

I'm trying to compile protocol buffers code using the maven protoc plugin and a protoc executable that I built inside Cygwin. I can't do this from Cygwin or from the Windows command line. Below is the output that I get when I run it in Windows, but the error is identical when running from Cygwin. I find this strange because if the issue was with path translation then I'd expect one of them to work. Is it possible that the fact that the executable was built with Cygwin's g++ could affect things? (To state the obvious, the directory in question does exist.)
Edit: I get the same error when I take maven out of the picture and just invoke protoc by hand.
Edit 2: I can fix this by invoking protoc by hand from Cygwin using relative or absolute paths (but tilde-expansion does not work). Invoking protoc by hand from Windows using relative or absolute paths continues to give the same error.
[DEBUG] (f) outputDirectory = c:\cygwin64\home\dan\code\server\protocol\target\generated-sources\protobuf\java
[DEBUG] (f) project = MavenProject: server:protocol:1.0-SNAPSHOT # c:\cygwin64\home\dan\code\server\protocol\pom.xml
[DEBUG] (f) protoSourceRoot = c:\cygwin64\home\dan\code\server\protocol\src\main\proto
[DEBUG] (f) protocPluginDirectory = c:\cygwin64\home\dan\code\server\protocol\target\protoc-plugins
[DEBUG] (f) remoteRepositories = [
id: central
url: https://repo.maven.apache.org/maven2
layout: default snapshots: [enabled => false, update => daily]
releases: [enabled => true, update => daily]
]
[DEBUG] (f) session = org.apache.maven.execution.MavenSession#24fb6a80
[DEBUG] (f) skip = false
[DEBUG] (f) staleMillis = 0
[DEBUG] (f) temporaryProtoFileDirectory = c:\cygwin64\home\dan\code\server\protocol\target\protoc-dependencies
[DEBUG] (f) writeDescriptorSet = false
[DEBUG] -- end configuration --
[WARNING] No 'protocExecutable' parameter is configured, using the default: 'protoc'
[DEBUG] Proto source root:
[DEBUG] c:\cygwin64\home\dan\code\server\protocol\src\main\proto
[DEBUG] [PROTOC] Executable:
[DEBUG] [PROTOC] protoc
[DEBUG] [PROTOC] Protobuf import paths:
[DEBUG] [PROTOC] c:\cygwin64\home\dan\code\server\protocol\src\main\proto [DEBUG] [PROTOC] Java output directory:
[DEBUG] [PROTOC] c:\cygwin64\home\dan\code\server\protocol\target\generated-sources\protobuf\java
[DEBUG] [PROTOC] Protobuf descriptors:
[DEBUG] [PROTOC] c:\cygwin64\home\dan\code\server\protocol\src\main\proto\message.proto
[DEBUG] [PROTOC] Command line options:
[DEBUG] [PROTOC]
--proto_path=c:\cygwin64\home\dan\code\server\protocol\src\main\proto
--java_out=c:\cygwin64\home\dan\code\server\protocol\target\generated-sources\protobuf\java
c:\cygwin64\home\dan\code\server\protocol\src\main\proto\message.proto
[INFO] Compiling 1 proto file(s) to c:\cygwin64\home\dan\code\server\protocol\target\generated-sources\protobuf\java
[ERROR] PROTOC FAILED: c: warning: directory does not exist. c:\cygwin64\home\dan\code\server\protocol\src\main\proto\message.proto: File does not reside within any path specified using --proto_path (or -I). You must specify a --proto_path which encompasses this file. Note that the proto_path must be an exact prefix of the .proto file names -- protoc is too dumb to figure out when two paths (e.g. absolute and relative) are equivalent (it's harder than you think).

Executables that you build using Cygwin will depend on the full Cygwin environment and will behave as Cygwin programs, regardless of how you execute them. That is, if you execute a Cygwin program from the non-Cygwin shell, it will still behave as a Cygwin program. Cygwin programs do not accept Windows-style paths that use backslashes an drive letters; you need to use e.g. /cygdrive/c/ instead of c:\.
In general, you should not attempt to use Cygwin-compiled command-line tools from a non-Cygwin shell. Instead, try building protoc using MSVC or MinGW, or use the pre-built Windows binaries that Google provides.

Related

Terraform The system cannot find the path specified

What specific configuration or syntax changes must be made in order to resolve the The system cannot find the path specified. error that terraform is throwing when it tries to load a provider from a local mirror?
THE PROBLEM
A local file system mirror for terraform providers is re-used in an automation program.
The console prints out The system cannot find the path specified. during the third use of the same provider by the third module that tries to download the module within 2 minutes.
The first two times the same provider is requested from the same local file system mirror succeed within a couple minutes before this error is thrown.
The problem persists when the calling program sleeps 360 seconds before each request in an attempt to avoid possible locking causes. 6 minute delay does not prevent problem.
THE PROVIDER EXE FILE EXISTS
The terraform-provider-aws_v3.22.0_x5.exe provider file does indeed appear when we view it in Windows Explorer. Then, we we right click on the exe file and open the properties window, the location and file name are given as:
C:\projects\TERRAF~1\29DEC2~1\TERRAF~2\CALLS-~1\INSTAN~1\SUBNET~1\DEMO-D~1\TERRAF~1\PROVID~1\REGIST~1.IO\HASHIC~1\aws\322~1.0\WINDOW~1
Then when we run a dir command to explore the directory, we also see the following:
C:\path\to\some\directory>dir C:\projects\TERRAF~1\29DEC2~1\TERRAF~2\CALLS-~1\INSTAN~1\SUBNET~1\DEMO-D~1\TERRAF~1\PROVID~1\REGIST~1.IO\HASHIC~1\aws\322~1.0\WINDOW~1
Volume in drive C is Windows
Volume Serial Number is DAB2-5285
Directory of C:\projects\TERRAF~1\29DEC2~1\TERRAF~2\CALLS-~1\INSTAN~1\SUBNET~1\DEMO-D~1\TERRAF~1\PROVID~1\REGIST~1.IO\HASHIC~1\aws\322~1.0\WINDOW~1
12/29/2020 01:36 PM <DIR> .
12/29/2020 01:36 PM <DIR> ..
12/29/2020 01:36 PM 175,883,264 terraform-provider-aws_v3.22.0_x5.exe
1 File(s) 175,883,264 bytes
2 Dir(s) 736,395,243,520 bytes free
COMPLETE STACK TRACE
The complete TRACE output of the terraform command is as follows:
Initializing provider plugins...
- Finding latest version of hashicorp/aws...
2020/12/29 13:36:35 [TRACE] getproviders.SearchLocalDirectory: C:\path\to\terraform\providers is a symlink to C:\path\to\terraform\providers
2020/12/29 13:36:35 [TRACE] getproviders.SearchLocalDirectory: found registry.terraform.io/hashicorp/aws v3.22.0 for windows_amd64 at C:\path\to\terraform\providers\registry.terraform.io\hashicorp\aws\3.22.0\windows_amd64
2020/12/29 13:36:35 [TRACE] getproviders.SearchLocalDirectory: found registry.terraform.io/hashicorp/http v2.0.0 for windows_amd64 at C:\path\to\terraform\providers\registry.terraform.io\hashicorp\http\2.0.0\windows_amd64
2020/12/29 13:36:35 [TRACE] providercache.Dir.InstallPackage: installing registry.terraform.io/hashicorp/aws v3.22.0 from C:\path\to\terraform\providers\registry.terraform.io\hashicorp\aws\3.22.0\windows_amd64
- Installing hashicorp/aws v3.22.0...
2020/12/29 13:36:35 [TRACE] providercache.fillMetaCache: scanning directory .terraform\providers
2020/12/29 13:36:35 [TRACE] getproviders.SearchLocalDirectory: .terraform\providers is a symlink to .terraform\providers
2020/12/29 13:36:35 [TRACE] getproviders.SearchLocalDirectory: found registry.terraform.io/hashicorp/aws v3.22.0 for windows_amd64 at .terraform\providers\registry.terraform.io\hashicorp\aws\3.22.0\windows_amd64
2020/12/29 13:36:35 [TRACE] providercache.fillMetaCache: error while scanning directory .terraform\providers: cannot search .terraform\providers\registry.terraform.io\hashicorp\aws\3.22.0\windows_amd64\terraform-provider-aws_v3.22.0_x5.exe: CreateFile .terraform\providers\registry.terraform.io\hashicorp\aws\3.22.0\windows_amd64\terraform-provider-aws_v3.22.0_x5.exe: The system cannot find the path specified.
Error: Failed to install provider
#JohnHanley's SUGGESTION
Per #JohnHanley's suggestion in the comments, we reset the `` registry key to 1 and then opened a different instance of Windows CMD, navigated to the same directory, and ran the same automation program.
The program now stops at the same place as before, but this time the program hangs in definitely instead of explicitly throwing an error.
Here is the new console output up to the point where it hangs:
Initializing provider plugins...
- Finding latest version of hashicorp/aws...
2020/12/29 15:39:21 [TRACE] getproviders.SearchLocalDirectory: C:\path\to\terraform\providers is a symlink to C:\path\to\terraform\providers
2020/12/29 15:39:21 [TRACE] getproviders.SearchLocalDirectory: found registry.terraform.io/hashicorp/aws v3.22.0 for windows_amd64 at C:\path\to\terraform\providers\registry.terraform.io\hashicorp\aws\3.22.0\windows_amd64
2020/12/29 15:39:21 [TRACE] getproviders.SearchLocalDirectory: found registry.terraform.io/hashicorp/http v2.0.0 for windows_amd64 at C:\path\to\terraform\providers\registry.terraform.io\hashicorp\http\2.0.0\windows_amd64
2020/12/29 15:39:21 [TRACE] providercache.Dir.InstallPackage: installing registry.terraform.io/hashicorp/aws v3.22.0 from C:\path\to\terraform\providers\registry.terraform.io\hashicorp\aws\3.22.0\windows_amd64
- Installing hashicorp/aws v3.22.0...
The error messages indicate a MAX_PATH problem. A side issue is that the path is using the DOS namespace. The solution is to either reorganize the directory structure to shorten the path or use UNC Paths.
For the DOS namespace, applications are often coded to support a maximum length of 255 characters. For the LONG namespace the maximum length is 260 characters of which the directory portion cannot exceed MAX_PATH - 12 (248) characters. The terminating NULL consumes one character.
Enable Long Paths in Windows 10, Version 1607, and Later

./mvnw stuck at "[INFO] Scanning for projects..." on azure vm

I have cloned a jhipster porject in an Azure virtual machine and tried to lauch it using ./mvnw
However, despite working on my pc, this command does not seem to do so on this vm and remains stuck at "[INFO] Scanning for projects..." until it is killed by the vm:
$ ./mvnw
[INFO] Scanning for projects...
Killed
With -X, I get:
$ ./mvnw -X
Apache Maven 3.6.2 (...)
Maven home: /home/ecomg219/.m2/wrapper/dists/apache-maven-3.6.2-bin/795eh28tki48bv3l67maojf0ra/apache-maven-3.6.2
Java version: 11.0.4, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "5.0.0-1023-azure", arch: "amd64", family: "unix"
[DEBUG] Created new class realm maven.api
...
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for /home/ecomg219/.m2/repository
[INFO] Scanning for projects...
[DEBUG] Extension realms for project com.ecom.app:ecom:jar:0.0.1-SNAPSHOT: (none)
[DEBUG] Looking up lifecycle mappings for packaging jar from ClassRealm[plexus.core, parent: null]
[DEBUG] Resolving plugin prefix spring-boot from [org.apache.maven.plugins, org.codehaus.mojo]
Killed
Any clue about where it can come from or how to correct it is welcome.
Thanks in advance

Remote http archetypeCatalog doesn't work in Linux

I created one Maven archetype and uploaded to Nexus repository. I can generate one project based on that archetype with "mvn archetype:generate -DarchetypeCatalog=http://myhost:8080/nexus/content/repositories/my-snapshots/archetype-catalog.xml " command on Windows. The catalog xml is valid and I can open from browser manually.
Now I followed the same steps on Linux, configured the server part and repository profile in conf/setting.xml as the same content with Windows. The maven reported "No catalog defined. Using internal catalog". It seems the Maven didn't read the "-DarchetypeCatalog=...." part.
The debug log is as below. Maven version is 3.3.9. The issue reproduced on both Redhat and Ubuntu. Hope anyone can suggest a solution. Thanks.
[DEBUG] RuntimeInstance successfully initialized.
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-archetype-plugin:3.0.0:generate' with basic configurator -->
[DEBUG] (f) archetypeCatalog = http://myhost:8080/nexus/content/repositories/my-snapshots/archetype-catalog.xml
[DEBUG] (f) basedir = /opt/testmaven
[DEBUG] (f) interactiveMode = true
[DEBUG] (f) localRepository = id: local
url: file:///root/.m2/repository/
layout: default
snapshots: [enabled => true, update => always]
releases: [enabled => true, update => always]
[DEBUG] (f) remoteArtifactRepositories = [ id: my-snapshots
url: http://myhost:8080/nexus/content/repositories/my-snapshots
layout: default
snapshots: [enabled => true, update => always]
releases: [enabled => false, update => always]
, id: central
url: https://repo.maven.apache.org/maven2
layout: default
snapshots: [enabled => false, update => daily]
releases: [enabled => true, update => daily]
]
[DEBUG] (f) session = org.apache.maven.execution.MavenSession#4943defe
[DEBUG] -- end configuration --
[INFO] Generating project in Interactive mode
[INFO] No catalog defined. Using internal catalog
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
1: internal -> org.apache.maven.archetypes:maven-archetype-archetype (An archetype which contains a sample archetype.)
.......
In settings.xml, we need to configure a mirror :
<mirrors>
<mirror>
<name>Local Nexus Mirror</name>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://myhost:8080/nexus/content/groups/public</url>
</mirror>
</mirrors>
Once you’ve configured Nexus to be the mirror for all repositories, Maven will now consult the local installation of Nexus instead of going out to the central Maven repository.
If Nexus has the artifact requested, the artifact will be served from the local Nexus installation.
We can try specifying -DarchetypeCatalog=remote or -DarchetypeCatalog=local while generating the maven artifact through mvn archetype:generate.
If the archetype-cataog is available in local, we can directly use -Dcatalog=<url>

Chocolatey Installation of Visual Studio Pro 2012 is failing

I'm using Chocolatey to install Visual Studio 2012 Professional
> cinst visualstudio2012professional
In my Chocolatey logs, I'm seeing that the install succeeded.
[DEBUG] Running 'Delete-ExistingErrorLog' for VisualStudio2012Professional
[DEBUG] Looking for failure log at 'C:\Users\Chase\AppData\Local\Temp\chocolatey\VisualStudio2012Professional\failure.log'
[DEBUG] Found the failure log. Deleting it...
[DEBUG] Running 'Run-ChocolateyPS1' for VisualStudio2012Professional with packageFolder:'C:\chocolatey\lib\VisualStudio2012Professional.11.0.1', action: 'install'
[DEBUG] __ PowerShell install (chocolateyinstall.ps1) __
[DEBUG] Looking for chocolateyinstall.ps1 in folder 'C:\chocolatey\lib\VisualStudio2012Professional.11.0.1'. If chocolateyinstall.ps1 is found, it will be run.
[DEBUG] Action file is 'ChocolateyInstall.ps1'
[DEBUG] Running 'C:\chocolatey\lib\VisualStudio2012Professional.11.0.1\Tools\ChocolateyInstall.ps1'
[DEBUG] Running 'Install-ChocolateyPackage' for VisualStudio2012Professional with url:'http://go.microsoft.com/?linkid=9810233', args: '/Passive /NoRestart /AdminFile C:\chocolatey\lib\VisualStudio2012Professional.11.0.1\Tools\AdminDeployment.xml /Log C:\Users\Chase\AppData\Local\Temp\vs.log'
[DEBUG] Running 'Get-ChocolateyWebFile' for VisualStudio2012Professional with url:'http://go.microsoft.com/?linkid=9810233', fileFullPath:'C:\Users\Chase\AppData\Local\Temp\chocolatey\VisualStudio2012Professional\VisualStudio2012ProfessionalInstall.exe',and url64bit:'http://go.microsoft.com/?linkid=9810233'
[DEBUG] Processor width is 64.
Downloading VisualStudio2012Professional (http://go.microsoft.com/?linkid=9810233) to C:\Users\Chase\AppData\Local\Temp\chocolatey\VisualStudio2012Professional\VisualStudio2012ProfessionalInstall.exe
[DEBUG] Running 'Get-WebFile' for C:\Users\Chase\AppData\Local\Temp\chocolatey\VisualStudio2012Professional\VisualStudio2012ProfessionalInstall.exe with url:'http://go.microsoft.com/?linkid=9810233', userAgent: 'chocolatey command line'
[DEBUG] Setting the UserAgent to 'chocolatey command line'
[DEBUG] Running 'Install-ChocolateyInstallPackage' for VisualStudio2012Professional with file:'C:\Users\Chase\AppData\Local\Temp\chocolatey\VisualStudio2012Professional\VisualStudio2012ProfessionalInstall.exe', args: '/Passive /NoRestart /AdminFile C:\chocolatey\lib\VisualStudio2012Professional.11.0.1\Tools\AdminDeployment.xml /Log C:\Users\Chase\AppData\Local\Temp\vs.log'
Installing VisualStudio2012Professional...
[DEBUG] Running 'Start-ChocolateyProcessAsAdmin' with exeToRun:'C:\Users\Chase\AppData\Local\Temp\chocolatey\VisualStudio2012Professional\VisualStudio2012ProfessionalInstall.exe', statements: '/Passive /NoRestart /AdminFile C:\chocolatey\lib\VisualStudio2012Professional.11.0.1\Tools\AdminDeployment.xml /Log C:\Users\Chase\AppData\Local\Temp\vs.log '
Elevating Permissions and running C:\Users\Chase\AppData\Local\Temp\chocolatey\VisualStudio2012Professional\VisualStudio2012ProfessionalInstall.exe /Passive /NoRestart /AdminFile C:\chocolatey\lib\VisualStudio2012Professional.11.0.1\Tools\AdminDeployment.xml /Log C:\Users\Chase\AppData\Local\Temp\vs.log . This may take awhile, depending on the statements.
[DEBUG] Finishing 'Start-ChocolateyProcessAsAdmin'
VisualStudio2012Professional has been installed.
VisualStudio2012Professional has finished succesfully! The chocolatey gods have answered your request!
[DEBUG] Running 'Get-ChocolateyBins' for C:\chocolatey\lib\VisualStudio2012Professional.11.0.1
[DEBUG] __ Executable Links (*.exe) __
[DEBUG] Looking for executables in folder: C:\chocolatey\lib\VisualStudio2012Professional.11.0.1
Adding batch files for any executables found to a location on PATH. In other words the executable will be available from ANY command line/powershell prompt.
[DEBUG] There are no executables (that are not ignored) in the package.
[DEBUG] Evaluating NuGet output for line:
Finished installing 'visualstudio2012professional' and dependencies - if errors not shown in console, none detected. Check log for errors if unsure.
But unfortunately, Visual Studio isn't installed. The folders were created, but the IDE isn't there. (there is no DevEnv.exe)
Are there log files somewhere that are associated with the VS installer? Maybe an answer lies in there.
Hmm, I can't get the download that is used in that package to install, I am running a PS script so I am going to use this which seems to work:
$testFolder = Join-Path "${Env:ProgramFiles(x86)}" "Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe"
$alreadyInstalled = (Test-Path $testFolder)
if (!$alreadyInstalled)
{
Install-ChocolateyPackage 'VisualStudio2012Professional' 'exe' "/Full /Passive /NoRestart /Log $env:temp\vs.log" 'http://download.microsoft.com/download/D/E/8/DE8E42D8-7598-4F4E-93D4-BB011094E2F9/vs_professional.exe'
}

Gradle - won't allow maxHeapSize to be set?

task test(type: Test, overwrite: true, dependsOn: [setupUser]) {
maxHeapSize "3000m"
allJvmArgs "-Xmx3000m"
}
Error:
* What went wrong:
A problem occurred evaluating root project 'myproject'.
> Could not find method allJvmArgs() for arguments [-Xmx3000m] on root project 'myproject'.
No matter what I try, I get heap issues when I run gradle test. I'm using 1.0-milestone-9
The second line (allJvmArgs "-Xmx3000m") is incorrect syntax which explains why Gradle complains. The first line (maxHeapSize "3000m") is fine and I'd be surprised if it didn't work. "3000m" might be too high a value though and could lead to an error when creating the JVM. In any case, look for the following debug output (-d):
[DEBUG] [org.gradle.process.internal.ProcessBuilderFactory] creating process builder for Gradle Worker 1
[DEBUG] [org.gradle.process.internal.ProcessBuilderFactory] in directory /xxx
[DEBUG] [org.gradle.process.internal.ProcessBuilderFactory] with argument#0 = -Xmx300m
...
[DEBUG] [org.gradle.process.internal.DefaultExecHandle] Started Gradle Worker 1.

Resources