Standalone GCC for build tools repository - gcc

I would like to have a tools repository structured like so:
tools
|-- gnu
| `-- gcc
| |-- 4.6.0
| `-- 4.6.2
|-- microsoft
| `-- stylecop
| `-- 4.6.2.0
...
So that every developer across the company has the same tools during the build process.
Is it possible to create a 'build jail' in this way?
I don't know how to get the GNU tool-chain into a repository this way?
Does anyone have any experience with this? I've heard of chroot build jails.
I have a requirement to build on Windows and Linux.

The Debian (and thereby Ubuntu) people have developed the excellent pbuilder package for such issues. It originally creates a tarball with a minimal Debian environment that is unpacked into a chroot, but can easily be adapted for your requirements.

Related

Run make install command in cmake from another cmake file

We have multiple libraries in different folder, The main application needs to build those libraries in other folders and install them to output folder and then the main application needs to link to libraries to build executable.
I am able to build the libraries present in other folders using add_subdirectory() in a loop, but I am not able to install them to output folder by main cmake file. Could anyone help me out on this.
The main application needs to build those libraries in other folders and install them to output folder and then the main application needs to link to libraries to build executable.
It is not necessary in CMake to install libraries in order to link to them. You can build the libraries and have your main executable link to them without installing the libraries. When you need to install your application as a whole, you can install libraries along with the executable if needed i.e. if the libraries are shared ones and not static ones.
One example of how you can organize things: assume you have the following structure in your project:
CMakeLists.txt # root of project
|
|--lib
| |--CMakeLists.txt # library subproject
|
|--app
|--CMakeLists.txt # app subproject
Then your root CMakeLists.txt can look like this:
project(MyProject)
add_subdirectory(lib)
add_subdirectory(app)
The lib subproject's CMakeLists.txt can look like this:
project(MyLib)
set(SOURCES <...>) # specify library's sources
add_library(${PROJECT_NAME} ${SOURCES})
set(MyLib ${PROJECT_NAME} CACHE INTERNAL "")
The last line in the snippet above is aimed to make MyLib variable available everywhere within the project. I found this trick here and used it successfully in my projects. Maybe there are better options here, if anyone knows them, feel free to suggest.
The app's CMakeLists.txt can then look like this:
project(MyApp)
set(SOURCES <...>) # specify app's sources
add_executable(${PROJECT_NAME} ${SOURCES})
target_link_libraries(${PROJECT_NAME} ${MyLib})
I haven't covered the installation here but it's actually straightforward: if your libraries are static ones, you only need to install the executable using install TARGETS. If your libraries are shared ones, you need to install them along with the executable.

Examples of end-to-end GoLang build pipeline

There seems to be little information around examples and best practices when building an end-to-end pipeline for a Go Lang application that can:
Calculate next version (ala semantic-release)
Run all tests
Build for the different supported platforms ((Linux, FreeBSD, Mac OS X, Windows) * (amd64, 386, arm, s390x, ppc64le))
Tag and Release in a SCM (github | gitlab | bitbucket)
Optionally create packages (deb, rpm, snaps, flatpaks, brew taps, Inno Setup).
Run this integrated in (TravisCI | CircleCI | Jenkins | Bamboo | others)
Is there any documentation, example project at this regard? I've checked some of the more famous Go projects (kubernetes, hashicorp/* and others) and they all seem to leave this part outside of the project.
I am not sure if this is what you need, but you can take a look at this one goreleaser.
GoReleaser builds Go binaries for several platforms, creates a GitHub
release and then pushes a Homebrew formula to a repository. All that
wrapped in your favorite CI.

Qt Windows Deployment Process

I am in the process of learning how to create applications using Qt. I created a small app that is running fine on any machine that has Qt installed. I want to deploy using dynamically linked Qt libraries to Windows. I followed the instructions found here and with some help of other Stackoverflow articles I was able to get the application running without error, but now nothing shows up. There should be a small UI with buttons and such, but it isn't being displayed despite the fact that Windows Task manager reveals that the application is running.
My first thought was that I was missing some dll files, but even if I copy every dll found in C:\Qt\5.5\msvc2013_64\bin, the entire C:\Qt\5.5\msvc2013_64\plugins directory, msvcp120.dll, msvcr120.dll and the plaforms\qwindows.dll to the application directory I still cannot get it to display the UI.
The same application will run on any Win x64 machine with Qt installed. I just don't find asking users to download a 700mb set of tools to run a 9kb application a very robust solution.
What step am I missing for Qt deployment to Windows?
For specifics I have made this an open source project. You can see the release version of the application built in the bin/Win_x64 directory with all .dll files that I believe are necessary to run the application. If you copy that folder onto a Win x64 machine that doesn't have Qt installed then you should be able to reproduce my error.
Edit1:
I was asked to provide the list of files in my build/Release directory:
ArkCharacterSelector.exe
ArkCharacterSelector.res
CharacterManager.obj
Logger.obj
main.obj
moc_CharacterManager.cpp
moc_CharacterManager.obj
qrc_qml.cpp
qrc_qml.obj
Here are the files that are missing from master/bin/Win_x64:
bin/Win_x64
├── QtQuick (both dirs are from qt_base_dir/qml/QtQuick)
│ ├── Controls
│ └── Window.2
├── QtQuick.2 (both files are from qt_base_dir/qml/QtQuick.2)
│ ├── qmldir
│ └── qtquick2plugin.dll
│
│ (Those are only needed for QtWebKit builds)
├── icudt53.dll
├── icuin53.dll
└── icuuc53.dll
And these files can be removed:
bin/Win_x64
└── platform
├── qwindowsd.dll (debug dll)
└── qwindowsd.pdb (only needed for debugging the debug dll)
Happy deployment!

