<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I'm getting a funny print when trying to create a statically linked executable on Linux x64.<div class=""><br class=""></div><div class="">The driver does not actually support this (<a href="https://bugs.swift.org/browse/SR-730" class="">https://bugs.swift.org/browse/SR-730</a>) and so I'm compiling by hand so I can learn to write the correct driver patch.<br class=""><div class=""><br class=""></div></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><div class="">$ cat test.swift</div></div><div class=""><div class="">print("hello world")</div></div><div class=""><div class="">$ swiftc -frontend -c -primary-file test.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -color-diagnostics -module-name test -o test.o</div></div><div class=""><div class="">$ clang++ -ldl -lpthread -lbsd -licui18n -licuuc /usr/local/lib/swift/linux/x86_64/swift_begin.o test.o -L /usr/local/lib/swift_static/linux/ -lswiftCore -lswiftSwiftOnoneSupport --target=x86_64-unknown-linux-gnu /usr/local/lib/swift/linux/x86_64/swift_end.o -o test</div></div><div class="">$ ./test</div><div class="">String(_core: Swift._StringCore(_baseAddress: Swift.COpaquePointer(_rawValue: (Opaque Value)), _countAndFlags: Swift.UInt(_value: (Opaque Value)), _owner: Swift.Optional<Swift.AnyObject>.None))</div></blockquote><div class=""><br class=""></div><div class="">Literally the *only* difference between this and an ordinary swift build that works fine is that I'm linking with libswiftCore.a libswiftSwiftOnoneSupport.a instead of libswiftCore.so libswiftSwiftOnoneSupport.so.</div><div class=""><br class=""></div><div class="">It's been suggested that this problem is due to "missing protocol conformance tables", but I'm afraid that vocabulary is greek to me. Things I've tried:</div><div class=""><br class=""></div><div class="">* Make sure swift_begin.o and swift_end.o surround the invocation (you can see them above)</div><div class="">* Make sure swift_begin.o and swift_end.o surround the *link* invocation (here's clang++ -v)</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class="">Debian clang version 3.5.0-10 (tags/RELEASE_350/final) (based on LLVM 3.5.0)</div><div class="">Target: x86_64-unknown-linux-gnu</div><div class="">Thread model: posix</div><div class="">Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8</div><div class="">Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8.4</div><div class="">Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9</div><div class="">Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9.2</div><div class="">Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8</div><div class="">Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.4</div><div class="">Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9</div><div class="">Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.2</div><div class="">Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9</div><div class="">Candidate multilib: .;@m64</div><div class="">Selected multilib: .;@m64</div><div class=""> "/usr/bin/ld" --hash-style=both --build-id --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o test /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/crt1.o /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/crti.o /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/crtbegin.o -L/usr/local/lib/swift_static/linux/ -L/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9 -L/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../.. -L/usr/lib/llvm-3.5/bin/../lib -L/lib -L/usr/lib -ldl -lpthread -lbsd -licui18n -licuuc /usr/local/lib/swift/linux/x86_64/swift_begin.o test.o -lswiftCore -lswiftSwiftOnoneSupport /usr/local/lib/swift/linux/x86_64/swift_end.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/crtend.o /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/crtn.o</div></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><br class=""></div></blockquote></blockquote>* Look at the executable with objdump. Here is the objdump for a <a href="https://bugs.swift.org/browse/SR-730?focusedCommentId=12798&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12798" class="">statically-linked executable</a> (broken) and compared to a <a href="https://bugs.swift.org/browse/SR-730?focusedCommentId=12799&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12799" class="">dynamically linked executable</a>. I don't know exactly what I'm looking for, but people a lot smarter than me seem satisfied the output is plausible.<div class="">* Extract libswiftCore.a and libswiftSwiftOnoneSupport.a into object files and link the object files manually. This has no effect.</div><div class=""><br class=""></div><div class="">I am totally out of leads on this, and many very bright people have tried, and failed, to help me understand WTF is going on. I would greatly appreciate any leads, suggestions, ideas, or help.</div></body></html>