Github messages for voidlinux
 help / color / mirror / Atom feed
* [ISSUE] zig: cross-compile support
@ 2020-09-17 21:42 jjsullivan5196
  2020-09-17 22:07 ` jjsullivan5196
                   ` (29 more replies)
  0 siblings, 30 replies; 31+ messages in thread
From: jjsullivan5196 @ 2020-09-17 21:42 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 13213 bytes --]

New issue by jjsullivan5196 on void-packages repository

https://github.com/void-linux/void-packages/issues/24959

Description:
I've been trying to get the zig compiler cross-compiled to aarch64 (want to have it on the pinephone) but I'm getting snubbed by some linker errors. 

I took a look at the zig project's own [bootstrap package](https://github.com/ziglang/zig-bootstrap) and found that it needs an AVR codegen target for cross targets, and that the host zig compiler can be used to cross-compiler the later stages. I made appropriate changes to the [`llvm10` and `zig` templates](https://github.com/jjsullivan5196/void-packages/tree/zig-cross), on `aarch64` and `aarch64-musl` I can fully compile stage0 with `cross-gcc`, but I get this mess when it links

```
[ 97%] Linking CXX static library zig_cpp/libzigcompiler.a
[ 97%] Built target zigcompiler
Scanning dependencies of target zig0
[ 98%] Building CXX object CMakeFiles/zig0.dir/src/stage2.cpp.o
[ 98%] Building CXX object CMakeFiles/zig0.dir/src/main.cpp.o
[ 99%] Linking CXX executable zig0
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMWindowsManifest.a(WindowsManifestMerger.cpp.o): in function `stripComments(_xmlNode*) [clone .isra.0]':
(.text._ZL13stripCommentsP8_xmlNode.isra.0+0x54): undefined reference to `xmlUnlinkNode'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZL13stripCommentsP8_xmlNode.isra.0+0x60): undefined reference to `xmlFreeNode'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMWindowsManifest.a(WindowsManifestMerger.cpp.o): in function `searchOrDefine(unsigned char const*, _xmlNode*)':
(.text._ZL14searchOrDefinePKhP8_xmlNode+0x15c): undefined reference to `xmlNewNs'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMWindowsManifest.a(WindowsManifestMerger.cpp.o): in function `llvm::windows_manifest::WindowsManifestMerger::WindowsManifestMergerImpl::~WindowsManifestMergerImpl()':
(.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImplD2Ev+0x24): undefined reference to `xmlFreeDoc'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImplD2Ev+0x38): undefined reference to `xmlFree'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImplD2Ev+0x3c): undefined reference to `xmlFree'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMWindowsManifest.a(WindowsManifestMerger.cpp.o): in function `treeMerge(_xmlNode*, _xmlNode*)':
(.text._ZL9treeMergeP8_xmlNodeS0_+0xc4): undefined reference to `xmlNewProp'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZL9treeMergeP8_xmlNodeS0_+0x120): undefined reference to `xmlStrdup'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZL9treeMergeP8_xmlNodeS0_+0x180): undefined reference to `xmlCopyNamespace'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZL9treeMergeP8_xmlNodeS0_+0x52c): undefined reference to `xmlUnlinkNode'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZL9treeMergeP8_xmlNodeS0_+0x538): undefined reference to `xmlAddChild'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZL9treeMergeP8_xmlNodeS0_+0x74c): undefined reference to `xmlFree'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZL9treeMergeP8_xmlNodeS0_+0x754): undefined reference to `xmlFree'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZL9treeMergeP8_xmlNodeS0_+0x924): undefined reference to `xmlFree'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZL9treeMergeP8_xmlNodeS0_+0x928): undefined reference to `xmlFree'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMWindowsManifest.a(WindowsManifestMerger.cpp.o): in function `checkAndStripPrefixes(_xmlNode*, std::vector<_xmlNs*, std::allocator<_xmlNs*> >&)':
(.text._ZL21checkAndStripPrefixesP8_xmlNodeRSt6vectorIP6_xmlNsSaIS3_EE+0x2a8): undefined reference to `xmlFreeNs'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMWindowsManifest.a(WindowsManifestMerger.cpp.o): in function `llvm::windows_manifest::WindowsManifestMerger::WindowsManifestMergerImpl::getMergedManifest()':
(.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl17getMergedManifestEv+0x44): undefined reference to `xmlDocGetRootElement'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl17getMergedManifestEv+0x64): undefined reference to `xmlNewDoc'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl17getMergedManifestEv+0x70): undefined reference to `xmlDocSetRootElement'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl17getMergedManifestEv+0x78): undefined reference to `xmlKeepBlanksDefault'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl17getMergedManifestEv+0x98): undefined reference to `xmlDocDumpFormatMemoryEnc'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl17getMergedManifestEv+0xac): undefined reference to `xmlFree'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl17getMergedManifestEv+0xb0): undefined reference to `xmlFree'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl17getMergedManifestEv+0xc4): undefined reference to `xmlFreeDoc'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMWindowsManifest.a(WindowsManifestMerger.cpp.o): in function `llvm::windows_manifest::WindowsManifestMerger::WindowsManifestMergerImpl::merge(llvm::MemoryBuffer const&)':
(.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl5mergeERKNS_12MemoryBufferE+0x54): undefined reference to `xmlSetGenericErrorFunc'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl5mergeERKNS_12MemoryBufferE+0x70): undefined reference to `xmlReadMemory'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl5mergeERKNS_12MemoryBufferE+0x84): undefined reference to `xmlSetGenericErrorFunc'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl5mergeERKNS_12MemoryBufferE+0xb0): undefined reference to `xmlDocGetRootElement'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl5mergeERKNS_12MemoryBufferE+0xe0): undefined reference to `xmlUnlinkNode'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl5mergeERKNS_12MemoryBufferE+0xec): undefined reference to `xmlFreeNode'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl5mergeERKNS_12MemoryBufferE+0x104): undefined reference to `xmlDocGetRootElement'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMSupport.a(Compression.cpp.o): in function `llvm::zlib::compress(llvm::StringRef, llvm::SmallVectorImpl<char>&, int)':
(.text._ZN4llvm4zlib8compressENS_9StringRefERNS_15SmallVectorImplIcEEi+0x40): undefined reference to `compressBound'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm4zlib8compressENS_9StringRefERNS_15SmallVectorImplIcEEi+0x6c): undefined reference to `compress2'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMSupport.a(Compression.cpp.o): in function `llvm::zlib::uncompress(llvm::StringRef, char*, unsigned long&)':
(.text._ZN4llvm4zlib10uncompressENS_9StringRefEPcRm+0x3c): undefined reference to `uncompress'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMSupport.a(Compression.cpp.o): in function `llvm::zlib::crc32(llvm::StringRef)':
(.text._ZN4llvm4zlib5crc32ENS_9StringRefE+0x14): undefined reference to `crc32'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMSupport.a(CRC.cpp.o): in function `llvm::crc32(unsigned int, llvm::ArrayRef<unsigned char>)':
(.text._ZN4llvm5crc32EjNS_8ArrayRefIhEE+0x38): undefined reference to `crc32'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMSupport.a(DynamicLibrary.cpp.o): in function `llvm::sys::DynamicLibrary::HandleSet::~HandleSet()':
(.text._ZN4llvm3sys14DynamicLibrary9HandleSetD2Ev+0x24): undefined reference to `dlclose'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm3sys14DynamicLibrary9HandleSetD2Ev+0x38): undefined reference to `dlclose'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMSupport.a(DynamicLibrary.cpp.o): in function `llvm::sys::DynamicLibrary::HandleSet::DLOpen(char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)':
(.text._ZN4llvm3sys14DynamicLibrary9HandleSet6DLOpenEPKcPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x14): undefined reference to `dlopen'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm3sys14DynamicLibrary9HandleSet6DLOpenEPKcPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x2c): undefined reference to `dlerror'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMSupport.a(DynamicLibrary.cpp.o): in function `llvm::sys::DynamicLibrary::HandleSet::DLClose(void*)':
(.text._ZN4llvm3sys14DynamicLibrary9HandleSet7DLCloseEPv+0x0): undefined reference to `dlclose'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMSupport.a(DynamicLibrary.cpp.o): in function `llvm::sys::DynamicLibrary::HandleSet::DLSym(void*, char const*)':
(.text._ZN4llvm3sys14DynamicLibrary9HandleSet5DLSymEPvPKc+0x0): undefined reference to `dlsym'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMSupport.a(Process.cpp.o): in function `llvm::sys::Process::FileDescriptorHasColors(int)':
(.text._ZN4llvm3sys7Process23FileDescriptorHasColorsEi+0xa0): undefined reference to `setupterm'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm3sys7Process23FileDescriptorHasColorsEi+0xcc): undefined reference to `tigetnum'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm3sys7Process23FileDescriptorHasColorsEi+0xd8): undefined reference to `set_curterm'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm3sys7Process23FileDescriptorHasColorsEi+0xdc): undefined reference to `del_curterm'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/zig0.dir/build.make:309: zig0] Error 1
make[1]: *** [CMakeFiles/Makefile2:110: CMakeFiles/zig0.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 99%] Built target zig_build_libstage2
make: *** [Makefile:149: all] Error 2
=> ERROR: zig-0.6.0_1: do_build: '${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}' exited with 2
=> ERROR:   in do_build() at common/build-style/cmake.sh:74
```