How to configure a specific subdirectory and build out of tree?

I'm trying to build libc++ with LLVM/Clang. I'm running onto a couple of problems. First, though LLVM/Clang supports both Makefiles and Cmake, the libc++ project abandoned Makefile support. So I'm stuck with Cmake for this particular component. Second, LLVM/Clang build infrastructure does not configure libc++, so its not à la carte like I thought. So I need to turn some knobs to make things work.
Here's what the tree looks like I'm working with. Sources are under llvm (in-tree), while artifacts are under build (out-of-tree).
Working directory
|
+- build (artifacts and staging)
|
+- llvm (source tree)
|
+- tools
| |
| +- Compiler Front End (Clang)
|
+- projects
|
+- Compiler RT
|
+- libcxx
|
+- libcxx ABI
I need to run Cmake and tell it to configure what's in llvm/projects/libcxx, and tell Cmake to generate Makefiles that build and stage into the appropriate directory under build. Everything else can use Makefiles. (Its unclear to me what the "appropriate directory" is since the project's documentation does not tell me. I'll cross that bridge next, but I'd like to start with build).
I looked at the Cmake man pages, and I can't find a way to specify those simple requirements. For example, I can find ARCHIVE_OUTPUT_DIRECTORY and CMAKE_Fortran_MODDIR_FLAG, but I don't see where I can specify that everything goes to build. (Configure and Makefiles are pretty easy - I cd into the directory and run configure; or I just say make -f llvm/projects/libcxx/Makefile and things just work).
How do I tell Cmake to configure what's in llvm/projects/libcxx, and how do I tell it to generate Makefiles that specify build as the build and output directory?
You can't configure subdirectory because parent CMakeLists.txt might contain necessary configuration code for subdirectory CMakeLists.txt.
What you can do is to configure everything, but run make only for libcxx:
cd build/projects/libcxx && make
This would build libcxx and all it's dependencies, but stuff from tools, for instance, wouldn't be built.

Need help in Installing JRE?

i have to install JRE Programmability if the System does not have JRE, i had dected JRE is installed in the system or not, but i have no idea how to install JRE programmtically, some people said you can use installer, but i donot know how to use installer for this purpose i searched in sun documnet, installing JRE in slient mode, there's also i donot know how to use that command iie.fing.edu.uy/ense/asign/…
In order to run your Java program, you can do that without installing the JRE, that its, you can run the application in a computer without JRE, we do that every day.
The way is to deploy you application with an embedded JRE and use a script (.bar, .sh) to execute you application using the embedded JRE. So your application is self-contained and no requires external JRE. You need to copy the entire JRE folder into your application and start removing unused files using the test-error approach. You can also decrease the file sizes removing not needed classes, like in rt.jar (you can decompress, remove unused classes and zip again).
The problem with this approach is that you are violating the Oracle/SUN JRE distribution policy as you are distributing a JRE with fewer files. If the application is for internal use, I think it's OK, if you want to redistribute the application, you are in trouble.
Another question is how to install the JRE by code, you can try to ship the JRE with your application, using an installer detect if JRE is already installed and install it id needed. Doing that in Java code is not trivial, you can use Runtime to exec external programs...
Do not rely on JAVA_HOMEas is not actively used nowadays.
Example:
Say you application name is 'A', you folder structure can look like:
A
|-> Run.bat
|- jre
|- bin
|- lib
|- lib
|-> A.jar
You application main class is Main.java in package a. Your Run.batcan look like START "" jre\bin\javaw.exe -cp lib\A.jar a.Main
You only are calling the embedded jre in jre folder, by calling the bin\javaw.exe and passing the jar and main class. The jre folder can content and entire JRE as copied from c:\Program Files (x86)\Java\jre6\ (Windows 7).
If you can have a web based solution you can use deployjava
http://download.oracle.com/javase/6/docs/technotes/guides/jweb/deployment_advice.html

Resources