Bug 175518

Summary: lang/mono is not configured correctly when building
Product: Ports & Packages Reporter: Jack Pappas <jack.pappas>
Component: Individual Port(s)Assignee: freebsd-mono (Nobody) <mono>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Jack Pappas 2013-01-22 21:20:00 UTC
The lang/mono port (recently updated for Mono 3.0.3) isn't configured correctly before building, because it does not call the 'autogen.sh' script provided in the Mono distribution. The 'autogen.sh' script must be run _instead_ of simply calling autoconf (via GNU_CONFIGURE=yes) because it performs certain setup actions before calling libtool, then autoconf.

On a related note, I discovered this configuration issue while tweaking the main Mono configuration file to enable Mono's new 'sgen' GC. The diff attached to this PR includes a patch for configure.in which removes some configuration options which were explicitly set for FreeBSD; removing these settings allows the configure.in to auto-detect the correct settings to use for FreeBSD.

NOTE: The 'patch-configure.in' file included in the attached diff is new, so you will have to to 'svn add' it.

Fix: I have attached an SVN diff (against r310835) which:
(a) Alters the Makefile for lang/mono to correct the build-configuration issue (by calling autogen.sh instead of using autoconf).
(b) Patches configure.in so it selects the configuration options which enable Mono to be compiled using the new 'sgen' GC.

Patch attached with submission follows:
How-To-Repeat: Install the current version of Mono from the ports tree.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2013-01-23 03:04:46 UTC
Responsible Changed
From-To: freebsd-ports-bugs->mono

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Romain Tartière freebsd_committer freebsd_triage 2013-02-04 12:48:12 UTC
State Changed
From-To: open->analyzed

lang/mono does not build after applying this patch: running the autohell 
chain require some files not provided in the source tarball.  Patching 
configure directly may work.  I am compiling ATM and if the results are 
okay, I'll commit this change.
Comment 3 Jack Pappas 2013-02-04 21:05:17 UTC
Hi Romain,