This version of `llvm10` can still build zig on the host target (x86_64) without a problem. Not sure what's causing this to happen. Has anyone seen errors like this trying to build other llvm10-based software, maybe rust? @Duncaen @ifreund 

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: zig: cross-compile support
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
@ 2020-09-17 22:07 ` jjsullivan5196
  2020-09-18  9:36 ` jjsullivan5196
                   ` (28 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2020-09-17 22:07 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 425 bytes --]

New comment by jjsullivan5196 on void-packages repository

https://github.com/void-linux/void-packages/issues/24959#issuecomment-694524801

Comment:
@andrewrk had some advice in irc:

```
<andrewrk> looks like it's missing some linker args like -ldl and it's missing the cmake option to disable libxml
<andrewrk> https://github.com/ziglang/zig-bootstrap/blob/master/build#L53
```

I'll give this a try and report back

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: zig: cross-compile support
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
  2020-09-17 22:07 ` jjsullivan5196
@ 2020-09-18  9:36 ` jjsullivan5196
  2020-09-18  9:36 ` jjsullivan5196
                   ` (27 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2020-09-18  9:36 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1168 bytes --]

New comment by jjsullivan5196 on void-packages repository

https://github.com/void-linux/void-packages/issues/24959#issuecomment-694765306

Comment:
I think I figured out the problem, more context from irc

```
<andrewrk> I think if you run `llvm-config --system-libs` or something like that it might spit out all the missing libs
<andrewrk> for me it prints `-lz -lrt -ldl -lpthread -lm` for your config it will probably include -lxml
<andrewrk> anyway point being that dependency comes from LLVM so it's kind of a question for the llvm project how to properly link in their dependency
andrewrk> it sounds like a packaging mishap if `llvm-config --system-libs` doesn't resolve this for you
```

So it seems that `llvm-config --system-libs` should spit out linker flags for any dependencies it needs when linking, but as it stands it just prints a blank line. This is what the cmake uses for cross dependencies. This would make me think the problem is somewhere in the `llvm10` template.

For now, manually adding the packages/linker flags appears to work. There's also a weird problem where `ld` ignores the extra flags unless `-Wl,--no-as-needed` is set.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: zig: cross-compile support
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
  2020-09-17 22:07 ` jjsullivan5196
  2020-09-18  9:36 ` jjsullivan5196
@ 2020-09-18  9:36 ` jjsullivan5196
  2020-09-18 11:20 ` zig: cross-compile the toolchain jjsullivan5196
                   ` (26 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2020-09-18  9:36 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1169 bytes --]

New comment by jjsullivan5196 on void-packages repository

https://github.com/void-linux/void-packages/issues/24959#issuecomment-694765306

Comment:
I think I figured out the problem, more context from irc

```
<andrewrk> I think if you run `llvm-config --system-libs` or something like that it might spit out all the missing libs
<andrewrk> for me it prints `-lz -lrt -ldl -lpthread -lm` for your config it will probably include -lxml
<andrewrk> anyway point being that dependency comes from LLVM so it's kind of a question for the llvm project how to properly link in their dependency
<andrewrk> it sounds like a packaging mishap if `llvm-config --system-libs` doesn't resolve this for you
```

So it seems that `llvm-config --system-libs` should spit out linker flags for any dependencies it needs when linking, but as it stands it just prints a blank line. This is what the cmake uses for cross dependencies. This would make me think the problem is somewhere in the `llvm10` template.

For now, manually adding the packages/linker flags appears to work. There's also a weird problem where `ld` ignores the extra flags unless `-Wl,--no-as-needed` is set.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: zig: cross-compile the toolchain
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
                   ` (2 preceding siblings ...)
  2020-09-18  9:36 ` jjsullivan5196
@ 2020-09-18 11:20 ` jjsullivan5196
  2020-09-18 11:21 ` jjsullivan5196
                   ` (25 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2020-09-18 11:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1370 bytes --]

New comment by jjsullivan5196 on void-packages repository

https://github.com/void-linux/void-packages/issues/24959#issuecomment-694765306

Comment:
I think I figured out the problem, more context from irc

```
<andrewrk> I think if you run `llvm-config --system-libs` or something like that it might spit out all the missing libs
<andrewrk> for me it prints `-lz -lrt -ldl -lpthread -lm` for your config it will probably include -lxml
<andrewrk> anyway point being that dependency comes from LLVM so it's kind of a question for the llvm project how to properly link in their dependency
<andrewrk> it sounds like a packaging mishap if `llvm-config --system-libs` doesn't resolve this for you
```

So it seems that `llvm-config --system-libs` should spit out linker flags for any dependencies it needs when linking, but as it stands it just prints a blank line. This is what the cmake uses for cross dependencies. This would make me think the problem is somewhere in the `llvm10` template.

~For now, manually adding the packages/linker flags appears to work. There's also a weird problem where `ld` ignores the extra flags unless `-Wl,--no-as-needed` is set.~

Found a problem, seems the AVR target causes some other issues

`zig: symbol lookup error: zig: undefined symbol: LLVMInitializeAVRTarget, version LLVM_10`

I'll see what I can do about that.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: zig: cross-compile the toolchain
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
                   ` (3 preceding siblings ...)
  2020-09-18 11:20 ` zig: cross-compile the toolchain jjsullivan5196
@ 2020-09-18 11:21 ` jjsullivan5196
  2020-09-18 11:21 ` jjsullivan5196
                   ` (24 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2020-09-18 11:21 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1391 bytes --]

New comment by jjsullivan5196 on void-packages repository

https://github.com/void-linux/void-packages/issues/24959#issuecomment-694765306

Comment:
I think I figured out the problem, more context from irc

```
<andrewrk> I think if you run `llvm-config --system-libs` or something like that it might spit out all the missing libs
<andrewrk> for me it prints `-lz -lrt -ldl -lpthread -lm` for your config it will probably include -lxml
<andrewrk> anyway point being that dependency comes from LLVM so it's kind of a question for the llvm project how to properly link in their dependency
<andrewrk> it sounds like a packaging mishap if `llvm-config --system-libs` doesn't resolve this for you
```

So it seems that `llvm-config --system-libs` should spit out linker flags for any dependencies it needs when linking, but as it stands it just prints a blank line. This is what the cmake uses for cross dependencies. This would make me think the problem is somewhere in the `llvm10` template.

~For now, manually adding the packages/linker flags appears to work. There's also a weird problem where `ld` ignores the extra flags unless `-Wl,--no-as-needed` is set.~

Found a problem, seems the AVR target causes some other issues

```
zig version
zig: symbol lookup error: zig: undefined symbol: LLVMInitializeAVRTarget, version LLVM_10
```

