Using gcc under poudriere

Hi,

I just started using ports-mgmt/poudriere for my port building (quite new to this as well). My project requires me to use gcc(1) to build my ports.

Here is what I would normally do on my build server:

Build gcc(1) with these options:
Code:
_OPTIONS_READ=gcc-4.8.3_2
_FILE_COMPLETE_OPTIONS_LIST=BOOTSTRAP JAVA
OPTIONS_FILE_SET+=BOOTSTRAP
OPTIONS_FILE_UNSET+=JAVA
Then make install clean.

Now edit my make.conf so that it contains:
Code:
.if !empty(.CURDIR:M/usr/ports/*) && exists(/usr/local/bin/gcc48)
CC=gcc48
CXX=g++48
CPP=cpp48
.endif

USE_GCC=4.8+
OPTIONS_UNSET=EXAMPLES
Then build any port as I normally do, like Bash, with make install clean.

This all works.

In Poudriere, I'm a little confused on what happens inside the jail. My procedure from fresh install of Poudriere:
1. build gcc with the same options above using poudriere bulk
2. edit the make.conf with the same settings above
3. build Bash using poudriere bulk and I get this error:
Code:
====>> Starting jail 101-RELEASE-default
====>> Loading MOVED
====>> Calculating ports order and dependencies
====>> Computing deps for shells/bash
====>> DEBUG: shells/bash depends on devel/binutils
====>> Computing deps for devel/binutils
====>> DEBUG: devel/binutils depends on devel/binutils
====>> Error: devel/binutils incorrectly depends on itself. Please contact maintainer of the port to fix this.
What am I missing? What is Poudriere doing when it executes "Calculating ports order and dependencies"?

Thanks for helping out a noob.
 
What's the reason, to compile gcc with poudriere? I think it's better to compile a compiler under the "actual" enviroment.
 
The reason is we have a project which depends on gcc and we would like to build and package it using Poudriere.

I thought I just had to build gcc with the built in compiler in poudriere (which builds devel/binutils and other dependencies) and then tell Poudriere to use gcc for the rest. When you do the latter, binutils is automatically a dependency for any port, including binutils itself.

When Poudriere is doing "Calculating ports order and dependencies", it fails immediately on the circular dependency. If you fire up the jail and build binutils manually, it builds fine cause it knows how to handle the circular dependency.
 
Now I am trying this with lang/gcc48:
Code:
[00:00:49] ====>> Loading MOVED
[00:00:49] ====>> Calculating ports order and dependencies
[00:00:51] ====>> Sanity checking the repository
[00:00:51] ====>> Checking packages for incremental rebuild needed
[00:00:53] ====>> Deleting stale symlinks
[00:00:53] ====>> Deleting empty directories
[00:00:53] ====>> Cleaning the build queue
[00:00:53] ====>> Recording filesystem state for prepkg... done
[00:00:54] ====>> Building 6 packages using 4 builders
[00:00:54] ====>> Starting/Cloning builders
Builds without problems.
I would say, delete the jail and make a new one.
 
Now I am also try it with the lang/gcc port:
Code:
[00:00:49] ====>> Loading MOVED
[00:00:50] ====>> Calculating ports order and dependencies
[00:00:53] ====>> Sanity checking the repository
[00:00:53] ====>> Checking packages for incremental rebuild needed
[00:00:55] ====>> Deleting stale symlinks
[00:00:55] ====>> Deleting empty directories
[00:00:55] ====>> Cleaning the build queue
[00:00:55] ====>> Recording filesystem state for prepkg... done
[00:00:56] ====>> Building 1 packages using 1 builders
[00:00:56] ====>> Starting/Cloning builders
and it works.
I think it's your jail.
 
Building lang/gcc works for me too when I have a blank make.conf.

Afterwards, I put the following in my make.conf so the rest of the ports use gcc instead of the default clang compiler:
Code:
if !empty(.CURDIR:M/usr/ports/*) && exists(/usr/local/bin/gcc48)
CC=gcc48
CXX=g++48
CPP=cpp48
.endif

USE_GCC=4.8+
OPTIONS_UNSET=EXAMPLES
Build any port now and it'll have a circulatory dependency. Example if you build shells/bash, it'll depend on devel/binutils. devel/binutils depends on devel/binutils and poudriere fails this.
 
This line won't work properly under Poudriere for a reason that may not be really apparent unless you know how it works:
Code:
if !empty(.CURDIR:M/usr/ports/*) && exists(/usr/local/bin/gcc48)
What happens is that the second condition is always false because the port providing the GCC compiler executable is not installed yet (unless the port somehow depends directly or indirectly on lang/gcc). The reason for this behaviour is that Poudriere starts a build of any port from a completely clean state with no ports installed on the build jail and only the requested dependencies get installed before the build of the port is launched.

Try with just USE_GCC=4.8+ in your make.conf(5) and see if it works properly that way.
 
With just USE_GCC in the make.conf under poudriere, I'm still getting the circulatory dependency.

I have since gotten around that. Here is my full make.conf:
Code:
USE_GCC=4.8+

OPTIONS_UNSET=EXAMPLES
DEFAULT_VERSIONS=pgsql=9.3
WITH_PGSQL_VER=93
JAVA_VENDOR=openjdk

.if ${.CURDIR:M*/lang/gcc*} || ${.CURDIR:M*/ports-mgmt/pkg*} || ${.CURDIR:M*/math/mpc*}  || ${.CURDIR:M*/devel/m4*} || ${.CURDIR:M*/devel/gmake*} || ${.CURDIR:M*/lang/perl*} || ${.CURDIR:M*/devel/binutils*} || ${.CURDIR:M*/math/gmp*} || ${.CURDIR:M*/math/mpfr*} || ${.CURDIR:M*/devel/bison*} || ${.CURDIR:M*/devel/gettext*} || ${.CURDIR:M*/print/indexinfo*}
.undef USE_GCC
.endif

