AdaCore / gnat-llvm

LLVM based GNAT compiler
179 stars 18 forks source link

Linking on macOS #4

Closed simonjwright closed 4 years ago

simonjwright commented 4 years ago

Running a test build on macOS mojave failed as follows (problem.adb is a file I had lying around, nothing to do with this issue):

$ llvm-gnatmake problem
llvm-gcc -c problem.adb
llvm-gnatbind -x problem.ali
llvm-gnatlink problem.ali
clang-10: error: unsupported option '-static-libgcc'
llvm-gnatlink: error when calling /Volumes/Miscellaneous/ll/gnat-llvm/llvm-interface/bin/llvm-gcc
llvm-gnatmake: *** link failed.
$

This is a workround:

$ llvm-gnatmake problem -largs -shared-libgcc
llvm-gnatbind -x problem.ali
llvm-gnatlink problem.ali -shared-libgcc
$
ArnaudCharlet commented 4 years ago

Right, and the preferred build mechanism is via gprbuild --target=llvm. Can you check whether gprbuild --target=llvm works out of the box?

simonjwright commented 4 years ago

On 9 Oct 2019, at 17:07, Arnaud Charlet notifications@github.com wrote:

Right, and the preferred build mechanism is via gprbuild --target=llvm. Can you check whether gprbuild --target=llvm works out of the box?

Yes.

$ gprbuild --target=llvm problem.gpr Compile [Ada] problem.adb Bind [gprbind] problem.bexch [Ada] problem.ali Link [link] problem.adb

ArnaudCharlet commented 4 years ago

OK, things should work now also with gnatmake after my change, can you confirm?

simonjwright commented 4 years ago

Getting

duplicate symbol ___gnat_objlist_file_supported in:
    libtools.a(link.o)
    libtools.a(targext.o)
ld: 1 duplicate symbol for architecture x86_64
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
ArnaudCharlet commented 4 years ago

Ah yes, for some reason this didn't cause troubles on linux. Fix on its way.

ArnaudCharlet commented 4 years ago

better now?

simonjwright commented 4 years ago

Yes! (and llvm-gnatmake worked without any extra flags.)

ArnaudCharlet commented 4 years ago

Good!