Can I build RPMs for two different platforms on one machine? - 32bit-64bit

I currently have a Java application packaged in an RPM that gets built for 32-bit RedHat platforms, and I want to create a 64-bit RPM, which is largely just the same as the 32-bit one, but with a couple different .so files included. All the Java stuff is the same on both platforms, so it's just JNI .so's.
My question is: Is it possible to have rpmbuild on a 32-bit system generate both the 32-bit and 64-bit RPMs (from different .spec files) since it's just repackaging already-built components, or do I need to build the 64-bit RPM on a 64-bit system?
N.B. I'm not actually building anything native on the system. I'm just repackaging stuff that's already built.
... or vice versa, can I build a 32-bit one on a 64-bit system? I really would prefer just to build and package this on one system than have two separate builds run for the separate RPMs.

As Aaron stated you can build an RPM for multiple distros on the same machine (64-bit), but you have to be very careful or you can run into issues. The biggest problem I've run into is you build on RHEL 5, then you try to deploy to RHEL 6, since RHEL 6 has a different version of RPM installed, it can cause conflicts and fail to install. So in this scenario you have a few options:
Build the RPM on two machines, you've stated you don't really want to do this.
If you have the disk space, configure Mock, I've used it a ton before and it's really easy to get going as long as you have the disk space and the package spec was designed to pull in requires properly.
Personally I'd give Mock a shot, it's quite simple to set up, and will allow you to do what you want with minimal effort as long as the proper repos are available. In the event the build fails the log is pretty comprehensive regarding what the RPM build error was.

Related

installing OpenMPI or MPICH2 in MSYS2-MinGW

I want to use any of the FLOSS implementations of MPI (i.e., OpenMPI or MPICH2) with my MSYS-MinGW environment and compilers. Please consider that I'm aware of the Microsoft MPI SDK mingw64/mingw-w64-x86_64-msmpi which you may find with
pacman -Ss msmpi
and install with
pacman -S msmpi
but I want to know if I can install any of the open-source implementations. I tried searching
pacman -Ss mpi
but there are too many results to check manually, and openmpi or mpich2 search queries do not return any results. So my questions are:
are any of the FLOSS implementations of MPI shipped with MinGW or MSYS2
if not how one can install them?
P.S.1. Cygwin does have some openmpi related packages, so it is a wonder why MSYS2, AFIK being a Cygwin fork, doesn't!
P.S.2. MPICH2 binaries are available here but they are way way behind the latest builds for other platforms. That's just sad!
P.S.3. Surprise that Microsoft's MPI implementation is actually open-source! It seems to be a fork of MPICH or at least compatible with it.
MSYS2's main objective is to provide you with an environment to build native Windows applications.
As such, it's natural that it will export bindings to the native Microsoft MPI implementation, while not providing ports of other MPI implementations such as OpenMPI or MPICH which have dependencies on a full POSIX layer.
From How does MSYS2 differ from Cygwin:
MSYS2 tries to provide an environment for building native Windows software. MSYS2 provides a large collection of packages containing such software, and libraries for their development. As a large portion of the software uses GNU build tools which are tightly coupled to the unix world, this environment is also POSIX-compatible, and is in fact based on Cygwin.
Cygwin tries to bring a POSIX-compatible environment to Windows so that most software that runs on unices will build and run on Cygwin without any significant modifications. Cygwin provides a large collection of packages containing such software, and libraries for their development.
There are more details on that page on how MSYS2 leverages Cygwin and a POSIX-compatible layer mainly to offer ports of tools needed in a build environment, mainly to support POSIX-like build systems (such as autoconf, make, meson, etc.), while mainly aiming at exposing these tools to support building Windows native binaries and porting applications to run natively on Windows.

Configuring CMake to build with Xcode

