[swift-dev] Porting swift to FreeBSD
Davide Italiano
dccitaliano at gmail.com
Sat Dec 12 22:29:12 CST 2015
Hi,
I'm a FreeBSD developer who has been working on porting swift to FreeBSD.
I'm at a point where with a local patch (
https://people.freebsd.org/~davide/swift/build_freebsd.diff ) to fix
build errors I'm able to build the compiler itself on FreeBSD 11
(-CURRENT).
The compiler itself seems to work fine (at least semantic analysis is
able to produce the correct result for toy examples).
Example:
% cat hello.swift
let number = 4
println(number)
% ./swiftc hello.swift -o hello
hello.swift:2:1: error: 'println' has been renamed to 'print'
println(number)
^~~~~~~
[...]
The executables generated seem to have some problems, though.
This is what I see:
% cat hello2.swift
let number = 4
print(number)
% ./swiftc hello2.swift -o hello2
% ./hello2
Int(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(Stri
ng(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(Strin
g(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String
(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(String(
String(String(String(String(String(String(String(String(String(String(String(String(St
[...]
Rebuilding with symbols and trying to debug:
(gdb) down
#17750 0x0000000800d1f07e in
_TFs5printFTGSaP__9separatorSS10terminatorSS_T_ (items=...,
separator=..., terminator=...) at
/exps/swift/swift/stdlib/public/core/Print.swift:34
34 items, separator: separator, terminator: terminator,
toStream: &output)
(gdb)
#17749 0x0000000800d1f57b in
_TFs6_printuRxs16OutputStreamTyperFTGSaP__9separatorSS10terminatorSS8toStreamRx_T_
(items=..., separator=..., terminator=..., output=...)
at /exps/swift/swift/stdlib/public/core/Print.swift:128
128 _print_unlocked(item, &output)
(gdb)
#17748 0x0000000800d1b099 in
_TFs15_print_unlockedu0_R_s16OutputStreamTyperFTxRq__T_ (value=...,
target=...) at /exps/swift/swift/stdlib/public/core/OutputStream.swift:193
193 _adHocPrint(value, &target, isDebugPrint: false)
(gdb)
#17747 0x0000000800d1960b in
_TFs11_adHocPrintu0_R_s16OutputStreamTyperFTxRq_12isDebugPrintSb_T_
(value=..., isDebugPrint=...) at
/exps/swift/swift/stdlib/public/core/OutputStream.swift:124
124 print(label, terminator: "", toStream: &target)
(gdb)
#17746 0x0000000800d1a7ed in
_TFs5printuRxs16OutputStreamTyperFTGSaP__9separatorSS10terminatorSS8toStreamRx_T_
(items=..., separator=..., terminator=..., output=...)
at /exps/swift/swift/stdlib/public/core/Print.swift:91
91 _print(items, separator: separator, terminator: terminator,
toStream: &output)
(gdb)
#17745 0x0000000800d1f57b in
_TFs6_printuRxs16OutputStreamTyperFTGSaP__9separatorSS10terminatorSS8toStreamRx_T_
(items=..., separator=..., terminator=..., output=...)
at /exps/swift/swift/stdlib/public/core/Print.swift:128
128 _print_unlocked(item, &output)
(gdb)
#17744 0x0000000800d1b099 in
_TFs15_print_unlockedu0_R_s16OutputStreamTyperFTxRq__T_ (value=...,
target=...) at /exps/swift/swift/stdlib/public/core/OutputStream.swift:193
193 _adHocPrint(value, &target, isDebugPrint: false)
(gdb)
#17743 0x0000000800d1960b in
_TFs11_adHocPrintu0_R_s16OutputStreamTyperFTxRq_12isDebugPrintSb_T_
(value=..., isDebugPrint=...) at
/exps/swift/swift/stdlib/public/core/OutputStream.swift:124
124 print(label, terminator: "", toStream: &target)
I have some suspicion this may be related to my local patch (although
I can't say that for sure).
I'm still new to the internals of the language so any help on how what
could it be the root cause and how to try to debug this will be
appreciated.
Thanks!
--
Davide
More information about the swift-dev
mailing list