Bug 211198 - devel/newtonsoft-json and Mono 4.4
Summary: devel/newtonsoft-json and Mono 4.4
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Muhammad Moinur Rahman
Depends on:
Blocks: 211004
  Show dependency treegraph
Reported: 2016-07-18 12:45 UTC by Romain Tartière
Modified: 2016-08-08 17:53 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (bofh)

Build failure log (22.34 KB, text/x-log)
2016-07-18 12:45 UTC, Romain Tartière
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Romain Tartière freebsd_committer 2016-07-18 12:45:41 UTC
Created attachment 172649 [details]
Build failure log


I am planning to update to the latest mono release available,
unfortunately, devel/newtonsoft-json does not build with the updated
lang/mono :-( 

I tried to fix or find a workaround for this but without any kind of
success and was hopping that you could give an eye to this and maybe
help for fixing it? 

The updated lang/mono port is available here:

Thank you for your feedback!
romain@ for mono@
Comment 1 Romain Tartière freebsd_committer 2016-07-25 18:10:28 UTC
Register dependency on 211004
Comment 2 Muhammad Moinur Rahman freebsd_committer 2016-07-25 18:14:48 UTC
(In reply to Romain Tartière from comment #0)

I have looked into it. It seems like the problem is with the build system I have currently. I am not into Mono much more. But so far I figured out is the problem is with this line

(cd ${WRKSRC}/Src/Newtonsoft.Json/bin/Release/Net45 && \
		${SETENV} ${MAKE_ENV} ilasm /dll /key:../../../Dynamic.snk Newtonsoft.Json.il)

Any heads up would be appreciable.
Comment 3 Carsten Larsen 2016-07-25 18:30:23 UTC
(In reply to Muhammad Moinur Rahman from comment #2)

I tried to execute the mono disassembler. It should produce some intermediate language code (like a machine specific disassembler would do):

monodis Newtonsoft.Json.dll --output=Newtonsoft.Json.il
Segmentation fault (core dumped)

The monodis source code is c and browsing through the mono revisions reveal no changes in monodis source code since current ports version (
Comment 4 commit-hook freebsd_committer 2016-07-25 20:52:43 UTC
A commit references this bug:

Author: bofh
Date: Mon Jul 25 20:52:29 UTC 2016
New revision: 419062
URL: https://svnweb.freebsd.org/changeset/ports/419062

  devel/newtonsoft-json: Update version 8.0.3=>9.0.1

  PR:		211198

Comment 5 Muhammad Moinur Rahman freebsd_committer 2016-07-25 20:53:56 UTC
newtonsoft-json has been updated to the latest 9.0.1 which compiles with the current mono version. Can you test the same please once again.
Comment 6 Sergey Brunov 2016-07-26 19:14:36 UTC
(In reply to Muhammad Moinur Rahman from comment #5)
Hello, Muhammad!

Using one of the recent versions of Mono:

$ mono --version
Mono JIT compiler version 4.4.2 (Nightly Fri Jul 22 11:28:56 UTC 2016)

The part of the output:

Build succeeded.
	 0 Warning(s)
	 0 Error(s)

Time Elapsed 00:00:02.7067850
(cd /usr/tmp/usr/ports/devel/newtonsoft-json/work/Newtonsoft.Json-9.0.1/Src/Newtonsoft.Json/bin/Release/Net45 &&  /usr/bin/env MONO_SHARED_DIR="/usr/tmp/usr/ports/devel/newtonsoft-json/work" TZ=UTC XDG_DATA_HOME=/usr/tmp/usr/ports/devel/newtonsoft-json/work  XDG_CONFIG_HOME=/usr/tmp/usr/ports/devel/newtonsoft-json/work  HOME=/usr/tmp/usr/ports/devel/newtonsoft-json/work NO_PIE=yes WITHOUT_DEBUG_FILES=yes WITHOUT_KERNEL_SYMBOLS=yes SHELL=/bin/sh NO_LINT=YES PREFIX=/usr/local  LOCALBASE=/usr/local  LIBDIR="/usr/lib"  CC="clang37" CFLAGS="-O2 -pipe  -fstack-protector -fno-strict-aliasing"  CPP="clang-cpp37" CPPFLAGS=""  LDFLAGS=" -fstack-protector" LIBS=""  CXX="clang++37" CXXFLAGS="-O2 -pipe -fstack-protector -fno-strict-aliasing "  MANPREFIX="/usr/local" BSD_INSTALL_PROGRAM="install  -s -m 555"  BSD_INSTALL_LIB="install  -s -m 444"  BSD_INSTALL_SCRIPT="install  -m 555"  BSD_INSTALL_DATA="install  -m 0644"  BSD_INSTALL_MAN="install  -m 444" monodis Newtonsoft.Json.dll --output=Newtonsoft.Json.il)
*** Signal 11

make: stopped in /usr/ports/devel/newtonsoft-json

Best regards,
Sergey Brunov.
Comment 7 Muhammad Moinur Rahman freebsd_committer 2016-07-26 19:18:34 UTC
Any Heads Up ?
Comment 8 Sergey Brunov 2016-07-31 18:56:37 UTC
(In reply to Muhammad Moinur Rahman from comment #5)
Hello, Muhammad!

The same result using Mono Stable Sun Jul 31 18:33:16 UTC 2016.

Best regards,
Sergey Brunov.
Comment 9 Romain Tartière freebsd_committer 2016-08-06 12:10:35 UTC
Muhammad, can you explain the monodis(1) / ilasm(1) commands reason?

With mono 2.6.0, monodis succeeded only to let ilasm(1) reperting the generated .il file was invalid…

However, just removing these two command seems to be okay:

I must not be undestanding correctly the build process, as what I see is:

1. xbuild(1) builds Newtonsoft.Json.dll;
2. monodis(1) "disassembles" Newtonsoft.Json.dll into Newtonsoft.Json.il;
3. ilasm(1) "assembles" Newtonsoft.Json.il into Newtonsoft.Json.dll

That's why I tried to skip steps 2 and 3… What are they required for?
Comment 10 Muhammad Moinur Rahman freebsd_committer 2016-08-06 12:59:38 UTC
(In reply to Romain Tartière from comment #9)
So far I understand xbuild doesn't create a portable version of the library or executable hence we need those two steps more. However we can try it out without those two lines and check what happens(I mean break .. :P)
Comment 11 Romain Tartière freebsd_committer 2016-08-06 13:08:33 UTC
Only devel/google-gdata seems to depend on this port, and I could build it successfuly.  I have no idea about how to check that the build ports is Okay or not.  Since you are also the maintainer of devel/google-gdata, maybe you will have an idea about what to check?

Comment 12 Muhammad Moinur Rahman freebsd_committer 2016-08-06 13:15:34 UTC
Google-gdata seems to be no more under active development due to their new API. However I can see that multimedia/banshee seems to depend on it. Let me check that out.
Comment 13 Romain Tartière freebsd_committer 2016-08-06 13:19:23 UTC
multimedia/banshee is also a dying project… :-)

I am currently rebuilding all ports depending on mono in a Jail, so banshee is included.

If everything goes well and you agree, I will remove the monodis/ilasm lines when updating lang/mono.

Comment 14 Muhammad Moinur Rahman freebsd_committer 2016-08-06 13:21:36 UTC
(In reply to Romain Tartière from comment #13)
Hi Roman .. I believe you better skip those lines and commit Mono 4.4. Rest we will take care on demand.
Comment 15 Carsten Larsen 2016-08-07 16:30:03 UTC
(In reply to Muhammad Moinur Rahman from comment #10)
Judging from the official .NET documentation portable executables (PE) is not a feature used in FreeBSD related projects.

I'd be surprised if removing them would make any difference.

Ref: https://msdn.microsoft.com/en-us/library/496e4ekx(v=vs.110).aspx
Comment 16 Muhammad Moinur Rahman freebsd_committer 2016-08-07 16:47:13 UTC
(In reply to Carsten Larsen from comment #15)
so far google-gdata and banshee works fine without those 2 lines. Hence I am removing those two lines.
Comment 17 Romain Tartière freebsd_committer 2016-08-08 17:32:25 UTC
Great, I am almost ready to commit mono

Will commit the update to devel/newtonsoft-json unless you did so before :)

Comment 18 commit-hook freebsd_committer 2016-08-08 17:53:18 UTC
A commit references this bug:

Author: romain
Date: Mon Aug  8 17:52:52 UTC 2016
New revision: 419878
URL: https://svnweb.freebsd.org/changeset/ports/419878

  Fix build with mono 4.4.

  Some assemblies have been relocated, so adjust files path to point to the
  correct location.

  PR:		211198
  Submitted by:	me
  Approved by:	bofh (maintainer)

Comment 19 Romain Tartière freebsd_committer 2016-08-08 17:53:54 UTC
Committed, thanks!