Thanks for the tip. In fact, it turns out I just needed to use the 
`—disable-dtrace` option when configuring, to get rid of that linkage error, 
oops!

Here’s the successful procedure that I followed to build & install Mono 5.2 on 
my FreeBSD 11 machine, in case it’s of interest to anyone while the port is 
being updated. I’m CCing the mailing list in case this is of use to someone.

(Make sure beforehand you have installed ports/packages for mono [to 
bootstrap], gcc, and gmake.)

The following can be run as a bash script and should do the whole job.

PREFIX=“$HOME/build/mono/“ &&
VERSION=“5.2.0.215” &&
FILENAME=“mono-$VERSION.tar.bz2” &&
curl -O "https://download.mono-project.com/sources/mono/$FILENAME 
<https://download.mono-project.com/sources/mono/$FILENAME>” &&
tar -xvf “$FILENAME” &&
cd “mono-$VERSION” &&
./configure —prefix=“$PREFIX" --disable-nls --disable-dtrace --build="$(gcc 
-dumpmachine)” &&
sed -EI -e "s|#define HAVE_LOCALCHARSET_H.*|#undef HAVE_LOCALCHARSET_H|" 
eglib/config.h &&
mkdir -p “$PREFIX” &&
gmake &&
gmake install &&
echo “Mono $VERSION successfully built and installed to '$PREFIX'."

(This was inspired by the docs at 
http://www.mono-project.com/docs/compiling-mono/mac/ 
<http://www.mono-project.com/docs/compiling-mono/mac/>, but with some 
significant changes.)

Alex

> On 25 Aug 2017, at 21:00, Russell Haley <russ.ha...@gmail.com> wrote:
> 
> Prefix everything with "Russell *thinks* this is how it works but it
> could be wrong because it's from memory".
> 
> collect2: error: ld returned 1 exit status
> 
> That's a linker error. Someone, somewhere is trying to link to a lib
> directory in the "wrong" place. In FreeBSD libraries and includes
> generally need to be prefixed with /usr/local/. Check in the makefile
> in /usr/home/aj/mono/mono/metadata. Often just adding (I'm going to
> get this wrong, I know it) -I /usr/local/include to CFLAGS and -L
> /usr/local/lib to LDFLAGS fixes those kinds of problems.
> 
> 
> Good luck!
> Russ
> 
> On Fri, Aug 25, 2017 at 8:59 AM, Alexander Regueiro <alex...@me.com> wrote:
>> This is easy enough to get around, but unfortunately I then get this bug,
>> which is rather more troublesome!
>> 
>> https://bugzilla.xamarin.com/show_bug.cgi?id=29962
>> 
>> Any ideas?
>> 
>> On 25 Aug 2017, at 07:01, Russell Haley <russ.ha...@gmail.com> wrote:
>> 
>> On Thu, Aug 24, 2017 at 8:03 PM, Alexander Regueiro <alex...@me.com> wrote:
>> 
>> Hi Russ,
>> 
>> I wasn’t under the impression it was that straightforward, but will
>> certainly give it a go. Thanks.
>> 
>> 
>> I'm getting an undefined reference:
>> 
>> ../../mono/eglib/.libs/libeglib.a(libeglib_la-gunicode.o): In function
>> `monoeg_g_get_charset':
>> /usr/home/russellh/Git/mono/mono/eglib/gunicode.c:212: undefined
>> reference to `locale_charset'
>> collect2: error: ld returned 1 exit status
>> 
>> So I guess the answer is no, it's not. :)
>> 
>> Russ
>> 
>> Alex
>> 
>> On 24 Aug 2017, at 19:44, Russell Haley <russ.ha...@gmail.com> wrote:
>> 
>> Sorry for the top post.
>> 
>> Have you tried building it yourself from their git repository? If memory
>> serves, most of the changes to get mono 4 to build revolved around calling
>> gmake instead of make and correcting paths for sh and bash.  ‎If I remember,
>> the bootstrapping of the build was only for monodevelop.
>> 
>> Russ
>> 
>> Sent from my BlackBerry 10 smartphone on the Virgin Mobile network.
>> Original Message
>> From: Alexander Regueiro
>> Sent: Thursday, August 24, 2017 11:24 AM
>> To: freebsd-mono@freebsd.org
>> Subject: Re: Update on porting mono 5
>> 
>> I’ve recently seen David Naylor’s message
>> <https://lists.freebsd.org/pipermail/freebsd-mono/2017-August/002524.html
>> <https://lists.freebsd.org/pipermail/freebsd-mono/2017-August/002524.html>>
>> summarising the work towards porting Mono 5, but it seems a lot of the WIP
>> is not public at the moment. Is there any way I can access this material?
>> Ideally I’d like to get Mono 5 building on my FreeBSD machine ASAP (even if
>> it’s just a hack), since I’m a bit deadline-constrained here, so if there’s
>> any way I can help, even leaving the testing aside for now, do please let me
>> know.
>> _______________________________________________
>> freebsd-mono@freebsd.org mailing list
>> https://lists.freebsd.org/mailman/listinfo/freebsd-mono
>> To unsubscribe, send any mail to "freebsd-mono-unsubscr...@freebsd.org"
>> 
>> 
>> 

_______________________________________________
freebsd-mono@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-mono
To unsubscribe, send any mail to "freebsd-mono-unsubscr...@freebsd.org"

Reply via email to