I'll see what I can do about that.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: zig: cross-compile the toolchain
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
                   ` (4 preceding siblings ...)
  2020-09-18 11:21 ` jjsullivan5196
@ 2020-09-18 11:21 ` jjsullivan5196
  2020-09-18 11:35 ` jjsullivan5196
                   ` (23 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2020-09-18 11:21 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1393 bytes --]

New comment by jjsullivan5196 on void-packages repository

https://github.com/void-linux/void-packages/issues/24959#issuecomment-694765306

Comment:
I think I figured out the problem, more context from irc

```
<andrewrk> I think if you run `llvm-config --system-libs` or something like that it might spit out all the missing libs
<andrewrk> for me it prints `-lz -lrt -ldl -lpthread -lm` for your config it will probably include -lxml
<andrewrk> anyway point being that dependency comes from LLVM so it's kind of a question for the llvm project how to properly link in their dependency
<andrewrk> it sounds like a packaging mishap if `llvm-config --system-libs` doesn't resolve this for you
```

So it seems that `llvm-config --system-libs` should spit out linker flags for any dependencies it needs when linking, but as it stands it just prints a blank line. This is what the cmake uses for cross dependencies. This would make me think the problem is somewhere in the `llvm10` template.

~For now, manually adding the packages/linker flags appears to work. There's also a weird problem where `ld` ignores the extra flags unless `-Wl,--no-as-needed` is set.~

Found a problem, seems the AVR target causes some other issues

```
# zig version
zig: symbol lookup error: zig: undefined symbol: LLVMInitializeAVRTarget, version LLVM_10
```

I'll see what I can do about that.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: zig: cross-compile the toolchain
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
                   ` (5 preceding siblings ...)
  2020-09-18 11:21 ` jjsullivan5196
@ 2020-09-18 11:35 ` jjsullivan5196
  2020-09-18 18:42 ` jjsullivan5196
                   ` (22 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2020-09-18 11:35 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1277 bytes --]

New comment by jjsullivan5196 on void-packages repository

https://github.com/void-linux/void-packages/issues/24959#issuecomment-694765306

Comment:
I think I figured out the problem, more context from irc

```
<andrewrk> I think if you run `llvm-config --system-libs` or something like that it might spit out all the missing libs
<andrewrk> for me it prints `-lz -lrt -ldl -lpthread -lm` for your config it will probably include -lxml
<andrewrk> anyway point being that dependency comes from LLVM so it's kind of a question for the llvm project how to properly link in their dependency
<andrewrk> it sounds like a packaging mishap if `llvm-config --system-libs` doesn't resolve this for you
```

So it seems that `llvm-config --system-libs` should spit out linker flags for any dependencies it needs when linking, but as it stands it just prints a blank line. This is what the cmake uses for cross dependencies. This would make me think the problem is somewhere in the `llvm10` template.

For now, manually adding the packages/linker flags appears to work. There's also a weird problem where `ld` ignores the extra flags unless `-Wl,--no-as-needed` is set.

**Found a "problem" before, but that's just because I forgot to install my own build of llvm. Whoops :^)

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: zig: cross-compile the toolchain
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
                   ` (6 preceding siblings ...)
  2020-09-18 11:35 ` jjsullivan5196
@ 2020-09-18 18:42 ` jjsullivan5196
  2020-09-18 18:43 ` jjsullivan5196
                   ` (21 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2020-09-18 18:42 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1169 bytes --]

New comment by jjsullivan5196 on void-packages repository

https://github.com/void-linux/void-packages/issues/24959#issuecomment-694765306

Comment:
I think I figured out the problem, more context from irc

```
<andrewrk> I think if you run `llvm-config --system-libs` or something like that it might spit out all the missing libs
<andrewrk> for me it prints `-lz -lrt -ldl -lpthread -lm` for your config it will probably include -lxml
<andrewrk> anyway point being that dependency comes from LLVM so it's kind of a question for the llvm project how to properly link in their dependency
<andrewrk> it sounds like a packaging mishap if `llvm-config --system-libs` doesn't resolve this for you
```

So it seems that `llvm-config --system-libs` should spit out linker flags for any dependencies it needs when linking, but as it stands it just prints a blank line. This is what the cmake uses for cross dependencies. This would make me think the problem is somewhere in the `llvm10` template.

For now, manually adding the packages/linker flags appears to work. There's also a weird problem where `ld` ignores the extra flags unless `-Wl,--no-as-needed` is set.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: zig: cross-compile the toolchain
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
                   ` (7 preceding siblings ...)
  2020-09-18 18:42 ` jjsullivan5196
@ 2020-09-18 18:43 ` jjsullivan5196
  2020-09-18 20:54 ` jjsullivan5196
                   ` (20 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2020-09-18 18:43 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1163 bytes --]

New comment by jjsullivan5196 on void-packages repository

https://github.com/void-linux/void-packages/issues/24959#issuecomment-694765306

Comment:
I think I figured out the problem, more context from irc

```
<andrewrk> I think if you run `llvm-config --system-libs` or something like that it might spit out all the missing libs
<andrewrk> for me it prints `-lz -lrt -ldl -lpthread -lm` for your config it will probably include -lxml
<andrewrk> anyway point being that dependency comes from LLVM so it's kind of a question for the llvm project how to properly link in their dependency
<andrewrk> it sounds like a packaging mishap if `llvm-config --system-libs` doesn't resolve this for you
```

So it seems that `llvm-config --system-libs` should spit out linker flags for any dependencies it needs when linking, but as it stands it just prints a blank line. This is what the cmake uses for cross dependencies, and makes me think the problem is somewhere in the `llvm10` template.

For now, manually adding the packages/linker flags appears to work. There's also a weird problem where `ld` ignores the extra flags unless `-Wl,--no-as-needed` is set.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: zig: cross-compile the toolchain
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
                   ` (8 preceding siblings ...)
  2020-09-18 18:43 ` jjsullivan5196
@ 2020-09-18 20:54 ` jjsullivan5196
  2020-09-18 21:10 ` q66
                   ` (19 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2020-09-18 20:54 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1231 bytes --]

New comment by jjsullivan5196 on void-packages repository

https://github.com/void-linux/void-packages/issues/24959#issuecomment-694765306

Comment:
I think I figured out the problem, more context from irc

```
<andrewrk> I think if you run `llvm-config --system-libs` or something like that it might spit out all the missing libs
<andrewrk> for me it prints `-lz -lrt -ldl -lpthread -lm` for your config it will probably include -lxml
<andrewrk> anyway point being that dependency comes from LLVM so it's kind of a question for the llvm project how to properly link in their dependency
<andrewrk> it sounds like a packaging mishap if `llvm-config --system-libs` doesn't resolve this for you
```

So `llvm-config --system-libs` should spit out linker flags for any dependencies it needs when linking, but it just prints a blank line. This is what the cmake uses for cross dependencies, and makes me think the problem is somewhere in the `llvm10` template. Also, the `zig` template needs to declare llvm's makedepends for cross, or else it wont build.

For now, manually adding the packages/linker flags appears to work. There's also a weird problem where `ld` ignores the extra flags unless `-Wl,--no-as-needed` is set.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: zig: cross-compile the toolchain
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
                   ` (9 preceding siblings ...)
  2020-09-18 20:54 ` jjsullivan5196
@ 2020-09-18 21:10 ` q66
  2020-09-18 21:46 ` andrewrk
                   ` (18 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: q66 @ 2020-09-18 21:10 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 3332 bytes --]

New comment by q66 on void-packages repository

https://github.com/void-linux/void-packages/issues/24959#issuecomment-695087891

Comment:
no, it shouldn't, for dynamic linking (which is default) it's irrelevant and with `--link-static` it behaves correctly; this really sounds like a problem with zig itself

