Opened 10 years ago
Closed 10 years ago
#44800 closed defect (fixed)
dmd @2.066: file was built for archive which is not the architecture being linked
Reported by: | ryandesign (Ryan Carsten Schmidt) | Owned by: | tenomoto (Takeshi Enomoto) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.3.1 |
Keywords: | haspatch | Cc: | |
Port: | dmd |
Description
dmd failed to build on the Lion buildslave:
/usr/bin/clang++ -o dmd -m32 frontend.a root.a glue.a backend.a -L/opt/local/lib -Wl,-headerpad_max_install_names -framework CoreServices ld: warning: ld: warning: ignoring file frontend.a, file was built for archive which is not the architecture being linked (i386): frontend.aignoring file glue.a, file was built for archive which is not the architecture being linked (i386): glue.a ld: warning: ignoring file backend.a, file was built for archive which is not the architecture being linked (i386): backend.a ld: warning: ignoring file root.a, file was built for archive which is not the architecture being linked (i386): root.a Undefined symbols for architecture i386: "_main", referenced from: __start in crt1.o ld: symbol(s) not found for architecture i386
The buildslaves are x86_64 machines. None of the rest of the build was done for i386, so there's no reason for the final link to be done that way. The "-m32
" does not belong in this linker invocation. This appears to come from code in osmodel.mak that incorrectly assumes the userland build architecture can be divined from the uname -m
command; it cannot; uname -m
is the kernel architecture which is not the same thing. The port should instead obey the user's requested architecture. "-arch"
flags should be added to all compiler and linker invocations. Adding a universal variant would be good too.
You can set the MODEL_FLAG build argument to override the incorrect assumptions made by osmodel.mak, but that still only gets the -arch
flags into the final link command; it still needs to be added to all the compile commands before that. The reason seems to be that posix.mak originally set CC to HOST_CC and MODEL_FLAG, but CC is overridden by the portfile; removing that override fixes that.
The attached patch fixes these issues.
Attachments (1)
Change History (2)
Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)
comment:1 Changed 10 years ago by tenomoto (Takeshi Enomoto)
Resolution: | → fixed |
---|---|
Status: | new → closed |
Thanks Ryan. Done in r124824.
proposed patch