I am involved in development of a large cross platform project that build for Windows, Linux, and Mac OS X. The build for the software is configured with CMake.
The CMake scripts have been designed to configure successfully for Visual Studio on Windows, and Makefiles are currently used for building on Linux and Mac OS X.
Pretty much all of the development for the project so far has been done with people working on Windows, and a little bit of work on Linux. I am interested in developing for the project using Xcode 4.6 on a Macintosh running Mac OS X 10.7, and I have encountering problems as the CMake files do not seem to configure properly for that development environment.
For non-windows platforms many custom commands have been written to try to configure things such as copying needed files or setting environments that are needed for certain operations such as running unit tests during the build process.
It seems that because Xcode is an integrated development environment simliar to Visual Studio is has this concept of a build configuration, and when software gets build output files in up in a directory path that includes that configuration concept (i.e. many build files end up in a path that ends with folder named something like Debug, Release, etc.)
CMake is supposed to have support for dealing with this build configuration concept and the mechanism utilized work well for Visual Studio. That do no seem to work for Xcode. For example our build engineers have design CMake scripts so that for Windows, many path and whatnot are configured using the CMAKE_CFG_INTDIR value which helps to qualify the build configuration.
The use of CMAKE_CFG_INTDIR is not working for Xcode as the script for Macintosh were written with Makefiles in mind which don't really have the build configuration concept. The use of CMAKE_CFG_INTDIR within custom commands used to configure things fails on the Macintosh as the value resolves to $(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME). This values are not define when the custom commands are run, so values are not set properly and build operations fail.
It is unclear what is needed so that the system can successfully configure for Xcode. Searching on the Internet so far has not yielded insight into what should be used to make sure that build configuration can be successful. What resources are available that would help in figuring out how to configure this project to build with Xcode?
If you're talking about custom commands set using add_custom_command, then you should prefer "generator expressions" to avoid issues regarding per-configuration build directories. From the docs for add_custom_command:
Arguments to COMMAND may use "generator expressions" with the syntax "$<...>". Generator expressions are evaluated during build system generation to produce information specific to each build configuration.
For example, the build directory for a target called "MyExe" could be referred to as $<TARGET_FILE_DIR:MyExe>
Generator expressions are available in a few CMake commands, not just add_custom_command.
If you have more specific problems, it's maybe worth asking further question(s) with the relevant details.

deploying a Qt application

In a nutshell, the question is: I just finished my first application using Qt Creator on a computer running under Linux Ubuntu, now how do I make this available for everyone. Now follows the more detailed version ;)
I must apologize for asking this, I am aware that this question has probably been asked many times and that there is official documentation that I can read. I am just completely new to programming and I am very confused by everything I've read so far. If you are kind enough to help, please assume I know absolutely nothing :)
Here we go: I've just finished designing my first application (a scientific program) with Qt creator on my laptop which runs under Linux Ubuntu. It works fine and I'm very proud of it ;)
Here's what my project consists of: 40 header files, 42 source files, 1 pro file, 1 qrc file, 1 html file and 7 png files. In the code, I use #include for a bunch of fairly standard Qt classes (QWidget, QTextBrowser and so forth, maybe like 40 of those).
Now I'd like to make it available to other people. For Linux and Mac users, I've figured a way to do that: I can compress the folder containing my project, tell them to install Qt on their computer, then download and extract the files on their hard disk, open a terminal in the folder and run
qmake myProject.pro
qmake
make
That seems to work fine (by the way, does it matter that this is not precisely what Qt creator does? The qmake step there is qmake-qt4 myProject.pro -r -spec linux-g++ and the make step is make -w). Now, I assume there is a solution where I don't ask them to download and install something like 200Mo of Qt material. As for Microsoft Windows users, I don't have a clue.
I would be very grateful if you could explain to me in a very concrete way what I need to do. Needless to say, I'll go for the best and easiest solution, I don't need to understand everything about deployment. Many thanks in advance!
Edit: In case that's useful : I've been using Qt Creator 2.5.0 based on Qt 4.8.1 (64 bit), I'm working on a laptop with Ubuntu 12.04 64bits
For Linux and Mac users, I would compile the software for them in 32 and 64bit formats - no-one likes compiling unknown software from source. Obviously keep the source code option for those on more unusual architectures/OSs (and provide a shell script for them that mimics the commands Qt Creator calls!). As Qt runtimes are available from package managers on just about every distro (and come pre-installed on most anyway, KDE requires them for example), by not asking them to compile from source your users will have a much smaller download (if any) and won't require them to download software from a website potentially unknown to them. Of course the best way would be to try to get your software added as a package into the major distros' repositories, but that may take some time to organise.
Compile your software for Windows users for both 32 and 64bit formats. It's generally frowned upon to ask users to download runtime libraries they potentially don't know, and put them into their system32 folder... So most applications bundle all the libraries they need with their application. Qt-based applications are no different, and so put the runtimes into the folder where the executable is. Also it is much more professional to create a proper installer, there are a few free installer applications for Windows, a web search will give you the most popular (I think I saw a thread on SO about it as well).
As you can see the platforms aren't too dissimilar, the main point I would make is: Do not force people to compile from source! The vast majority of people on Earth do not even know what compiling is, so provide for the major arrchitectures/OSs yourself.

Building QT libraries on Ubuntu Linux

