I am executing a batch file in Jenkins for building a cpp code and i have a command in between to build the executable like "g++ sourcefile.cpp -o executablefile" and it gives error 'g++' is not recognized as an internal or external command.How to Resolve this??
When Jenkins is run as a service on a Windows machine it runs under the System account, not a user account (or your account). Therefore, you need to make sure that everything you need to setup for paths (etc.) is either done for the system account or included as part of your "Windows Batch Script" in Jenkins. (I actually use this method myself for several projects.)
To test if the System Account can do the compile, you need to open a CMD prompt as the System Account. This question should help you with taht: How Do You Run CMD under System Account.
Install GCC and bintools
Set the environment variable: PATH of your system to the folder that contains gcc.exe, g++.exe
done!
Related
I am learning VSTS. I have a one-line HelloWorld.cpp file in my repository and a makefile to build this cpp file.
Firstly, I created my build definition, which is like below:
secondly, I assigned the build definition to the only available Linux hosted-agent, called "Hosted Linux (Preview)":
After these I kicked off a build but it returns error:
I then checked the capabilities of the agent. It doesn't have CMake, nor does it have compiler like gcc or clang.
I checked VSTS documentation pages about build agents, but have no clue what I should do.
The Hosted agent and Hosted VS2017 agent have CMake installed, you can use Hosted agent or Hosted VS2017 agent. You need to add the capability manually (cmake and yes), check Build:CMake Q&A.
On the other hand, regarding CMake in Hosted Linux agent, I submit a feedback here: CMake in Hosted Linux agent.
I recently created a c++ program for windows that when is launched, it reads some files that store the user configurations, if it is the first time the program runs, it store the options the user set and create the files. When I am debugging it in visual studio it works as expected.
So I proceded to create a setup for installation, I used Inno Setup. My program requiered to start at launch so I use the following code, this is from the inno website http://www.jrsoftware.org/iskb.php?startwithwindows. My problem is that when the programs start at launch these files are not read or created, but if I close the program and I launch the program using the desktop Icon it reads and creates de files.
So my question is there something in the Inno script that allows it to read the files? could be a problem with the fstream class?, could there be a code solution
Thanks in advance.
I followed Michael advice and I used the APPDATA folder with Roaming subfolder, and now the program read the config files and run as expected, thanks for the help!!.
From above comments, you say you are storing the configuration files in the same folder as the .exe, and your application is able to create the files when run from Visual Studio, but not when installed to the "Program Files (x86)" folder or C:/ root.
It sounds like you are running into UAC (User Access Control) permissions issues. The "Program Files (x86)" folder at least, and I believe C:/ (root) as well, require administrator privileges to write. This was not the case with Windows XP and older; it is with modern versions. You may be running Visual Studio as administrator and not know it, and allowing administrator privileges when you install, but the application is not then run as administrator so it cannot write to those locations.
Try running your (installed) application as administrator (right-click the file and select "Run as administrator"). If it works, there you go: you either have to run it as administrator always if you want it to be able to store configuration files in the same directory as the .exe, or else (much better solution) store your configuration files in an appropriately-named subdirectory of %APPDATA%, which the user running your application will always be able to write to without administrator privileges.
I've got a VSTS build that is trying to deploy a test agent so I can run some Selenium tests and when I get to the "Deploy TestAgent on" build step, I am getting the following error:
2017-06-22T14:29:05.6157972Z ##[warning]Task 'DownloadTestAgent' for
machine vmtest43xxx.cloudapp.net:5986's Error : System.Exception: The
process cannot access the file 'C:\TestAgent\vstf_testagent.exe'
because it is being used by another process.
Also, if setting up a local build agent is a good workaround for this, I'm all ears, but so far I have had a lot of trouble trying to set up a local test agent. This seems weird since setting up a local build agent was relatively easy up to this point. Any suggestions on how I should set up a local agent? I've been trying to follow instructions from here and here.
Thanks!
It’s easy to setup a local build agent, so try to setup a build agent:
Steps for windows:
Go to Admin page of Agent Pools (https://[account].visualstudio.com/_admin/_AgentPool)
Click Download agent button
Unzip the downloaded file
Run Command Line as Administrator
Run config.cmd
Specify collection url (https://[account].visualstudio.com), Personal Access Token etc
More information, you can refer to: Deploy an agent on Windows.
You can specify Test Agent Location (can be access from build agent machine) for Visual Studio Test Agent Deployment task to save time.
I need to run the mandatory update for ColdFusion 10 so I can apply the later updates to the server. I downloaded the file and tried the instructions listed here: Mandatory Update Instructions.
I have a singular instance, so this should be fairly straightforward. I download the file, place it in the "hf-updates" folder, and then do java -jar cf10_man_updt.jar and I get the following notice:
Graphical installers are not supported by the VM. The console mode
will be used instead...
The installer proceeds to hang and fails to complete. I then go to option #2: Silent mode. I create my properties file and then do java -jar cf10_mdt_updt.jar -i silent -f install.cfg.txt. I get the following message:
Installer User Interface Mode Not Supported
Unable to load and to prepare the installer in console or silent mode.
This one has the courtesy to actually terminate so I don't have to close the command prompt window to retry, but I'm still nowhere. Any ideas on what I can do?
Alex provided the correct answer. I had been using the JRE in my program files folder (explicitly, actually. There was no javapath to speak of in the environment variables. I shorthanded the command for the sake of brevity). I changed the command to "C:\Coldfusion10\cfusion\jre\bin\java" -jar cf10_mdt_updt.jar and the install ran successfully.
I have a Jenkins server on OS X 10.7, which polls a subversion server, builds the code and packages the app. The last step that I need to complete is deploying the app on a remote host, which is a windows share. Note that my domain account has write access to the target folder and the volume is mounted. I've tried using a shell script build step:
sudo cp "path/to/app" "/Volumes/path/to/target"
However i get a "no tty" response. I was able to run this command succesfully in Terminal, but not as a build step in Jenkins.
Does this have something to do with the user being used when starting up Jenkins? As a side note, the default user.name is jenkins and my JENKINS_HOME resides in /Users/Shared/Jenkins. I would appreciate any help as to how to achieve this.
Your immediate problem seems to be that you are running Jenkins in the background and sudo wants to input a password. Run Jenkins in the foreground with $ java -jar jenkins.war.
However, this most probably won't solve your problem as you'll be asked to enter a password when the command runs - from the terminal you started Jenkins from (presumably it's not what you want). You need to find a way to copy your files without needing root permissions. In general, it it not a good idea to rely on administrative permissions in your builds (there are exceptions, but your case is not it).