```
q66@rimi: /home/q66/void-packages$ llvm-config --system-libs 

q66@rimi: /home/q66/void-packages$ llvm-config --link-static --system-libs
-lz -lrt -ldl -lcurses -lm -lxml2
q66@rimi: /home/q66/void-packages$ llvm-config --link-shared --system-libs

q66@rimi: /home/q66/void-packages$ llvm-config --libs
-lLLVM-10
q66@rimi: /home/q66/void-packages$ llvm-config --libs --link-static
-lLLVMXRay -lLLVMWindowsManifest -lLLVMTableGen -lLLVMSymbolize -lLLVMDebugInfoPDB -lLLVMOrcJIT -lLLVMOrcError -lLLVMJITLink -lLLVMObjectYAML -lLLVMMCA -lLLVMLTO -lLLVMPasses -lLLVMObjCARCOpts -lLLVMLineEditor -lLLVMLibDriver -lLLVMInterpreter -lLLVMFuzzMutate -lLLVMFrontendOpenMP -lLLVMMCJIT -lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMDWARFLinker -lLLVMDlltoolDriver -lLLVMOption -lLLVMDebugInfoGSYM -lLLVMCoverage -lLLVMCoroutines -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMX86Disassembler -lLLVMX86CodeGen -lLLVMX86AsmParser -lLLVMX86Desc -lLLVMX86Utils -lLLVMX86Info -lLLVMWebAssemblyDisassembler -lLLVMWebAssemblyCodeGen -lLLVMWebAssemblyDesc -lLLVMWebAssemblyAsmParser -lLLVMWebAssemblyInfo -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen -lLLVMSystemZAsmParser -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSparcDisassembler -lLLVMSparcCodeGen -lLLVMSparcAsmParser -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMRISCVDisassembler -lLLVMRISCVCodeGen -lLLVMRISCVAsmParser -lLLVMRISCVDesc -lLLVMRISCVUtils -lLLVMRISCVInfo -lLLVMPowerPCDisassembler -lLLVMPowerPCAsmParser -lLLVMPowerPCCodeGen -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMMSP430Disassembler -lLLVMMSP430CodeGen -lLLVMMSP430AsmParser -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMLanaiDisassembler -lLLVMLanaiCodeGen -lLLVMLanaiAsmParser -lLLVMLanaiDesc -lLLVMLanaiInfo -lLLVMHexagonDisassembler -lLLVMHexagonCodeGen -lLLVMHexagonAsmParser -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMBPFDisassembler -lLLVMBPFCodeGen -lLLVMBPFAsmParser -lLLVMBPFDesc -lLLVMBPFInfo -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMUtils -lLLVMARMInfo -lLLVMAMDGPUDisassembler -lLLVMAMDGPUCodeGen -lLLVMMIRParser -lLLVMipo -lLLVMInstrumentation -lLLVMVectorize -lLLVMLinker -lLLVMIRReader -lLLVMAsmParser -lLLVMAMDGPUAsmParser -lLLVMAMDGPUDesc -lLLVMAMDGPUUtils -lLLVMAMDGPUInfo -lLLVMAArch64Disassembler -lLLVMMCDisassembler -lLLVMAArch64CodeGen -lLLVMCFGuard -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMDebugInfoDWARF -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMAggressiveInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMTextAPI -lLLVMBitReader -lLLVMCore -lLLVMRemarks -lLLVMBitstreamReader -lLLVMAArch64AsmParser -lLLVMMCParser -lLLVMAArch64Desc -lLLVMMC -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMBinaryFormat -lLLVMAArch64Utils -lLLVMAArch64Info -lLLVMSupport -lLLVMDemangle
```



^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: zig: cross-compile the toolchain
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
                   ` (10 preceding siblings ...)
  2020-09-18 21:10 ` q66
@ 2020-09-18 21:46 ` andrewrk
  2020-09-18 21:47 ` andrewrk
                   ` (17 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: andrewrk @ 2020-09-18 21:46 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 853 bytes --]

New comment by andrewrk on void-packages repository

https://github.com/void-linux/void-packages/issues/24959#issuecomment-695100315

Comment:
howdy! I'm happy to help out here, it's not my intention to play the blame game, I'm here to help get everything working :)

> it needs an AVR codegen target for cross targets

this is not quite right - we enable it for the bootstrap build but it's not required for system packages to have it enabled. anyway it hardly matters because AVR is enabled by default in LLVM 11.

> (.text._ZN4llvm3sys14DynamicLibrary9HandleSet7DLCloseEPv+0x0): undefined reference to `dlclose'

How could you be getting an undefined reference to -ldl if it's dynamically linked?

@jjsullivan5196 what happens if you follow the directions from Zig's README using all default options, and don't try to do anything clever?


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: zig: cross-compile the toolchain
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
                   ` (11 preceding siblings ...)
  2020-09-18 21:46 ` andrewrk
@ 2020-09-18 21:47 ` andrewrk
  2020-09-18 22:02 ` Johnnynator
                   ` (16 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: andrewrk @ 2020-09-18 21:47 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 929 bytes --]

New comment by andrewrk on void-packages repository

https://github.com/void-linux/void-packages/issues/24959#issuecomment-695100315

Comment:
howdy! I'm happy to help out here, it's not my intention to play the blame game, I'm here to help get everything working :)

> it needs an AVR codegen target for cross targets

this is not quite right - we enable it for the bootstrap build but it's not required for system packages to have it enabled. anyway it hardly matters because AVR is enabled by default in LLVM 11.

> (.text._ZN4llvm3sys14DynamicLibrary9HandleSet7DLCloseEPv+0x0): undefined reference to `dlclose'

How could you be getting an undefined reference to -ldl if it's dynamically linked?

@jjsullivan5196 what happens if you follow the directions from Zig's README using all default options, and don't try to do anything clever?

just the standard
```
mkdir build
cd build
cmake ..
make install
```

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: zig: cross-compile the toolchain
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
                   ` (12 preceding siblings ...)
  2020-09-18 21:47 ` andrewrk
@ 2020-09-18 22:02 ` Johnnynator
  2020-09-18 22:02 ` Johnnynator
                   ` (15 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: Johnnynator @ 2020-09-18 22:02 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 535 bytes --]

New comment by Johnnynator on void-packages repository

https://github.com/void-linux/void-packages/issues/24959#issuecomment-695106184

Comment:
>  How could you be getting an undefined reference to -ldl if it's dynamically linked?
You can obviously get undefined references if you don't link against libdl, you only need to link against it, if you want to use any of the symbols it provides. If you use `dlopen` or `dlclose` you should link against `${CMAKE_DL_LIBS}` https://cmake.org/cmake/help/latest/variable/CMAKE_DL_LIBS.html

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: zig: cross-compile the toolchain
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
                   ` (13 preceding siblings ...)
  2020-09-18 22:02 ` Johnnynator
@ 2020-09-18 22:02 ` Johnnynator
  2020-09-18 22:03 ` andrewrk
                   ` (14 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: Johnnynator @ 2020-09-18 22:02 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 537 bytes --]

New comment by Johnnynator on void-packages repository

https://github.com/void-linux/void-packages/issues/24959#issuecomment-695106184

Comment:
>  How could you be getting an undefined reference to -ldl if it's dynamically linked?

You can obviously get undefined references if you don't link against libdl, you only need to link against it, if you want to use any of the symbols it provides. If you use `dlopen` or `dlclose` you should link against `${CMAKE_DL_LIBS}` https://cmake.org/cmake/help/latest/variable/CMAKE_DL_LIBS.html

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: zig: cross-compile the toolchain
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
                   ` (14 preceding siblings ...)
  2020-09-18 22:02 ` Johnnynator
@ 2020-09-18 22:03 ` andrewrk
  2020-09-18 22:03 ` andrewrk
                   ` (13 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: andrewrk @ 2020-09-18 22:03 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 241 bytes --]

New comment by andrewrk on void-packages repository

https://github.com/void-linux/void-packages/issues/24959#issuecomment-695106428

Comment:
zig does not use dlopen or dlclose. llvm does. so llvm should be reporting -ldl in --system-libs.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: zig: cross-compile the toolchain
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
                   ` (15 preceding siblings ...)
  2020-09-18 22:03 ` andrewrk
@ 2020-09-18 22:03 ` andrewrk
  2020-09-18 22:03 ` jjsullivan5196
                   ` (12 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: andrewrk @ 2020-09-18 22:03 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 373 bytes --]

