Richard Pennington
2013-Dec-22 01:33 UTC
[LLVMdev] How do I disable --version-script when cross compiling clang/LLVM on a Mac?
On 12/21/2013 05:21 PM, Alp Toker wrote:> > On 21/12/2013 22:51, Richard Pennington wrote: >> Hi, >> >> I asked this question a few days ago and didn't get any responses. I >> thought I'd try again with a little more detail. >> >> I am trying to cross compile my clang/LLVM based ELLCC cross >> development tools project (http://ellcc.org) > > Hi Richard, > > Nobody replied because your question lacks immediate relevance to this > mailing list. > > You may have more luck if you pose your question in a way that relates > to, and can be tried using stock LLVM/clang. > > If you think there's a bug, you can also file a bug report at > http://llvm.org/bugs/ including the steps needed to reproduce the issue. > > Feel free to CC me in, hope we can set you in the right direction. > > Alp. >Hi Alp, I hope you don't think I was whining about the lack of response, I wasn't. This list has always been extremely helpful. I understand that my use case is a bit out the norm. I was just hoping that someone more familiar with the clang/LLVM cross build rules might be able to shed a little insight. I suspect that there aren't too many people using clang/LLVM to cross build for Linux on a Mac. The normal cross build on a Linux box for another Linux target works just fine. -Rich
Alp Toker
2013-Dec-22 04:37 UTC
[LLVMdev] How do I disable --version-script when cross compiling clang/LLVM on a Mac?
On 22/12/2013 01:33, Richard Pennington wrote:> On 12/21/2013 05:21 PM, Alp Toker wrote: >> >> On 21/12/2013 22:51, Richard Pennington wrote: >>> Hi, >>> >>> I asked this question a few days ago and didn't get any responses. I >>> thought I'd try again with a little more detail. >>> >>> I am trying to cross compile my clang/LLVM based ELLCC cross >>> development tools project (http://ellcc.org) >> >> Hi Richard, >> >> Nobody replied because your question lacks immediate relevance to >> this mailing list. >> >> You may have more luck if you pose your question in a way that >> relates to, and can be tried using stock LLVM/clang. >> >> If you think there's a bug, you can also file a bug report at >> http://llvm.org/bugs/ including the steps needed to reproduce the issue. >> >> Feel free to CC me in, hope we can set you in the right direction. >> >> Alp. >> > Hi Alp, > > I hope you don't think I was whining about the lack of response, I > wasn't. This list has always been extremely helpful. I understand that > my use case is a bit out the norm. > > I was just hoping that someone more familiar with the clang/LLVM cross > build rules might be able to shed a little insight. I suspect that > there aren't too many people using clang/LLVM to cross build for Linux > on a Mac. The normal cross build on a Linux box for another Linux > target works just fine.That last bit gave a better idea of what you're aiming for. I think I wasn't the only one confused by the original mail as it takes a stretch of the imagination for those not using your toolchain(!) You'll have to test this yourself, but assuming you're on the Makefile build system and already set up correctly for a cross-compile, this might be the cause: The variable HAVE_LINK_VERSION_SCRIPT determines how the linker is called, and is detected at configure time by autoconf/m4/link_options.m4. Some of the Makefile.rules files have an additional ifeq ($(HOST_OS),Darwin) check surrounding use of that flag. That check may be confusing the host and target platforms when building up linker flags, and if so you've found a corner-case bug in the build system. I'd suggest hard-coding values in a few of those places to see if you can get the right flags passed depending on whether a host or target binary is getting built. Alp. -- http://www.nuanti.com the browser experts
Richard Pennington
2013-Dec-22 17:45 UTC
[LLVMdev] How do I disable --version-script when cross compiling clang/LLVM on a Mac?
On 12/21/2013 10:37 PM, Alp Toker wrote:> You'll have to test this yourself, but assuming you're on the Makefile > build system and already set up correctly for a cross-compile, this > might be the cause: > > The variable HAVE_LINK_VERSION_SCRIPT determines how the linker is > called, and is detected at configure time by autoconf/m4/link_options.m4. > > Some of the Makefile.rules files have an additional ifeq > ($(HOST_OS),Darwin) check surrounding use of that flag. > > That check may be confusing the host and target platforms when > building up linker flags, and if so you've found a corner-case bug in > the build system. I'd suggest hard-coding values in a few of those > places to see if you can get the right flags passed depending on > whether a host or target binary is getting built. > > Alp. >I found a band aid for my problem in Makefile.rules: ifeq ($(HOST_OS), $(filter $(HOST_OS), DragonFly Linux NetBSD FreeBSD GNU/kFreeBSD GNU)) ifneq ($(shell uname -s),Darwin) ifneq ($(ARCH), Mips) LD.Flags += -Wl,--version-script=$(LLVM_SRC_ROOT)/autoconf/ExportMap.map endif endif endif It turns out that HOST_OS is set to Linux for cross compiling in my case. I added the Darwin conditional. Did I configure something incorrectly? -Rich