Opened 10 months ago

Last modified 5 months ago

#64498 assigned defect

llvm-3.3/3.4 fail to build for ppc on 10.6.8 (Rosetta): Undefined symbols: "_main", referenced from: start in crt1.10.5.o

Reported by: barracuda156 Owned by: jeremyhu (Jeremy Huddleston Sequoia)
Priority: Normal Milestone:
Component: ports Version: 2.7.2
Keywords: powerpc, llvm, snowleopard, rosetta Cc:
Port: llvm-3.3, llvm-3.4

Description

:info:build llvm[4]: Compiling main.c for Release build
:info:build if  /usr/bin/gcc-4.2 -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample/tools/sample -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/llvm-3.4.2.src/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/llvm-3.4.2.src/projects/sample/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/llvm-3.4.2.src/projects/sample/tools/sample  -DNDEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Os  -fno-common   -mmacosx-version-min=10.6 -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings   -c -MMD -MP -MF "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample/tools/sample/Release/main.d.tmp" -MT "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample/tools/sample/Release/main.o" -MT "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample/tools/sample/Release/main.d" /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/llvm-3.4.2.src/projects/sample/tools/sample/main.c -o /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample/tools/sample/Release/main.o ; \
:info:build 	        then /bin/mv -f "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample/tools/sample/Release/main.d.tmp" "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample/tools/sample/Release/main.d"; else /bin/rm "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample/tools/sample/Release/main.d.tmp"; exit 1; fi
:info:build llvm[4]: Linking Release executable Sample (without symbols)
:info:build /usr/bin/g++-4.2 -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample/tools/sample -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/llvm-3.4.2.src/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/llvm-3.4.2.src/projects/sample/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/llvm-3.4.2.src/projects/sample/tools/sample  -DNDEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Os  -fno-exceptions -fno-common -Woverloaded-virtual -Wcast-qual  -Os -rdynamic -Wl,-rpath -Wl,@executable_path/../lib -L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample/Release/lib -L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/Release/lib -L/opt/local/lib -Wl,-headerpad_max_install_names -arch ppc -mmacosx-version-min=10.6  -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings    -o /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample/Release/bin/Sample  /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample/tools/sample/Release/main.o -lsample \
:info:build 	   -lz -lpthread -lffi -lcurses -lm 
:info:build collect2: ld terminated with signal 6 [Abort trap]
:info:build make[4]: *** [/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample/Release/bin/Sample] Error 1
:info:build make[4]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample/tools/sample'
:info:build make[3]: *** [all] Error 1
:info:build make[3]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample/tools'
:info:build make[2]: *** [all] Error 1
:info:build make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample'
:info:build make[1]: *** [all] Error 1
:info:build make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects'
:info:build make: *** [all] Error 1
:info:build make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build'
:info:build Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build" && /usr/bin/make -j8 -w all 
:info:build Exit code: 2
:error:build Failed to build llvm-3.4: command execution failed
:debug:build Error code: CHILDSTATUS 94895 2
:debug:build Backtrace: command execution failed
:debug:build     while executing
:debug:build "system {*}$notty {*}$callback {*}$nice $fullcmdstring"
:debug:build     invoked from within
:debug:build "command_exec -callback portprogress::target_progress_callback build"
:debug:build     (procedure "portbuild::build_main" line 8)
:debug:build     invoked from within
:debug:build "$procedure $targetname"

Attachments (3)

config.log (201.5 KB) - added by barracuda156 10 months ago.
main.log (2.9 MB) - added by barracuda156 10 months ago.
main.2.log (3.0 MB) - added by barracuda156 10 months ago.
llvm-3.3 fails identically

Change History (16)

Changed 10 months ago by barracuda156

Attachment: config.log added

Changed 10 months ago by barracuda156

Attachment: main.log added

Changed 10 months ago by barracuda156

Attachment: main.2.log added

llvm-3.3 fails identically

comment:1 Changed 10 months ago by barracuda156

Port: llvm-3.3 added

comment:2 Changed 10 months ago by barracuda156

Owner: set to jeremyhu
Status: newassigned

comment:3 Changed 10 months ago by barracuda156

UDP: The problematic file that fails is this: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.3/llvm-3.3/work/build/projects/sample/Release/bin/Sample

For now, I just built llvm-3.3 on 10.6 PPC and borrowed Sample from there. After that llvm-3.3 installed in 10.6.8 as ppc.

(Of course this is not an appropriate solution in general.)

comment:4 Changed 10 months ago by barracuda156

llvm-3.5 did build, however did not install some components into /opt/local/bin for some reason (like llvm-3.3 did).

Sergey-Fedorovs-Mac-mini:~ svacchanda$ port -v installed llvm-3.5
The following ports are currently installed:
  llvm-3.5 @3.5.2_9 (active) requested_variants='' platform='darwin 10' archs='ppc' date='2022-02-04T00:07:49+0800'