New comment by andrewrk on void-packages repository

https://github.com/void-linux/void-packages/issues/24959#issuecomment-695106428

Comment:
zig does not use dlopen or dlclose. llvm does. so llvm should be reporting -ldl in --system-libs.

on my system it does:

```
andy@ark ~> ~/local/llvm10-release/bin/llvm-config --system-libs
-lz -lrt -ldl -lpthread -lm
```

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: zig: cross-compile the toolchain
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
                   ` (16 preceding siblings ...)
  2020-09-18 22:03 ` andrewrk
@ 2020-09-18 22:03 ` jjsullivan5196
  2020-09-18 22:33 ` jjsullivan5196
                   ` (11 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2020-09-18 22:03 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 311 bytes --]

New comment by jjsullivan5196 on void-packages repository

https://github.com/void-linux/void-packages/issues/24959#issuecomment-695106612

Comment:
@andrewrk I'll try the build without tricks, but just to clarify I got past the initial problems with the text dump up above. That was just missing linker flags.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: zig: cross-compile the toolchain
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
                   ` (17 preceding siblings ...)
  2020-09-18 22:03 ` jjsullivan5196
@ 2020-09-18 22:33 ` jjsullivan5196
  2020-09-18 22:34 ` andrewrk
                   ` (10 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2020-09-18 22:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 785 bytes --]

New comment by jjsullivan5196 on void-packages repository

https://github.com/void-linux/void-packages/issues/24959#issuecomment-695114714

Comment:
@andrewrk if you try to do the regular build with the gcc-cross toolchain, it will try to run the arm64 `llvm-config` to get the link options. However, the emulator isn't setup so it can't run, and it would report the library include dir being at the host root instead of the arm64 root anyway. (`/lib` instead of `/usr/aarch64-linux-gnu/lib`) I'm sorry, I don't have a lot of experience with this, so I can't explain very well.

The cross options in zig's cmake does get around this, but I had to hack the template a bit to get it to work. See here https://github.com/jjsullivan5196/void-packages/blob/zig-cross/srcpkgs/zig/template

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: zig: cross-compile the toolchain
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
                   ` (18 preceding siblings ...)
  2020-09-18 22:33 ` jjsullivan5196
@ 2020-09-18 22:34 ` andrewrk
  2020-09-18 22:36 ` jjsullivan5196
                   ` (9 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: andrewrk @ 2020-09-18 22:34 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 254 bytes --]

New comment by andrewrk on void-packages repository

https://github.com/void-linux/void-packages/issues/24959#issuecomment-695115079

Comment:
Ah, I see, for cross compiling then it makes sense that you would have to fiddle with it beyond the defaults. 

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: zig: cross-compile the toolchain
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
                   ` (19 preceding siblings ...)
  2020-09-18 22:34 ` andrewrk
@ 2020-09-18 22:36 ` jjsullivan5196
  2020-09-18 22:36 ` jjsullivan5196
                   ` (8 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2020-09-18 22:36 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 311 bytes --]

New comment by jjsullivan5196 on void-packages repository

https://github.com/void-linux/void-packages/issues/24959#issuecomment-695115335

Comment:
Yeah, so the problem is that I don't know if this is the advisable way to declare the dependencies, or if we should depend directly on the bootstrap build steps.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: zig: cross-compile the toolchain
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
                   ` (20 preceding siblings ...)
  2020-09-18 22:36 ` jjsullivan5196
@ 2020-09-18 22:36 ` jjsullivan5196
  2020-09-18 22:52 ` jjsullivan5196
                   ` (7 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2020-09-18 22:36 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 373 bytes --]

New comment by jjsullivan5196 on void-packages repository

https://github.com/void-linux/void-packages/issues/24959#issuecomment-695115335

Comment:
Yeah, so the problem is that I don't know if this is the advisable way to declare the dependencies, or if we should depend directly on the bootstrap build steps. Although, it does produce a working result if done like this.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: zig: cross-compile the toolchain
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
                   ` (21 preceding siblings ...)
  2020-09-18 22:36 ` jjsullivan5196
@ 2020-09-18 22:52 ` jjsullivan5196
  2020-09-18 22:52 ` jjsullivan5196
                   ` (6 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2020-09-18 22:52 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2741 bytes --]

New comment by jjsullivan5196 on void-packages repository

https://github.com/void-linux/void-packages/issues/24959#issuecomment-695118982

Comment:
For posterity, I did an `ldd` on the `x86_64 and `aarch64` binaries

x64:
```
        linux-vdso.so.1 (0x00007ffe9e1e5000)
        libLLVM-10.so => /usr/lib/libLLVM-10.so (0x00007f2021f6e000)
        libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f2021f4d000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f2021cd7000)
        libm.so.6 => /usr/lib/libm.so.6 (0x00007f2021b92000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007f20219cf000)
        /lib/ld-linux-x86-64.so.2 (0x00007f2027356000)
        libffi.so.7 => /usr/lib/../lib/libffi.so.7 (0x00007f20219c3000)
        libedit.so.0 => /usr/lib/../lib/libedit.so.0 (0x00007f2021988000)
        libz.so.1 => /usr/lib/../lib/libz.so.1 (0x00007f2021771000)
        libdl.so.2 => /usr/lib/../lib/libdl.so.2 (0x00007f202176c000)
        libncursesw.so.6 => /usr/lib/../lib/libncursesw.so.6 (0x00007f20216fa000)
        libxml2.so.2 => /usr/lib/../lib/libxml2.so.2 (0x00007f2021594000)
        libgcc_s.so.1 => /usr/lib/../lib/libgcc_s.so.1 (0x00007f202157a000)
        libicui18n.so.67 => /usr/lib/../lib/libicui18n.so.67 (0x00007f2021279000)
        libicuuc.so.67 => /usr/lib/../lib/libicuuc.so.67 (0x00007f2021094000)
        libicudata.so.67 => /usr/lib/../lib/libicudata.so.67 (0x00007f202108f000)
        liblzma.so.5 => /usr/lib/../lib/liblzma.so.5 (0x00007f2021066000)
```

aarch64:
```
        linux-vdso.so.1 (0x0000007fb282d000)
        libdl.so.2 => /usr/lib/libdl.so.2 (0x0000007fb27d4000)
        libncursesw.so.6 => /usr/lib/libncursesw.so.6 (0x0000007fb2757000)
        libz.so.1 => /usr/lib/libz.so.1 (0x0000007fb2732000)
        libxml2.so.2 => /usr/lib/libxml2.so.2 (0x0000007fb25c2000)
        libpthread.so.0 => /usr/lib/libpthread.so.0 (0x0000007fb2592000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x0000007fb231a000)
        libm.so.6 => /usr/lib/libm.so.6 (0x0000007fb2271000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x0000007fb224d000)
        libc.so.6 => /usr/lib/libc.so.6 (0x0000007fb20df000)
        /lib/ld-linux-aarch64.so.1 => /usr/lib/ld-linux-aarch64.so.1 (0x0000007fb27ff000)
        libicui18n.so.67 => /usr/lib/libicui18n.so.67 (0x0000007fb1de7000)
        libicuuc.so.67 => /usr/lib/libicuuc.so.67 (0x0000007fb1bf9000)
        libicudata.so.67 => /usr/lib/libicudata.so.67 (0x0000007fb1be7000)
        liblzma.so.5 => /usr/lib/liblzma.so.5 (0x0000007fb1bb2000)
```

So I guess that the cross step in cmake does force static linking, I only set what's in the template I linked above, no explicit options for static/dynamic.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: zig: cross-compile the toolchain
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
                   ` (22 preceding siblings ...)
  2020-09-18 22:52 ` jjsullivan5196
@ 2020-09-18 22:52 ` jjsullivan5196
  2020-09-18 22:53 ` jjsullivan5196
                   ` (5 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2020-09-18 22:52 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2750 bytes --]