I am now building a required dependency, devel/boost-libs and this is the output i'm seeing:
Code:
clang-linux.link.dll bin.v2/libs/system/build/clang-linux/release/threading-multi/libboost_system.so.1.55.0

  "g++48"   -o "bin.v2/libs/system/build/clang-linux/release/threading-multi/libboost_system.so.1.55.0" -Wl,-soname -Wl,libboost_system.so.1.55.0 -shared "bin.v2/libs/system/build/clang-linux

Clearly it is incorrect, mixing the two compilers.

My question now is, how do I properly use gcc under poudriere? What goes in make.conf?

Thanks for any help
 
Try to add USE_GCC= yes in the Makefile's port (poudriere_ports_path/devel/myport/Makefile).

Sorry for my English. Maybe I did not understand your question.
 
With just USE_GCC in the make.conf under poudriere, I'm still getting the circulatory dependency.
USE_GCC should not be used in make.conf.

My question now is, how do I properly use gcc under poudriere? What goes in make.conf?
The same stuff you'd use in /etc/make.conf can be set in /usr/local/etc/poudriere.d/make.conf see poudriere(8):
Code:
   Create optional make.conf
     You can also specify a global make.conf which will be used for all the
     jails.  Any of the following are allowed and will all be used in the
     order shown:

           /usr/local/etc/poudriere.d/make.conf
           /usr/local/etc/poudriere.d/<setname>-make.conf
           /usr/local/etc/poudriere.d/<tree>-make.conf
           /usr/local/etc/poudriere.d/<jailname>-make.conf
           /usr/local/etc/poudriere.d/<jailname>-<tree>-make.conf
           /usr/local/etc/poudriere.d/<jailname>-<setname>-make.conf
           /usr/local/etc/poudriere.d/<jailname>-<tree>-<setname>-make.conf
 
I should correct myself. I am putting all those settings inside
/usr/local/etc/poudriere.d/<jailname>-make.conf
 
Anyone have any update on this? I'm still having issues.

The general question is, how do I build ports using gcc48 under poudriere? What do i put inside /usr/local/etc/poudriere.d/<jailname>-make.conf?

Thanks
 
The reason is we have a project which depends on gcc and we would like to build and package it using Poudriere.
I seem to have missed this bit. If you have your own port for your project why don't you change the port itself to use GCC? Instead of trying to force poudriere to build everything with GCC?
 
As already noted above, put this line in your port Makefile:

Code:
USE_GCC= yes

You don't want to use global overrides in make.conf, they are bad news now that many of the ports have been converted to use the USES= compiler framework that picks up a suitable compiler based on language features requested.
 
Seems like there's a lot of confusion out there. I'll try and describe what I'm doing.

I have a software project (iI'm not the developer), which must be built with gcc. The project is not a port (yet). It has code in there to include certain libraries that must be built with gcc as well. Example, xqilla, gsoap, libgcrypt, xerces must be built with gcc and linked into the software project. The software project is compiled on a build server and will eventually be deployed on other machines to run. I'm tasked with creating the build environment and the runtime environment. I am building the ports with poudriere to create these packages so I can distribute them on multiple build machines and multiple runtime machines.

The build environment requires about 12 ports, and a whole bunch of dependencies, like 150 total. Most of those can be compiled with clang and wont affect the build. There's a handful, maybe 6, that requires building with gcc.

Another requirement is that I have to update these ports every few months. To avoid maintaining two separate lists of ports (one to be built with clang and another with gcc), I was told to build everything under gcc.

My first attempt was to use poudriere to do a bootstrap build of gcc with clang and then compile all ports with gcc. My mistake was adding USE_GCC in the make.conf, which adds gcc and binutils on the list of ports to build. Poudriere fails on a dependency check as stated in the above posts.

The thing with poudriere, as stated above, is that it starts with a clean jail everytime so by default, gcc is not installed. Without USE_GCC, it never gets installed as a dependency.

The only way I got around this is to modify poudriere to install pkg and gcc during startup before building the ports. This solves my problem so far but was hoping to not have to a better solution.

Final question: How would you create a set of packages for a build environment and runtime environment given the gcc requirements?

Thanks for reading
 
I've experienced exactly the same problem when trying a Poudriere cross-compile build for my Raspberry Pis. Two important dependency ports won't build with clang(1), but will build with lang/gcc.

The ports are devel/libatomic_ops and sysutils/lsof.

I came up with a more elegant solution to building with lang/gcc under Poudriere. You can install GCC in the master jail the Poudriere "reference" jail is created from. The solution is fully documented in a post on my blog - I'll try and answer any queries either in this thread, in the blog comments or both.

This is my first post to FreeBSD forums, so please excuse any style mistakes.
 
Back
Top