comment:5 Changed 9 months ago by barracuda156

I am trying to build llvm-3.3 and llvm-3.4 now on 10.6.8 Server (Rosetta), and in addition to the error above I get this:

Undefined symbols:   "_main", referenced from:       start in crt1.10.5.o

So replacing Sample does not help anymore.

I used Macports 2.7.2, default llvm port file, Xcode 3.2.6 and standard 10.6 SDK.

comment:6 Changed 9 months ago by barracuda156

Summary: llvm-3.4 fails to build for ppc on 10.6.8 (Rosetta)llvm-3.3/3.4 fail to build for ppc on 10.6.8 (Rosetta): Undefined symbols: "_main", referenced from: start in crt1.10.5.o
Version: 2.7.12.7.2

comment:7 Changed 9 months ago by barracuda156

Keywords: snowleopard rosetta added

comment:8 Changed 5 months ago by barracuda156

The problem remains unresolved:

llvm[4]: Linking Release executable Sample (without symbols)
/usr/bin/g++-4.2 -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample/tools/sample -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/llvm-3.4.2.src/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/llvm-3.4.2.src/projects/sample/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/llvm-3.4.2.src/projects/sample/tools/sample  -DNDEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Os  -fno-exceptions -fno-common -Woverloaded-virtual -Wcast-qual  -Os -rdynamic -Wl,-rpath -Wl,@executable_path/../lib -L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample/Release/lib -L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/Release/lib -L/opt/local/lib -Wl,-headerpad_max_install_names -arch ppc -mmacosx-version-min=10.6  -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings    -o /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample/Release/bin/Sample  /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample/tools/sample/Release/main.o -lsample \
	   -lz -lpthread -lffi -lcurses -lm 
ld: warning: in /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample/tools/sample/Release/main.o, file was built for unsupported file format which is not the architecture being linked (ppc)
ld: warning: in /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample/Release/lib/libsample.a, file was built for unsupported file format which is not the architecture being linked (ppc)
Undefined symbols:
  "_main", referenced from:
      start in crt1.10.5.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[4]: *** [/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample/Release/bin/Sample] Error 1
make[4]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample/tools/sample'
make[3]: *** [all] Error 1
make[3]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample/tools'
make[2]: *** [all] Error 1
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample'
make[1]: *** [all] Error 1
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects'
make: *** [all] Error 1

comment:9 Changed 5 months ago by kencu (Ken)

what architecture is /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample/Release/lib/libsample.a?

Presumably ppc7400?

comment:10 in reply to:  9 Changed 5 months ago by barracuda156

Replying to kencu:

what architecture is /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/llvm-3.4/work/build/projects/sample/Release/lib/libsample.a?

Presumably ppc7400?

main.o for w/e reason has built for x86, despite the triple being correctly recognized in configure as powerpc-apple-darwin. I did not check the archive, and rebuiding now with gcc10-bootstrap, which is slow. Gonna check the contents of libsample.a after the build likely fails again.

comment:11 in reply to:  9 Changed 5 months ago by barracuda156

Replying to kencu:

In fact it has built successfully now. I am not sure what exactly helped though, since I changed this in 004 patch to 10,6:

     MCObjectWriter *createObjectWriter(raw_ostream &OS) const {
       bool is64 = getPointerSize() == 8;
+      MachO::CPUSubTypePowerPC CS = MachO::CPU_SUBTYPE_POWERPC_ALL;
+
+      if (TheTriple.isOSDarwin() && !TheTriple.isMacOSXVersionLT(10,6)) {
+          CS = MachO::CPU_SUBTYPE_POWERPC_7400;
+      }
+

And used gcc10 instead of gcc-4.2.

Notably, neither was needed on 10.6 PPC – this failure has been exclusive to 10.6.8 Rosetta.

comment:12 Changed 5 months ago by kencu (Ken)

gcc-10 would not have made any difference, so it likely was that ppc7400 thing again, as I first thought, that was corrected when you adjusted the test.

I wonder why someone would ever want to use CPU_SUBTYPE_POWERPC_7400 instead of CPU_SUBTYPE_POWERPC_ALL anyway?... well, they must have had some reason.

comment:13 in reply to:  12 Changed 5 months ago by barracuda156

Replying to kencu:

gcc-10 would not have made any difference, so it likely was that ppc7400 thing again, as I first thought, that was corrected when you adjusted the test.

I wonder why someone would ever want to use CPU_SUBTYPE_POWERPC_7400 instead of CPU_SUBTYPE_POWERPC_ALL anyway?... well, they must have had some reason.

Yeah, I think you are right, it is likely that ppc7400 thing.

Note: See TracTickets for help on using tickets.