Opened 13 years ago

Closed 13 years ago

Last modified 11 years ago

#33987 closed defect (fixed)

llvm-3.0 fails to build on Tiger/ppc

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: jeremyhu (Jeremy Huddleston Sequoia)
Priority: Normal Milestone:
Component: ports Version: 2.0.4
Keywords: tiger Cc: ilia_2s@…, darylew@…, fang@…, cooljeanius (Eric Gallager)
Port: llvm-3.0

Description

Now that apple-gcc42 can be built on Tiger PowerPC, I tried building llvm-3.0, which failed with the above error.

I didn't try the other llvm versions yet but they might be similarly affected.

Attachments (1)

main.log.bz2 (39.1 KB) - added by ryandesign (Ryan Carsten Schmidt) 13 years ago.

Download all attachments as: .zip

Change History (23)

Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Attachment: main.log.bz2 added

comment:1 Changed 13 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Install ld64

comment:2 Changed 13 years ago by jeremyhu (Jeremy Huddleston Sequoia)

This is gonna be a PITA to bootstrap properly if we ever decide to support LTO on Tiger...

FWIW, I don't think clang's ppc support is quite there yet. I wouldn't expect to use it for anything other than intel.

comment:3 Changed 13 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Summary: llvm-3.0: -i argument: nstall_name must have a ':' between its symbol namesllvm ports require port:ld64 to build on Tiger

comment:4 Changed 13 years ago by jeremyhu (Jeremy Huddleston Sequoia)

This is blocked by #34006 ... it seems llvm-3.0 doesn't want to build on Tiger/ppc because it's trying to branch too far. Can you please try building llvm-2.9, or maybe we can use -Os when building llvm-3.0 (if we're not already). If llvm-2.9 works, we can use that as the default llvm for Tiger/ppc in cctools.

comment:5 Changed 13 years ago by ilia_2s@…

Same problem PPC/11.04. Any solution?

comment:6 Changed 13 years ago by ilia_2s@…

sorry, my os ver. 10.4.11

comment:7 Changed 13 years ago by ilia_2s@…

llvm-2.9 builds successfully!

comment:8 Changed 13 years ago by jeremyhu (Jeremy Huddleston Sequoia)

cctools now uses llvm-2.9 on Tiger/ppc (r92277)

I saw this issue with Leopard/ppc on llvm-3.1 which is why llvm-3.1's supported archs are intel.

I do not see this issue with Leopard/ppc on llvm-3.0.

Do you see this if you do build llvm-3.0 as:

sudo port -v install ld64 cctools
sudo port -v install llvm-3.0 configure.compiler=apple-gcc-4.2

I'm wondering if perhaps the newer linker is smarter about reordering to address this issue. That might explain why 3.0 built on Leopard.

Additionally, try changing the optimization level from -O2 to -Os

comment:9 Changed 13 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Summary: llvm ports require port:ld64 to build on Tigerllvm-3.0 fails to build on Tiger/ppc

comment:10 Changed 13 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Also, please make sure that your ld64 port is version 85 and not 62. I pushed a bunch of ld64 changes over the weekend, primarily to help out Tiger. The new version should support LTO and was considered good enough to be the default linker in the final version of XCode shipped on Leopard.

comment:11 Changed 13 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Please try this, and if it works, try removing the --disable-debug-symbols to see if it still works

Index: Portfile
===================================================================
--- Portfile	(revision 92290)
+++ Portfile	(working copy)
@@ -65,7 +65,9 @@
 if {${configure.compiler} == "gcc-4.0"} {
     configure.compiler gcc-4.2
     if {![file exists ${configure.cc}]} {
-        depends_build-append port:apple-gcc42
+        depends_build-append port:apple-gcc42 port:ld64 port:cctools
+        depends_skip_archcheck-append apple-gcc42 ld64 cctools
+
         configure.compiler apple-gcc-4.2
     }
 }
