{"id":100,"date":"2006-07-12T13:44:20","date_gmt":"2006-07-12T17:44:20","guid":{"rendered":"http:\/\/benjamin.smedbergs.us\/blog\/2006-07-12\/pick-a-compiler-but-not-any-compiler\/"},"modified":"2006-07-12T13:45:23","modified_gmt":"2006-07-12T17:45:23","slug":"pick-a-compiler-but-not-any-compiler","status":"publish","type":"post","link":"http:\/\/benjamin.smedbergs.us\/blog\/2006-07-12\/pick-a-compiler-but-not-any-compiler\/","title":{"rendered":"Pick a Compiler, but Not Any Compiler"},"content":{"rendered":"<h3>Compiling Mozilla on Windows<\/h3>\n<p>The Mozilla build infrastructure has been switching from Visual C++ 6 to Visual Studio 2005 (VC8) on the Mozilla trunk. This has bred some confusion about which compiler should be used to build various branch(es). I&#8217;ve made a chart that will hopefully ease the confusion:<\/p>\n<p><!--more--><\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\">\n<thead>\n<tr>\n<th>Branch<\/p>\n<th>HEAD<br \/>Gecko 1.9<br \/>Firefox 3<\/p>\n<th>MOZILLA_1_8_BRANCH<br \/>Gecko 1.8.1<br \/>Firefox 2<\/p>\n<th>MOZILLA_1_8_0_BRANCH<br \/>Gecko 1.8<br \/>Firefox 1.5.0.x<\/p>\n<tbody>\n<tr>\n<th>VC6<\/p>\n<td bgcolor=\"#F00\">No<\/p>\n<td bgcolor=\"#6F6\">Yes (Official)<\/p>\n<td bgcolor=\"#6F6\">Yes (Official)<\/p>\n<tr>\n<th>VC7 (Visual Studio 2002)<\/p>\n<td bgcolor=\"#FC6\">Not really<\/p>\n<td bgcolor=\"#6F6\">Yes<\/p>\n<td bgcolor=\"#6F6\">Yes<\/p>\n<tr>\n<th>VC7.1 (Visual Studio 2003)<\/p>\n<td bgcolor=\"#6F6\">Yes<\/p>\n<td bgcolor=\"#6F6\">Yes<\/p>\n<td bgcolor=\"#6F6\">Yes<\/p>\n<tr>\n<th>VC8 (Visual Studio 2005)<\/p>\n<td bgcolor=\"#6F6\">Yes (Official)<\/p>\n<td bgcolor=\"#F00\">No<\/p>\n<td bgcolor=\"#F00\">No<br \/>\n<\/table>\n<p>If you want a single compiler to compile all the active branches, you should use VC7.1.<\/p>\n<h3>Compiling Mozilla on Linux<\/h3>\n<p>I also have some interesting developments to report in GCC-land: a large patch by Jason Merrill (RedHat) landed on GCC trunk which fixes a whole bunch of GCC visibility bugs (<a href=\"http:\/\/benjamin.smedbergs.us\/blog\/2006-03-28\/gcc-and-visibility-one-step-forward-hit-a-brick-wall\/\">previous post<\/a> about these issues). Unfortunately, Jason added some additional restrictions on the use of types with hidden visibility which means that Mozilla doesn&#8217;t even compile using GCC trunk. I&#8217;ve been in email contact with Jason and hopefully we&#8217;ll have things worked out shortly.<\/p>\n<h4>Details<\/h4>\n<p>Mozilla uses a common pattern of hidden-visibility types which are passed across DSO boundaries using default-visibility accessors:<\/p>\n<pre>\r\nclass __attribute__ ((visibility (\"hidden\"))) nsISomething : public nsISupports\r\n{\r\npublic:\r\n  NS_IMETHOD DoSomething();\r\n};\r\n\r\n__attribute__ ((visibility (\"default\"))) nsresult GetSomething(nsISomething **aResult);\r\n<\/pre>\n<p>This declaration causes a warning in GCC trunk (<tt>visibility attribute requests greater visibility than its type allows<\/tt>) and makes the GetSomething symbol hidden. Since the nsISomething interface is composed entirely of virtual functions, however, there is not a problem passing it across DSO boundaries (no symbol lookups are involved calling a virtual method).<\/p>\n<h3>Compiling Mozilla on Mac<\/h3>\n<p>I&#8217;m not going to say much about doing UB builds, other than it works and Mark Mentovai is primarily responsible&#8230; we basically do a PPC build and a Mactel build and glue them together into a UB build.<\/p>\n<p>But, now that we&#8217;re using GCC4 and MacOS10.4 on at least some Mac platforms, there are some great optimizations we can do: GCC4 on mac supports hidden visibility just like it does on Linux, which will allow us to stop exporting a whole slew of symbols. This doesn&#8217;t have the same performance benefits as it does on ELF systems, but it does make embedding a whole lot less dangerous, because you won&#8217;t accidentally be picking up symbols that weren&#8217;t meant for you.<\/p>\n<p>In addition, MacOS 10.4 added a new kind of dynamic library dependency: <tt>@loader_path\/libnspr4.dylib<\/tt>. Unlike @executable_path, which looks for shared library dependencies relative to the application being run, <tt>@loader_path<\/tt> looks for shared library dependencies relative to the library currently being loaded. This is absolutely fantastic, because it allows code to dynamically load <tt>\/Library\/Frameworks\/XUL.framework\/Versions\/<var>Whatever the latest version is<\/var>\/libxpcom.dylib<\/tt> and dependencies to <tt>libnspr4.dylib<\/tt> will be resolved automatically!<\/p>\n<p>I haven&#8217;t integrated either of these new features with the Mozilla build system yet, but I&#8217;m hoping to relatively soon.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Compiling Mozilla on Windows The Mozilla build infrastructure has been switching from Visual C++ 6 to Visual Studio 2005 (VC8) on the Mozilla trunk. This has bred some confusion about which compiler should be used to build various branch(es). I&#8217;ve made a chart that will hopefully ease the confusion:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-100","post","type-post","status-publish","format-standard","hentry","category-mozilla"],"_links":{"self":[{"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/posts\/100","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/comments?post=100"}],"version-history":[{"count":0,"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/posts\/100\/revisions"}],"wp:attachment":[{"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/media?parent=100"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/categories?post=100"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/tags?post=100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}