New comment by jjsullivan5196 on void-packages repository

https://github.com/void-linux/void-packages/issues/24959#issuecomment-695118982

Comment:
For posterity, I did an `ldd` on the `x86_64 and `aarch64` binaries

x64:
```
        linux-vdso.so.1 (0x00007ffe9e1e5000)
        libLLVM-10.so => /usr/lib/libLLVM-10.so (0x00007f2021f6e000)
        libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f2021f4d000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f2021cd7000)
        libm.so.6 => /usr/lib/libm.so.6 (0x00007f2021b92000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007f20219cf000)
        /lib/ld-linux-x86-64.so.2 (0x00007f2027356000)
        libffi.so.7 => /usr/lib/../lib/libffi.so.7 (0x00007f20219c3000)
        libedit.so.0 => /usr/lib/../lib/libedit.so.0 (0x00007f2021988000)
        libz.so.1 => /usr/lib/../lib/libz.so.1 (0x00007f2021771000)
        libdl.so.2 => /usr/lib/../lib/libdl.so.2 (0x00007f202176c000)
        libncursesw.so.6 => /usr/lib/../lib/libncursesw.so.6 (0x00007f20216fa000)
        libxml2.so.2 => /usr/lib/../lib/libxml2.so.2 (0x00007f2021594000)
        libgcc_s.so.1 => /usr/lib/../lib/libgcc_s.so.1 (0x00007f202157a000)
        libicui18n.so.67 => /usr/lib/../lib/libicui18n.so.67 (0x00007f2021279000)
        libicuuc.so.67 => /usr/lib/../lib/libicuuc.so.67 (0x00007f2021094000)
        libicudata.so.67 => /usr/lib/../lib/libicudata.so.67 (0x00007f202108f000)
        liblzma.so.5 => /usr/lib/../lib/liblzma.so.5 (0x00007f2021066000)
```

aarch64:
```
        linux-vdso.so.1 (0x0000007fb282d000)
        libdl.so.2 => /usr/lib/libdl.so.2 (0x0000007fb27d4000)
        libncursesw.so.6 => /usr/lib/libncursesw.so.6 (0x0000007fb2757000)
        libz.so.1 => /usr/lib/libz.so.1 (0x0000007fb2732000)
        libxml2.so.2 => /usr/lib/libxml2.so.2 (0x0000007fb25c2000)
        libpthread.so.0 => /usr/lib/libpthread.so.0 (0x0000007fb2592000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x0000007fb231a000)
        libm.so.6 => /usr/lib/libm.so.6 (0x0000007fb2271000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x0000007fb224d000)
        libc.so.6 => /usr/lib/libc.so.6 (0x0000007fb20df000)
        /lib/ld-linux-aarch64.so.1 => /usr/lib/ld-linux-aarch64.so.1 (0x0000007fb27ff000)
        libicui18n.so.67 => /usr/lib/libicui18n.so.67 (0x0000007fb1de7000)
        libicuuc.so.67 => /usr/lib/libicuuc.so.67 (0x0000007fb1bf9000)
        libicudata.so.67 => /usr/lib/libicudata.so.67 (0x0000007fb1be7000)
        liblzma.so.5 => /usr/lib/liblzma.so.5 (0x0000007fb1bb2000)
```

So I guess that the cross step in cmake does force static linking for llvm, I only set what's in the template I linked above, no explicit options for static/dynamic.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: zig: cross-compile the toolchain
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
                   ` (23 preceding siblings ...)
  2020-09-18 22:52 ` jjsullivan5196
@ 2020-09-18 22:53 ` jjsullivan5196
  2020-09-19 22:39 ` jjsullivan5196
                   ` (4 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2020-09-18 22:53 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2751 bytes --]

New comment by jjsullivan5196 on void-packages repository

https://github.com/void-linux/void-packages/issues/24959#issuecomment-695118982

Comment:
For posterity, I did an `ldd` on the `x86_64` and `aarch64` binaries

x64:
```
        linux-vdso.so.1 (0x00007ffe9e1e5000)
        libLLVM-10.so => /usr/lib/libLLVM-10.so (0x00007f2021f6e000)
        libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f2021f4d000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f2021cd7000)
        libm.so.6 => /usr/lib/libm.so.6 (0x00007f2021b92000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007f20219cf000)
        /lib/ld-linux-x86-64.so.2 (0x00007f2027356000)
        libffi.so.7 => /usr/lib/../lib/libffi.so.7 (0x00007f20219c3000)
        libedit.so.0 => /usr/lib/../lib/libedit.so.0 (0x00007f2021988000)
        libz.so.1 => /usr/lib/../lib/libz.so.1 (0x00007f2021771000)
        libdl.so.2 => /usr/lib/../lib/libdl.so.2 (0x00007f202176c000)
        libncursesw.so.6 => /usr/lib/../lib/libncursesw.so.6 (0x00007f20216fa000)
        libxml2.so.2 => /usr/lib/../lib/libxml2.so.2 (0x00007f2021594000)
        libgcc_s.so.1 => /usr/lib/../lib/libgcc_s.so.1 (0x00007f202157a000)
        libicui18n.so.67 => /usr/lib/../lib/libicui18n.so.67 (0x00007f2021279000)
        libicuuc.so.67 => /usr/lib/../lib/libicuuc.so.67 (0x00007f2021094000)
        libicudata.so.67 => /usr/lib/../lib/libicudata.so.67 (0x00007f202108f000)
        liblzma.so.5 => /usr/lib/../lib/liblzma.so.5 (0x00007f2021066000)
```

aarch64:
```
        linux-vdso.so.1 (0x0000007fb282d000)
        libdl.so.2 => /usr/lib/libdl.so.2 (0x0000007fb27d4000)
        libncursesw.so.6 => /usr/lib/libncursesw.so.6 (0x0000007fb2757000)
        libz.so.1 => /usr/lib/libz.so.1 (0x0000007fb2732000)
        libxml2.so.2 => /usr/lib/libxml2.so.2 (0x0000007fb25c2000)
        libpthread.so.0 => /usr/lib/libpthread.so.0 (0x0000007fb2592000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x0000007fb231a000)
        libm.so.6 => /usr/lib/libm.so.6 (0x0000007fb2271000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x0000007fb224d000)
        libc.so.6 => /usr/lib/libc.so.6 (0x0000007fb20df000)
        /lib/ld-linux-aarch64.so.1 => /usr/lib/ld-linux-aarch64.so.1 (0x0000007fb27ff000)
        libicui18n.so.67 => /usr/lib/libicui18n.so.67 (0x0000007fb1de7000)
        libicuuc.so.67 => /usr/lib/libicuuc.so.67 (0x0000007fb1bf9000)
        libicudata.so.67 => /usr/lib/libicudata.so.67 (0x0000007fb1be7000)
        liblzma.so.5 => /usr/lib/liblzma.so.5 (0x0000007fb1bb2000)
```

So I guess that the cross step in cmake does force static linking for llvm, I only set what's in the template I linked above, no explicit options for static/dynamic.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: zig: cross-compile the toolchain
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
                   ` (24 preceding siblings ...)
  2020-09-18 22:53 ` jjsullivan5196
@ 2020-09-19 22:39 ` jjsullivan5196
  2020-09-19 22:41 ` jjsullivan5196
                   ` (3 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2020-09-19 22:39 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 787 bytes --]

New comment by jjsullivan5196 on void-packages repository

https://github.com/void-linux/void-packages/issues/24959#issuecomment-695114714

Comment:
@andrewrk if you try to do the regular build with the gcc-cross toolchain, it will try to run the arm64 `llvm-config` to get the link options. However, the emulator isn't setup so it can't run, ~and it would report the library include dir being at the host root instead of the arm64 root anyway. (`/lib` instead of `/usr/aarch64-linux-gnu/lib`)~ I'm sorry, I don't have a lot of experience with this, so I can't explain very well.

The cross options in zig's cmake does get around this, but I had to hack the template a bit to get it to work. See here https://github.com/jjsullivan5196/void-packages/blob/zig-cross/srcpkgs/zig/template

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: zig: cross-compile the toolchain
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
                   ` (25 preceding siblings ...)
  2020-09-19 22:39 ` jjsullivan5196
@ 2020-09-19 22:41 ` jjsullivan5196
  2020-09-20 23:49 ` jjsullivan5196
                   ` (2 subsequent siblings)
  29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2020-09-19 22:41 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 395 bytes --]

