[runtime] Fix mkbundle compilation on OSX
authorAlexander Kyte <alexmkyte@gmail.com>
Mon, 1 May 2017 21:32:14 +0000 (17:32 -0400)
committerAlexander Kyte <alexmkyte@gmail.com>
Wed, 30 Aug 2017 16:52:23 +0000 (12:52 -0400)
mcs/tools/mkbundle/mkbundle.cs

index 3208f7073407bef6bb73a77187b8b141f85cbd7b..6e3a3e0de4bdda47067e661ff5053594aa27e4fb 100755 (executable)
@@ -1076,14 +1076,18 @@ void          mono_register_config_for_assembly (const char* assembly_name, cons
                                        debugging = "-ggdb";
                                if (static_link)
                                {
+                                       string platform_libs;
                                        string smonolib;
-                                       if (style == "osx")
+                                       if (style == "osx") {
                                                smonolib = "`pkg-config --variable=libdir mono-2`/libmono-2.0.a ";
-                                       else
+                                               platform_libs = "-liconv -framework Foundation ";
+                                       } else {
                                                smonolib = "-Wl,-Bstatic -lmono-2.0 -Wl,-Bdynamic ";
+                                               platform_libs = "";
+                                       }
 
                                        cmd = String.Format("{4} -o '{2}' -Wall `pkg-config --cflags mono-2` {0} {3} " +
-                                               "`pkg-config --libs-only-L mono-2` {5} {6} " +
+                                               "`pkg-config --libs-only-L mono-2` {5} {6} " + platform_libs +
                                                "`pkg-config --libs-only-l mono-2 | sed -e \"s/\\-lmono-2.0 //\"` {1} -g ",
                                                temp_c, temp_o, output, zlib, cc, smonolib, String.Join (" ", aot_paths));
                                }