According to the Mono README
(https://github.com/mono/mono/blob/master/README), the autogen.sh is only
needed when building from a snapshot; for official tarballs (like the one
used in the lang/mono port), it's not.

However, the reason I wanted to use autogen.sh was because after I'd
patched the configure.in file (and added the patch to the 'files'
directory), I found that when I ran "make install clean", the patch
wouldn't work -- Mono would still compile correctly, but it would still
use the pthread API for thread-local storage (TLS) instead of the __thread
qualifier. It was only after changing the makefile to call autogen.sh that
Mono compiled successfully and used the __thread TLS.

You said you were able to build lang/mono by just patching the configure
script -- did you also install it after building? If so, you can run "mono
-V" to see what kind of thread-local storage Mono was compiled with. If
your installation of Mono is using the __thread TLS, then let's use your
method of patching just the 'configure' file.

Regards,
Jack

-----Original Message-----
From: Romain Tarti=E8re [mailto:romain@blogreen.org]
Sent: Monday, February 04, 2013 3:18 PM
To: bug-followup@FreeBSD.org; jack.pappas@tidepowerd.com
Subject: Re: ports/175518: lang/mono is not configured correctly when
building

Hello

I could build lang/mono with just patching the configure script
(attached) and `mono --gc=3Dsgen` seems ok.

However, you say that mono is not configured correctly without running
autogen.sh.  Can you please provide more details about what is different
if you run it and if you directly use configure (assuming both are patched
to remove 'with_tls=3Dpthread') ?  Or maybe you just wanted to avoid to
patch this generated 'configure' file ?

We do this because we try to avoit to bring-in all autotools dependencies
(the port would require adding these extra dependencies to the Makefile
using:

USE_AUTOTOOLS=3D	libtool:env automake:env autoconf:env aclocal:env

).

--
Romain Tarti=E8re <romain@blogreen.org>        http://romain.blogreen.org/
pgp: 8234 9A78 E7C0 B807 0B59  80FF BA4D 1D95 5112 336F (ID: 0x5112336F)
(plain text =3Dnon-HTML=3D PGP/GPG encrypted/signed e-mail much appreciated=
)
Comment 4 Romain Tartière 2013-02-04 21:46:09 UTC
On Mon, Feb 04, 2013 at 04:05:17PM -0500, Jack Pappas wrote:
> According to the Mono README
> (https://github.com/mono/mono/blob/master/README), the autogen.sh is only
> needed when building from a snapshot; for official tarballs (like the one
> used in the lang/mono port), it's not.
> 
> However, the reason I wanted to use autogen.sh was because after I'd
> patched the configure.in file (and added the patch to the 'files'
> directory), I found that when I ran "make install clean", the patch
> wouldn't work -- Mono would still compile correctly, but it would still
> use the pthread API for thread-local storage (TLS) instead of the __thread
> qualifier. It was only after changing the makefile to call autogen.sh that
> Mono compiled successfully and used the __thread TLS.


The 'configure' script is generated by the autotools from the
'configure.in' file.  So modifying the 'configure.in' file require you
to run all the autotools chain to regenerate the 'configure' script
before continuing.  This is the reason you had to run 'autogen.sh'.

When the mono folks release a new mono tarball, they include the generated
'configure' script in it so we have to either patch 'configure.in' and re-run
the whole autotools chain, or patch the generated 'configure' which avoids us
all the mess that commes with the autotools if we have to change something
there.

> You said you were able to build lang/mono by just patching the configure
> script -- did you also install it after building? If so, you can run "mono
> -V" to see what kind of thread-local storage Mono was compiled with. If
> your installation of Mono is using the __thread TLS, then let's use your
> method of patching just the 'configure' file.


I get:

 JIT compiler version 3.0.3 (tarball Mon Feb  4 14:30:00 CET 2013)
Copyright (C) 2002-2012 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           __thread
	SIGSEGV:       normal
	Notification:  kqueue
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	LLVM:          supported, not enabled.
	GC:            Included Boehm (with typed GC and Parallel Mark)

which is what you are expecting, right ?  Then I guess I can commit this
change.

Romain

-- 
Romain Tartière <romain@blogreen.org>        http://romain.blogreen.org/
pgp: 8234 9A78 E7C0 B807 0B59  80FF BA4D 1D95 5112 336F (ID: 0x5112336F)
(plain text =non-HTML= PGP/GPG encrypted/signed e-mail much appreciated)
Comment 5 Jack Pappas 2013-02-04 21:55:19 UTC
HI Romain,

Yes, that's the output I was expecting, so you can commit the change
whenever you're ready. Thank you for the explanation about the 'configure'
script -- it does make a lot of sense for Mono to package the sources like
that now that you mention it.

Regards,
Jack

-----Original Message-----
From: Romain Tarti=E8re [mailto:romain@blogreen.org]
Sent: Monday, February 04, 2013 4:46 PM
To: Jack Pappas
Cc: bug-followup@freebsd.org
Subject: Re: ports/175518: lang/mono is not configured correctly when
building

On Mon, Feb 04, 2013 at 04:05:17PM -0500, Jack Pappas wrote:
> According to the Mono README
> (https://github.com/mono/mono/blob/master/README), the autogen.sh is
> only needed when building from a snapshot; for official tarballs (like
> the one used in the lang/mono port), it's not.
>
> However, the reason I wanted to use autogen.sh was because after I'd
> patched the configure.in file (and added the patch to the 'files'
> directory), I found that when I ran "make install clean", the patch
> wouldn't work -- Mono would still compile correctly, but it would
> still use the pthread API for thread-local storage (TLS) instead of
> the __thread qualifier. It was only after changing the makefile to
> call autogen.sh that Mono compiled successfully and used the __thread
TLS.

The 'configure' script is generated by the autotools from the
'configure.in' file.  So modifying the 'configure.in' file require you to
run all the autotools chain to regenerate the 'configure' script before
continuing.  This is the reason you had to run 'autogen.sh'.

When the mono folks release a new mono tarball, they include the generated
'configure' script in it so we have to either patch 'configure.in' and
re-run the whole autotools chain, or patch the generated 'configure' which
avoids us all the mess that commes with the autotools if we have to change
something there.

> You said you were able to build lang/mono by just patching the
> configure script -- did you also install it after building? If so, you
> can run "mono -V" to see what kind of thread-local storage Mono was
> compiled with. If your installation of Mono is using the __thread TLS,
> then let's use your method of patching just the 'configure' file.

I get:

 JIT compiler version 3.0.3 (tarball Mon Feb  4 14:30:00 CET 2013)
Copyright (C) 2002-2012 Novell, Inc, Xamarin Inc and Contributors.
www.mono-project.com
	TLS:           __thread
	SIGSEGV:       normal
	Notification:  kqueue
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug
	LLVM:          supported, not enabled.
	GC:            Included Boehm (with typed GC and Parallel Mark)

which is what you are expecting, right ?  Then I guess I can commit this
change.

Romain

--
Romain Tarti=E8re <romain@blogreen.org>        http://romain.blogreen.org/
pgp: 8234 9A78 E7C0 B807 0B59  80FF BA4D 1D95 5112 336F (ID: 0x5112336F)
(plain text =3Dnon-HTML=3D PGP/GPG encrypted/signed e-mail much appreciated=
)
Comment 6 dfilter service freebsd_committer freebsd_triage 2013-02-04 21:58:04 UTC
Author: romain
Date: Mon Feb  4 21:57:56 2013
New Revision: 311650
URL: http://svnweb.freebsd.org/changeset/ports/311650

Log:
  Enable sgen.
  
  PR:		ports/175518
  Submitted by:	Jack Pappas <jack.pappas@tidepowerd.com>

Added:
  head/lang/mono/files/patch-configure   (contents, props changed)
Modified:
  head/lang/mono/Makefile

Modified: head/lang/mono/Makefile
==============================================================================
--- head/lang/mono/Makefile	Mon Feb  4 21:53:59 2013	(r311649)
+++ head/lang/mono/Makefile	Mon Feb  4 21:57:56 2013	(r311650)
@@ -3,6 +3,7 @@
 
 PORTNAME=	mono
 PORTVERSION=	3.0.3
+PORTREVISION=	1
 CATEGORIES=	lang
 MASTER_SITES=	http://download.mono-project.com/sources/${PORTNAME}/
 

Added: head/lang/mono/files/patch-configure
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lang/mono/files/patch-configure	Mon Feb  4 21:57:56 2013	(r311650)
@@ -0,0 +1,16 @@
+
+$FreeBSD$
+
+--- configure.orig
++++ configure
+@@ -3995,10 +3995,6 @@
+ 		libgc_threads=pthreads
+ 		# This doesn't seem to work as of 7.0 on amd64
+ 		with_sigaltstack=no
+-# TLS is only partially implemented on -CURRENT (compiler support
+-# but NOT library support)
+-#
+-		with_tls=pthread
+ 		use_sigposix=yes
+ 		;;
+ 	*-*-*openbsd*)
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 7 Romain Tartière freebsd_committer freebsd_triage 2013-02-04 21:58:21 UTC
State Changed
From-To: analyzed->closed

Committed, with minor changes. Thanks!