@@ -95,10 +97,18 @@
 platform darwin {
     if {${build_arch} == "i386" } {
         configure.pre_args-append --build=i686-apple-darwin${os.major}
+    } elseif {${build_arch} == "ppc" } {
+        configure.pre_args-append --build=powerpc-apple-darwin${os.major}
+    } elseif {${build_arch} == "ppc64" } {
+        configure.pre_args-append --build=powerpc64-apple-darwin${os.major}
     } else {
         configure.pre_args-append --build=${build_arch}-apple-darwin${os.major}
     }
 
+    if {[string match "*ppc*" [get_canonical_archs]]} {
+        configure.args-append --with-optimize-option=-Os --disable-debug-symbols 
+    }
+
     post-destroot {
         foreach liba [glob ${destroot}${sub_prefix}/lib/*dylib] {
             set liba_nodr [string map "${destroot} {}" ${liba}]

comment:12 Changed 13 years ago by jeremyhu (Jeremy Huddleston Sequoia)

ping ... any update on this? I don't have a ppc machine to test with, so if this is going to be fixed, you're going to need to help make this iterative loop much tighter.

comment:13 in reply to:  12 ; Changed 13 years ago by darylew@…

Replying to jeremyhu@…:

ping ... any update on this? I don't have a ppc machine to test with, so if this is going to be fixed, you're going to need to help make this iterative loop much tighter.

I've finally cleared some delays. Where is this "Portfile" located? Do I have to try installing llvm-3.0 at least once first?

comment:14 in reply to:  13 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to darylew@…:

Where is this "Portfile" located?

Its location is printed by the command:

port file llvm-3.0

Do I have to try installing llvm-3.0 at least once first?

You should patch the Portfile with the above patch, then try installing it. Jeremy, I'll do that now too.

comment:15 Changed 13 years ago by darylew@…

It worked:

[daryle]$ edit +95 `port file llvm-3.0`
[daryle]$ sudo port install llvm-3.0
Password:
--->  Computing dependencies for llvm-3.0
--->  Fetching archive for llvm-3.0
--->  Attempting to fetch llvm-3.0-3.0_4.darwin_8.ppc.tbz2 from http://packages.macports.org/llvm-3.0
--->  Fetching llvm-3.0
--->  Verifying checksum(s) for llvm-3.0
--->  Extracting llvm-3.0
--->  Applying patches to llvm-3.0
--->  Configuring llvm-3.0
--->  Building llvm-3.0
--->  Staging llvm-3.0 into destroot
--->  Installing llvm-3.0 @3.0_4
--->  Activating llvm-3.0 @3.0_4
--->  Cleaning llvm-3.0
[daryle]$ 

The altered "Portfile" has the "--disable-debug-symbols" setting on. So, do I have to uninstall LLVM before trying again without "--disable-debug-symbols"? What about installing CLang?

comment:16 in reply to:  15 ; Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ilia_2s@… darylew@… added

Replying to darylew@…:

It worked:

Great!

The altered "Portfile" has the "--disable-debug-symbols" setting on. So, do I have to uninstall LLVM before trying again without "--disable-debug-symbols"?

It would probably be enough to remove --disable-debug-symbols, then:

sudo port deactivate llvm-3.0
sudo port destroot llvm-3.0

If it fails and you want to get back to using the llvm-3.0 you already successfully built, you can then:

sudo port activate llvm-3.0

What about installing CLang?

I don't know. You could try installing it. This ticket is about the llvm-3.0 port only.

comment:17 Changed 13 years ago by jeremyhu (Jeremy Huddleston Sequoia)

clang will suffer from the same fate. Please let me know how it goes without '--disable-debug-symbols'

comment:18 in reply to:  16 Changed 13 years ago by darylew@…

Replying to ryandesign@…:

Replying to darylew@…:

The altered "Portfile" has the "--disable-debug-symbols" setting on. So, do I have to uninstall LLVM before trying again without "--disable-debug-symbols"?

It would probably be enough to remove --disable-debug-symbols, then:

sudo port deactivate llvm-3.0
sudo port destroot llvm-3.0

If it fails and you want to get back to using the llvm-3.0 you already successfully built, you can then:

sudo port activate llvm-3.0

It worked again:

--->  Cleaning llvm-3.0
[daryle]$ sudo edit `port file llvm-3.0`
Password:
[daryle]$ sudo port deactivate llvm-3.0
--->  Deactivating llvm-3.0 @3.0_4
--->  Cleaning llvm-3.0
[daryle]$ sudo port destroot llvm-3.0
--->  Computing dependencies for llvm-3.0
--->  Fetching llvm-3.0
--->  Verifying checksum(s) for llvm-3.0
--->  Extracting llvm-3.0
--->  Applying patches to llvm-3.0
--->  Configuring llvm-3.0
--->  Building llvm-3.0
--->  Staging llvm-3.0 into destroot
[daryle]$ 

Do I keep this new variant, or switch back to the old one? I guess clearing all inactive ports will purge the one I don't choose.

comment:19 in reply to:  17 Changed 13 years ago by darylew@…

Replying to jeremyhu@…:

clang will suffer from the same fate. Please let me know how it goes without '--disable-debug-symbols'

Do you want me to make the same alterations to clang's "Portfile" that LLVM got? Do you want only the variant without "--disable-debug-symbols", or do you want to try both ways?

comment:20 Changed 13 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Resolution: fixed
Status: newclosed

r92674 should work based on the information above. You should be able to just 'port selfupdate' and go from there.

Note that powerpc codegen in llvm is a bit lacking. I made some improvements which are in 3.1, but 'long double' is still not correct. Older versions would generate bad values for many floating point types. Newer versions of llvm do the correct thing for float and double and will abort() on long double rather than generating bad code.

http://llvm.org/bugs/show_bug.cgi?id=11933

comment:21 Changed 12 years ago by fang@…

Cc: fang@… added

Cc Me!

comment:22 Changed 11 years ago by cooljeanius (Eric Gallager)

Cc: egall@… added

Cc Me!

Note: See TracTickets for help on using tickets.