New comment by jjsullivan5196 on void-packages repository

https://github.com/void-linux/void-packages/issues/24959#issuecomment-695363366

Comment:
@andrewrk I was wrong about the aarch64 `llvm-config` spitting out wrong paths, it does work if properly wrapped with the `qemu-static` userspace emulator. If I can get it right in the template, it should hopefully just work without nasty hacks.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: zig: cross-compile the toolchain
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
                   ` (26 preceding siblings ...)
  2020-09-19 22:41 ` jjsullivan5196
@ 2020-09-20 23:49 ` jjsullivan5196
  2021-01-21 17:44 ` ericonr
  2021-01-21 17:44 ` [ISSUE] [CLOSED] " ericonr
  29 siblings, 0 replies; 31+ messages in thread
From: jjsullivan5196 @ 2020-09-20 23:49 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2055 bytes --]

New comment by jjsullivan5196 on void-packages repository

https://github.com/void-linux/void-packages/issues/24959#issuecomment-695852519

Comment:
Alright, pretty sure I have the simplest way to accomplish this. It required a small patch to zig's cmake, to force using `llvm-config` to find llvm dependencies for the target. I can fully bootstrap the compiler for aarch64 on one x86_64 machine, and the ldd output is the same (minus offsets)

now on aarch64:
```
        linux-vdso.so.1 (0x0000007f86265000)
        libLLVM-10.so => /usr/lib/libLLVM-10.so (0x0000007f81486000)
        libpthread.so.0 => /usr/lib/libpthread.so.0 (0x0000007f81456000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x0000007f811de000)
        libm.so.6 => /usr/lib/libm.so.6 (0x0000007f81135000)
        libc.so.6 => /usr/lib/libc.so.6 (0x0000007f80fc7000)
        libffi.so.7 => /usr/lib/../lib/libffi.so.7 (0x0000007f80fae000)
        libedit.so.0 => /usr/lib/../lib/libedit.so.0 (0x0000007f80f66000)
        libz.so.1 => /usr/lib/../lib/libz.so.1 (0x0000007f80f41000)
        libdl.so.2 => /usr/lib/../lib/libdl.so.2 (0x0000007f80f2d000)
        libncursesw.so.6 => /usr/lib/../lib/libncursesw.so.6 (0x0000007f80eb0000)
        libxml2.so.2 => /usr/lib/../lib/libxml2.so.2 (0x0000007f80d40000)
        libgcc_s.so.1 => /usr/lib/../lib/libgcc_s.so.1 (0x0000007f80d1c000)
        /lib/ld-linux-aarch64.so.1 => /usr/lib/ld-linux-aarch64.so.1 (0x0000007f86237000)
        libicui18n.so.67 => /usr/lib/../lib/libicui18n.so.67 (0x0000007f80a24000)
        libicuuc.so.67 => /usr/lib/../lib/libicuuc.so.67 (0x0000007f80836000)
        libicudata.so.67 => /usr/lib/../lib/libicudata.so.67 (0x0000007f80824000)
        liblzma.so.5 => /usr/lib/../lib/liblzma.so.5 (0x0000007f807ef000)
```

Check the template+patch [here](https://github.com/jjsullivan5196/void-packages/tree/zig-cross/srcpkgs/zig), I'll also submit this against zig master. If anyone has a better way to get around the ugly heredoc in the xbps template, feel free to correct me :^)

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: zig: cross-compile the toolchain
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
                   ` (27 preceding siblings ...)
  2020-09-20 23:49 ` jjsullivan5196
@ 2021-01-21 17:44 ` ericonr
  2021-01-21 17:44 ` [ISSUE] [CLOSED] " ericonr
  29 siblings, 0 replies; 31+ messages in thread
From: ericonr @ 2021-01-21 17:44 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 174 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/issues/24959#issuecomment-764822411

Comment:
This will be tracked on the PR.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [ISSUE] [CLOSED] zig: cross-compile the toolchain
  2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
                   ` (28 preceding siblings ...)
  2021-01-21 17:44 ` ericonr
@ 2021-01-21 17:44 ` ericonr
  29 siblings, 0 replies; 31+ messages in thread
From: ericonr @ 2021-01-21 17:44 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 13445 bytes --]

Closed issue by jjsullivan5196 on void-packages repository

https://github.com/void-linux/void-packages/issues/24959

Description:
**Old info below**, I've made it possible to cross-compile without touching the `llvm10` template or nasty hacks. See the latest template [here](https://github.com/jjsullivan5196/void-packages/tree/zig-cross/srcpkgs/zig)

I've been trying to get the zig compiler cross-compiled to aarch64 (want to have it on the pinephone) but I'm getting snubbed by some linker errors. 

I took a look at the zig project's own [bootstrap package](https://github.com/ziglang/zig-bootstrap) and found that it needs an AVR codegen target for cross targets, and that the host zig compiler can be used to cross-compiler the later stages. I made appropriate changes to the [`llvm10` and `zig` templates](https://github.com/jjsullivan5196/void-packages/tree/zig-cross). On `aarch64` and `aarch64-musl` I can fully compile stage0 with `cross-gcc`, but I get this mess when it links