I am trying to build QT libraries 4.8.2 on Ubuntu Linux by following the instruction mentioned in the documentation .
This is the second time I am trying building... I tried earlier also and when build process did not complete even after 12-13 hrs I thought something is wrong so I started from beginning.
It's been almost 24 hrs I issued make command (In the second attempt) the build process is still going on. Terminal is not showing any error either.
Does building QT libraries on Ubuntu Linux really takes this much time or I have missed something.
Building Qt takes a couple of hours even on a fast system if you only do the default non-parallel build. By default it also pulls in lots of libraries that you may not need.
So the first thing to try is make -j to do parallel builds. If that is still taking too long then try to slim down the libraries Qt generates. Do you need QtWebKit for instance? If you plan on using an embedded web browser in your application then you'll want it. If not then you can halve the time of your build. Type configure --help to see the options. Some useful ones that can reduce the build time are:
NOTE: some of the following options are no longer applicable in Qt5
-fast - Use this if you are just using Qt rather than developing Qt itself
-no-webkit - If you don't need the embedded web browser this makes a huge difference
-release - If you don't need the debug libraries then this can be quicker
-no-qt3-support - you won't need this for a new project
-nomake examples - don't build the examples
-nomake demos - don't build the demos
-no-declarative - If you're not using the QtQuick APIs then omit this
-nomake docs - don't build the documentation (this can save a lot of time)
If you're having to pay for the time in this Amazon instance then another option is to create a local Ubuntu machine (on a spare machine or in a virtual machine) and tweak the options there until you get something that works, then use that build configuration on your Amazon instance.
EDIT:
In Qt5, the project changed to use git submodules, so if you are building from a git checkout then the default behaviour is to clone all the submodules, which will add substantially to your build times if there are modules you don't need. There is a script init-repository that is part of the qt5 repository. You can use that to trim your local repository to only contain the submodules you need. So for instance:
git clone https://git.gitorious.org/qt/qt5.git
cd qt5
./init-repository --module-subset="qtbase qtdeclarative qtquick1"
configure --your-options-here
make -j
On my machine I can do a basic build of qtbase in about 10 minutes
memory requirements to compile Qt 4.7 are 1.2 Gb (mostly demanded by QWebKit link stage), if you don't have enough create an extra swap file (see https://www.centos.org/docs/5/html/5.2/Deployment_Guide/s2-swap-creating-file.html)

Packaging to use to deploy cross-platform?

On windows applications are typically packaged as MSI, on Redhat Linux as RPM, what would be a best open source packaging method that could be used to deploy applications to all platforms including different flavors of unix and windows?
Contents would include exes, unix binaries, java jar files, user data, even database scripts to be run.
(I recognize contents would vary per destination OS, ie. binaries would be different, win exe vs unix binary etc, but for example config files may be the same or in the case of java even the bytecode jars)
Key feature I'd like the packaging to support is different users and permissions for different directories, however I recognize supporting this feature multiplatform may be very difficult.
Rather than build a package that is supposed to work across all of your platforms, which is likely impossible, you should have your build system build different packages for each target platform.
With CPack (It come with CMake) you can create packages for Windows (with NSIS), Linux (rpm and deb), and OS X with "make package". CMake also simplify cross-platform building.
For a sample you can look at avogadro's CMakeLists.txt and AvoCPack.cmake
I have a client that uses IzPack to create a single installer (it's Java-based) that installs their app on Windows, OS X and Linux.
http://izpack.org/
NSIS is an open-source solution which, as far as I know is able to build installers that run on Windows and UNIX-likes alike. However, for software deployment on Windows (especially in corporate environments) MSI is the way to go and NSIS is more of a headache.
So I wouldn't advise that you try to build a single package/installer for different platforms. But rather, as RibaldEddie indicated, multiple packages: one for each platform. That also allows to restrict the contents of the package to the files relevant to each platform.
If you'd like to support packaging for multiple distributions, I'd suggest helping the packagers for those distributions out; use some sort of well-known build system for your software (GNU's autotools or something like scons or waf), and document the build, optional dependencies, and so forth pretty well.
That way, when a Debian, Ubuntu, Red Hat, SuSE, whatever, packager comes along, they'll be able to create the package for you. You can optionally include packaging templates for one or more distributions in a separate VCS tree that is available, if you'd like.
If you are looking at packaging a closed-source/proprietary application for multiple systems, you'd probably do best to package up a .tar.gz file and document the installation process for it. You'll also want to make sure that the build process used doesn't embed any path information into the application, so that it can be run in /opt, /usr, or /usr/local, which are some popular choices for third-party add-on software.
BitRock InstallBuilder allows you to create installer packages for each one of the platforms you mentioned (as well as creating RPM, DEB, packages etc. from a single project file)

Resources