Windows compiler doesn't call CLANG to assemble compiled *.s files when target is i386-darwin
Original Reporter info from Mantis: Sergey Bychkow @sergey.bychkow
-
Reporter name: Sergey Bychkow
Original Reporter info from Mantis: Sergey Bychkow @sergey.bychkow
- Reporter name: Sergey Bychkow
Description:
(I use Lazarus as IDE, but my project isn't bound to LCL) When main OS is Windows, and selected target is i386-darwin fpc (ppc386) creates *.s files in lib/i386-darwin but doesn't try to call clang, even if it's installed. So latter linker should fail because there are no *.o files to link.
Nothing is in fpcdebug.txt about this. I see that when I run this on Mac clang was successfully called and created *.o files.
Steps to reproduce:
I assume that FPC for Win32 was already installed, for example with Lazarus, in C:\lazarus\fpc, and FPC for macosx is installed on Mac, or you have fpc*.dmg downloaded and you can extract files from it.
- copy compiled unit files from Mac /usr/local/lib/fpc/3.0.4/units/i386-darwin to C:\lazarus\fpc\3.0.4\units\i386-darwin. You could also use 3.3.1 version of FPC and units. Result is the same, but you should compile it first on Mac and Windows.
- create simple console "hello world" project in Lazarus
- select target OS: Darwin
- select target CPU: i386
- Add -vv to custom options
- Copy some linker to C:\lazarus\fpc\3.0.4\bin\i386-darwin\ and rename it to "i386-darwin-ld.exe". This can be any file suitable for you: zero-sized exe file, or ld64.lld.exe from Clang/LLVM, or ld.exe from Delphi/BDS. It doesn't matter at this moment.
- try to compile
The result is that Lazarus shows successful compilation, *.s files are created in lib/i386-darwin, clang wasn't called, and no *.o files created.
Additional information:
It's not important for this issue that files generated for external linking are not compatible with any linker available. I will report another issue about that.
There is an option for FPC, -Amacho, that tries to make object files for i386-darwin without external assembler. It looks broken because however I sucessfully linked resulting *.o files to executable, it makes SEGFAULT on run. This is another issue, if -Amacho option is still supported.
Assembler files can be manually assembled by command: "C:\Program Files\LLVM\bin\clang.exe" -c --target=i386-apple-macosx10.4.0 *.s
Then produced object files can be linked and resulting executable file can be copied to Mac and successfully executed so it's not impossible to cross-compile for Mac on Windows.
Mantis conversion info:
- Mantis ID: 35743
- Version: 3.3.1
- Fixed in revision: 42302 (#7ef3d39d)