```
[ 97%] Linking CXX static library zig_cpp/libzigcompiler.a
[ 97%] Built target zigcompiler
Scanning dependencies of target zig0
[ 98%] Building CXX object CMakeFiles/zig0.dir/src/stage2.cpp.o
[ 98%] Building CXX object CMakeFiles/zig0.dir/src/main.cpp.o
[ 99%] Linking CXX executable zig0
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMWindowsManifest.a(WindowsManifestMerger.cpp.o): in function `stripComments(_xmlNode*) [clone .isra.0]':
(.text._ZL13stripCommentsP8_xmlNode.isra.0+0x54): undefined reference to `xmlUnlinkNode'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZL13stripCommentsP8_xmlNode.isra.0+0x60): undefined reference to `xmlFreeNode'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMWindowsManifest.a(WindowsManifestMerger.cpp.o): in function `searchOrDefine(unsigned char const*, _xmlNode*)':
(.text._ZL14searchOrDefinePKhP8_xmlNode+0x15c): undefined reference to `xmlNewNs'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMWindowsManifest.a(WindowsManifestMerger.cpp.o): in function `llvm::windows_manifest::WindowsManifestMerger::WindowsManifestMergerImpl::~WindowsManifestMergerImpl()':
(.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImplD2Ev+0x24): undefined reference to `xmlFreeDoc'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImplD2Ev+0x38): undefined reference to `xmlFree'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImplD2Ev+0x3c): undefined reference to `xmlFree'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMWindowsManifest.a(WindowsManifestMerger.cpp.o): in function `treeMerge(_xmlNode*, _xmlNode*)':
(.text._ZL9treeMergeP8_xmlNodeS0_+0xc4): undefined reference to `xmlNewProp'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZL9treeMergeP8_xmlNodeS0_+0x120): undefined reference to `xmlStrdup'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZL9treeMergeP8_xmlNodeS0_+0x180): undefined reference to `xmlCopyNamespace'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZL9treeMergeP8_xmlNodeS0_+0x52c): undefined reference to `xmlUnlinkNode'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZL9treeMergeP8_xmlNodeS0_+0x538): undefined reference to `xmlAddChild'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZL9treeMergeP8_xmlNodeS0_+0x74c): undefined reference to `xmlFree'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZL9treeMergeP8_xmlNodeS0_+0x754): undefined reference to `xmlFree'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZL9treeMergeP8_xmlNodeS0_+0x924): undefined reference to `xmlFree'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZL9treeMergeP8_xmlNodeS0_+0x928): undefined reference to `xmlFree'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMWindowsManifest.a(WindowsManifestMerger.cpp.o): in function `checkAndStripPrefixes(_xmlNode*, std::vector<_xmlNs*, std::allocator<_xmlNs*> >&)':
(.text._ZL21checkAndStripPrefixesP8_xmlNodeRSt6vectorIP6_xmlNsSaIS3_EE+0x2a8): undefined reference to `xmlFreeNs'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMWindowsManifest.a(WindowsManifestMerger.cpp.o): in function `llvm::windows_manifest::WindowsManifestMerger::WindowsManifestMergerImpl::getMergedManifest()':
(.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl17getMergedManifestEv+0x44): undefined reference to `xmlDocGetRootElement'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl17getMergedManifestEv+0x64): undefined reference to `xmlNewDoc'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl17getMergedManifestEv+0x70): undefined reference to `xmlDocSetRootElement'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl17getMergedManifestEv+0x78): undefined reference to `xmlKeepBlanksDefault'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl17getMergedManifestEv+0x98): undefined reference to `xmlDocDumpFormatMemoryEnc'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl17getMergedManifestEv+0xac): undefined reference to `xmlFree'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl17getMergedManifestEv+0xb0): undefined reference to `xmlFree'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl17getMergedManifestEv+0xc4): undefined reference to `xmlFreeDoc'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMWindowsManifest.a(WindowsManifestMerger.cpp.o): in function `llvm::windows_manifest::WindowsManifestMerger::WindowsManifestMergerImpl::merge(llvm::MemoryBuffer const&)':
(.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl5mergeERKNS_12MemoryBufferE+0x54): undefined reference to `xmlSetGenericErrorFunc'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl5mergeERKNS_12MemoryBufferE+0x70): undefined reference to `xmlReadMemory'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl5mergeERKNS_12MemoryBufferE+0x84): undefined reference to `xmlSetGenericErrorFunc'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl5mergeERKNS_12MemoryBufferE+0xb0): undefined reference to `xmlDocGetRootElement'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl5mergeERKNS_12MemoryBufferE+0xe0): undefined reference to `xmlUnlinkNode'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl5mergeERKNS_12MemoryBufferE+0xec): undefined reference to `xmlFreeNode'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm16windows_manifest21WindowsManifestMerger25WindowsManifestMergerImpl5mergeERKNS_12MemoryBufferE+0x104): undefined reference to `xmlDocGetRootElement'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMSupport.a(Compression.cpp.o): in function `llvm::zlib::compress(llvm::StringRef, llvm::SmallVectorImpl<char>&, int)':
(.text._ZN4llvm4zlib8compressENS_9StringRefERNS_15SmallVectorImplIcEEi+0x40): undefined reference to `compressBound'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm4zlib8compressENS_9StringRefERNS_15SmallVectorImplIcEEi+0x6c): undefined reference to `compress2'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMSupport.a(Compression.cpp.o): in function `llvm::zlib::uncompress(llvm::StringRef, char*, unsigned long&)':
(.text._ZN4llvm4zlib10uncompressENS_9StringRefEPcRm+0x3c): undefined reference to `uncompress'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMSupport.a(Compression.cpp.o): in function `llvm::zlib::crc32(llvm::StringRef)':
(.text._ZN4llvm4zlib5crc32ENS_9StringRefE+0x14): undefined reference to `crc32'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMSupport.a(CRC.cpp.o): in function `llvm::crc32(unsigned int, llvm::ArrayRef<unsigned char>)':
(.text._ZN4llvm5crc32EjNS_8ArrayRefIhEE+0x38): undefined reference to `crc32'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMSupport.a(DynamicLibrary.cpp.o): in function `llvm::sys::DynamicLibrary::HandleSet::~HandleSet()':
(.text._ZN4llvm3sys14DynamicLibrary9HandleSetD2Ev+0x24): undefined reference to `dlclose'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm3sys14DynamicLibrary9HandleSetD2Ev+0x38): undefined reference to `dlclose'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMSupport.a(DynamicLibrary.cpp.o): in function `llvm::sys::DynamicLibrary::HandleSet::DLOpen(char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)':
(.text._ZN4llvm3sys14DynamicLibrary9HandleSet6DLOpenEPKcPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x14): undefined reference to `dlopen'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm3sys14DynamicLibrary9HandleSet6DLOpenEPKcPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x2c): undefined reference to `dlerror'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMSupport.a(DynamicLibrary.cpp.o): in function `llvm::sys::DynamicLibrary::HandleSet::DLClose(void*)':
(.text._ZN4llvm3sys14DynamicLibrary9HandleSet7DLCloseEPv+0x0): undefined reference to `dlclose'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMSupport.a(DynamicLibrary.cpp.o): in function `llvm::sys::DynamicLibrary::HandleSet::DLSym(void*, char const*)':
(.text._ZN4llvm3sys14DynamicLibrary9HandleSet5DLSymEPvPKc+0x0): undefined reference to `dlsym'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: /usr/aarch64-linux-gnu/usr/lib/libLLVMSupport.a(Process.cpp.o): in function `llvm::sys::Process::FileDescriptorHasColors(int)':
(.text._ZN4llvm3sys7Process23FileDescriptorHasColorsEi+0xa0): undefined reference to `setupterm'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm3sys7Process23FileDescriptorHasColorsEi+0xcc): undefined reference to `tigetnum'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm3sys7Process23FileDescriptorHasColorsEi+0xd8): undefined reference to `set_curterm'
/usr/lib/gcc/aarch64-linux-gnu/9.3.0/../../../../aarch64-linux-gnu/bin/ld: (.text._ZN4llvm3sys7Process23FileDescriptorHasColorsEi+0xdc): undefined reference to `del_curterm'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/zig0.dir/build.make:309: zig0] Error 1
make[1]: *** [CMakeFiles/Makefile2:110: CMakeFiles/zig0.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 99%] Built target zig_build_libstage2
make: *** [Makefile:149: all] Error 2
=> ERROR: zig-0.6.0_1: do_build: '${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}' exited with 2
=> ERROR:   in do_build() at common/build-style/cmake.sh:74
```

This version of `llvm10` can still build zig on the host target (x86_64) without a problem. Not sure what's causing this to happen. Has anyone seen errors like this trying to build other llvm10-based software, maybe rust? @Duncaen @ifreund @q66 

^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2021-01-21 17:44 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-17 21:42 [ISSUE] zig: cross-compile support jjsullivan5196
2020-09-17 22:07 ` jjsullivan5196
2020-09-18  9:36 ` jjsullivan5196
2020-09-18  9:36 ` jjsullivan5196
2020-09-18 11:20 ` zig: cross-compile the toolchain jjsullivan5196
2020-09-18 11:21 ` jjsullivan5196
2020-09-18 11:21 ` jjsullivan5196
2020-09-18 11:35 ` jjsullivan5196
2020-09-18 18:42 ` jjsullivan5196
2020-09-18 18:43 ` jjsullivan5196
2020-09-18 20:54 ` jjsullivan5196
2020-09-18 21:10 ` q66
2020-09-18 21:46 ` andrewrk
2020-09-18 21:47 ` andrewrk
2020-09-18 22:02 ` Johnnynator
2020-09-18 22:02 ` Johnnynator
2020-09-18 22:03 ` andrewrk
2020-09-18 22:03 ` andrewrk
2020-09-18 22:03 ` jjsullivan5196
2020-09-18 22:33 ` jjsullivan5196
2020-09-18 22:34 ` andrewrk
2020-09-18 22:36 ` jjsullivan5196
2020-09-18 22:36 ` jjsullivan5196
2020-09-18 22:52 ` jjsullivan5196
2020-09-18 22:52 ` jjsullivan5196
2020-09-18 22:53 ` jjsullivan5196
2020-09-19 22:39 ` jjsullivan5196
2020-09-19 22:41 ` jjsullivan5196
2020-09-20 23:49 ` jjsullivan5196
2021-01-21 17:44 ` ericonr
2021-01-21 17:44 ` [ISSUE] [CLOSED] " ericonr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).