#44800: dmd @2.066: file was built for archive which is not the architecture being linked --------------------------+----------------------- Reporter: ryandesign@… | Owner: takeshi@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.1 Keywords: haspatch | Port: dmd --------------------------+----------------------- 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. -- Ticket URL: <https://trac.macports.org/ticket/44800> MacPorts <http://www.macports.org/> Ports system for OS X