NSDate, NSDateFormatter


(Joe Bell) #1

All,

Howdy. I am using swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04 that was
released on December 1. The following code:

import Foundation

let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "dd-MM-yyyy"
let dateStr = dateFormatter.stringFromDate(NSDate())

print(dateStr)

results in

LLVM ERROR: Program used external function '_TFC10Foundation6NSDateCfT_S0_'
which could not be resolved!

when executed with the swift driver, and then when compiled with swiftc the
print statement just gives a blank newline.

I don't know if this is a known issue (I haven't found any reference on the
status page or elsewhere indicating this was unimplemented), or I have an
environmental problem.

Thoughts?

Joe


(Tony Parker) #2

Hi Joe,

Try this as a workaround: Set the LD_LIBRARY_PATH environment variable to $INSTALLED_LOCATION_OF_SWIFT/usr/lib/swift/linux

This should only affect the REPL and not compiled code.

I think this is supposed to be fixed in the top of tree Swift but not in the Dec 1 binary drop.

- Tony

···

On Dec 11, 2015, at 5:54 AM, Joseph Bell via swift-corelibs-dev <swift-corelibs-dev@swift.org> wrote:

All,

Howdy. I am using swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04 that was released on December 1. The following code:

import Foundation

let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "dd-MM-yyyy"
let dateStr = dateFormatter.stringFromDate(NSDate())

print(dateStr)

results in

LLVM ERROR: Program used external function '_TFC10Foundation6NSDateCfT_S0_' which could not be resolved!

when executed with the swift driver, and then when compiled with swiftc the print statement just gives a blank newline.

I don't know if this is a known issue (I haven't found any reference on the status page or elsewhere indicating this was unimplemented), or I have an environmental problem.

Thoughts?

Joe

_______________________________________________
swift-corelibs-dev mailing list
swift-corelibs-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-corelibs-dev


(Joe Bell) #3

Thanks Tony, with LD_LIBRARY_PATH set to include usr/lib/swift/linux I can
get the REPL to reproduce what I see with the compiler, and that's a blank
line printed out:

➜ dates
LD_LIBRARY_PATH=/opt/apple/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/lib/swift/linux:$LD_LIBRARY_PATH
swift printdate.swift

➜ dates

Which leads me to the obvious question, either I've forgotten how to use
NSDateFormatter, or the implementation in the December 1 drop is silently
not supporting setting the dateFormat property, which appears to be the
case, as setting dateStyle and timeStyle do appear to work.

import Foundation

let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "dd-MM-yyyy"
var dateStr = dateFormatter.stringFromDate(NSDate())

print(dateStr)

dateFormatter.dateStyle = .MediumStyle
dateFormatter.timeStyle = .MediumStyle
dateStr = dateFormatter.stringFromDate(NSDate())
print(dateStr)

results in:

➜ dates
LD_LIBRARY_PATH=/opt/apple/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/lib/swift/linux:$LD_LIBRARY_PATH
swift printdate.swift
<-- this is a blank line emitted by the first print(), which it should not
be -->
Dec 11, 2015, 6:52:33 PM

Thanks for any insight and if I need to file a bug report I am happy to
help,
Joe

···

On Fri, Dec 11, 2015 at 10:59 AM, Tony Parker <anthony.parker@apple.com> wrote:

Hi Joe,

Try this as a workaround: Set the LD_LIBRARY_PATH environment variable to
$INSTALLED_LOCATION_OF_SWIFT/usr/lib/swift/linux

This should only affect the REPL and not compiled code.

I think this is supposed to be fixed in the top of tree Swift but not in
the Dec 1 binary drop.

- Tony

On Dec 11, 2015, at 5:54 AM, Joseph Bell via swift-corelibs-dev < > swift-corelibs-dev@swift.org> wrote:

All,

Howdy. I am using swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04 that was
released on December 1. The following code:

import Foundation

let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "dd-MM-yyyy"
let dateStr = dateFormatter.stringFromDate(NSDate())

print(dateStr)

results in

LLVM ERROR: Program used external function
'_TFC10Foundation6NSDateCfT_S0_' which could not be resolved!

when executed with the swift driver, and then when compiled with swiftc
the print statement just gives a blank newline.

I don't know if this is a known issue (I haven't found any reference on
the status page or elsewhere indicating this was unimplemented), or I have
an environmental problem.

Thoughts?

Joe

_______________________________________________
swift-corelibs-dev mailing list
swift-corelibs-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-corelibs-dev


(Tony Parker) #4

Hi Joe,

Sure, bug reports are appreciated.

If you have the ability to check out the whole stack and try ToT, that would be great too. We are moving extremely rapidly right now on implementing missing pieces of Foundation.

- Tony

···

On Dec 11, 2015, at 10:53 AM, Joseph Bell <joe@iachieved.it> wrote:

Thanks Tony, with LD_LIBRARY_PATH set to include usr/lib/swift/linux I can get the REPL to reproduce what I see with the compiler, and that's a blank line printed out:

➜ dates LD_LIBRARY_PATH=/opt/apple/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/lib/swift/linux:$LD_LIBRARY_PATH swift printdate.swift

➜ dates

Which leads me to the obvious question, either I've forgotten how to use NSDateFormatter, or the implementation in the December 1 drop is silently not supporting setting the dateFormat property, which appears to be the case, as setting dateStyle and timeStyle do appear to work.

import Foundation

let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "dd-MM-yyyy"
var dateStr = dateFormatter.stringFromDate(NSDate())

print(dateStr)

dateFormatter.dateStyle = .MediumStyle
dateFormatter.timeStyle = .MediumStyle
dateStr = dateFormatter.stringFromDate(NSDate())
print(dateStr)

results in:

➜ dates LD_LIBRARY_PATH=/opt/apple/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/lib/swift/linux:$LD_LIBRARY_PATH swift printdate.swift
<-- this is a blank line emitted by the first print(), which it should not be -->
Dec 11, 2015, 6:52:33 PM

Thanks for any insight and if I need to file a bug report I am happy to help,
Joe

On Fri, Dec 11, 2015 at 10:59 AM, Tony Parker <anthony.parker@apple.com <mailto:anthony.parker@apple.com>> wrote:
Hi Joe,

Try this as a workaround: Set the LD_LIBRARY_PATH environment variable to $INSTALLED_LOCATION_OF_SWIFT/usr/lib/swift/linux

This should only affect the REPL and not compiled code.

I think this is supposed to be fixed in the top of tree Swift but not in the Dec 1 binary drop.

- Tony

On Dec 11, 2015, at 5:54 AM, Joseph Bell via swift-corelibs-dev <swift-corelibs-dev@swift.org <mailto:swift-corelibs-dev@swift.org>> wrote:

All,

Howdy. I am using swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04 that was released on December 1. The following code:

import Foundation

let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "dd-MM-yyyy"
let dateStr = dateFormatter.stringFromDate(NSDate())

print(dateStr)

results in

LLVM ERROR: Program used external function '_TFC10Foundation6NSDateCfT_S0_' which could not be resolved!

when executed with the swift driver, and then when compiled with swiftc the print statement just gives a blank newline.

I don't know if this is a known issue (I haven't found any reference on the status page or elsewhere indicating this was unimplemented), or I have an environmental problem.

Thoughts?

Joe

_______________________________________________
swift-corelibs-dev mailing list
swift-corelibs-dev@swift.org <mailto:swift-corelibs-dev@swift.org>
https://lists.swift.org/mailman/listinfo/swift-corelibs-dev


(Joe Bell) #5

Tony, all:

I've opened https://bugs.swift.org/browse/SR-208 against the .dateFormat
property of NSDateFormatter. It appears that it is not functioning as
expected. This was against the latest main branch of the repositories and
compiled on my Ubuntu14.04 system.

swift version 2.2-dev (LLVM 46be9ff861, Clang 4deb154edc, Swift 778f82939c)
Target: x86_64-unknown-linux-gnu

Joe

···

On Fri, Dec 11, 2015 at 12:56 PM, Tony Parker <anthony.parker@apple.com> wrote:

Hi Joe,

Sure, bug reports are appreciated.

If you have the ability to check out the whole stack and try ToT, that
would be great too. We are moving extremely rapidly right now on
implementing missing pieces of Foundation.

- Tony

On Dec 11, 2015, at 10:53 AM, Joseph Bell <joe@iachieved.it> wrote:

Thanks Tony, with LD_LIBRARY_PATH set to include usr/lib/swift/linux I can
get the REPL to reproduce what I see with the compiler, and that's a blank
line printed out:

➜ dates
LD_LIBRARY_PATH=/opt/apple/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/lib/swift/linux:$LD_LIBRARY_PATH
swift printdate.swift

➜ dates

Which leads me to the obvious question, either I've forgotten how to use
NSDateFormatter, or the implementation in the December 1 drop is silently
not supporting setting the dateFormat property, which appears to be the
case, as setting dateStyle and timeStyle do appear to work.

import Foundation

let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "dd-MM-yyyy"
var dateStr = dateFormatter.stringFromDate(NSDate())

print(dateStr)

dateFormatter.dateStyle = .MediumStyle
dateFormatter.timeStyle = .MediumStyle
dateStr = dateFormatter.stringFromDate(NSDate())
print(dateStr)

results in:

➜ dates
LD_LIBRARY_PATH=/opt/apple/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/lib/swift/linux:$LD_LIBRARY_PATH
swift printdate.swift
<-- this is a blank line emitted by the first print(), which it should not
be -->
Dec 11, 2015, 6:52:33 PM

Thanks for any insight and if I need to file a bug report I am happy to
help,
Joe

On Fri, Dec 11, 2015 at 10:59 AM, Tony Parker <anthony.parker@apple.com> > wrote:

Hi Joe,

Try this as a workaround: Set the LD_LIBRARY_PATH environment variable to
$INSTALLED_LOCATION_OF_SWIFT/usr/lib/swift/linux

This should only affect the REPL and not compiled code.

I think this is supposed to be fixed in the top of tree Swift but not in
the Dec 1 binary drop.

- Tony

On Dec 11, 2015, at 5:54 AM, Joseph Bell via swift-corelibs-dev < >> swift-corelibs-dev@swift.org> wrote:

All,

Howdy. I am using swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04 that was
released on December 1. The following code:

import Foundation

let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "dd-MM-yyyy"
let dateStr = dateFormatter.stringFromDate(NSDate())

print(dateStr)

results in

LLVM ERROR: Program used external function
'_TFC10Foundation6NSDateCfT_S0_' which could not be resolved!

when executed with the swift driver, and then when compiled with swiftc
the print statement just gives a blank newline.

I don't know if this is a known issue (I haven't found any reference on
the status page or elsewhere indicating this was unimplemented), or I have
an environmental problem.

Thoughts?

Joe

_______________________________________________
swift-corelibs-dev mailing list
swift-corelibs-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-corelibs-dev


(Tony Parker) #6

Thanks Joe.

- Tony

···

On Dec 12, 2015, at 1:51 PM, Joseph Bell <joe@iachieved.it> wrote:

Tony, all:

I've opened https://bugs.swift.org/browse/SR-208 against the .dateFormat property of NSDateFormatter. It appears that it is not functioning as expected. This was against the latest main branch of the repositories and compiled on my Ubuntu14.04 system.

swift version 2.2-dev (LLVM 46be9ff861, Clang 4deb154edc, Swift 778f82939c)
Target: x86_64-unknown-linux-gnu

Joe

On Fri, Dec 11, 2015 at 12:56 PM, Tony Parker <anthony.parker@apple.com <mailto:anthony.parker@apple.com>> wrote:
Hi Joe,

Sure, bug reports are appreciated.

If you have the ability to check out the whole stack and try ToT, that would be great too. We are moving extremely rapidly right now on implementing missing pieces of Foundation.

- Tony

On Dec 11, 2015, at 10:53 AM, Joseph Bell <joe@iachieved.it <mailto:joe@iachieved.it>> wrote:

Thanks Tony, with LD_LIBRARY_PATH set to include usr/lib/swift/linux I can get the REPL to reproduce what I see with the compiler, and that's a blank line printed out:

➜ dates LD_LIBRARY_PATH=/opt/apple/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/lib/swift/linux:$LD_LIBRARY_PATH swift printdate.swift

➜ dates

Which leads me to the obvious question, either I've forgotten how to use NSDateFormatter, or the implementation in the December 1 drop is silently not supporting setting the dateFormat property, which appears to be the case, as setting dateStyle and timeStyle do appear to work.

import Foundation

let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "dd-MM-yyyy"
var dateStr = dateFormatter.stringFromDate(NSDate())

print(dateStr)

dateFormatter.dateStyle = .MediumStyle
dateFormatter.timeStyle = .MediumStyle
dateStr = dateFormatter.stringFromDate(NSDate())
print(dateStr)

results in:

➜ dates LD_LIBRARY_PATH=/opt/apple/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/lib/swift/linux:$LD_LIBRARY_PATH swift printdate.swift
<-- this is a blank line emitted by the first print(), which it should not be -->
Dec 11, 2015, 6:52:33 PM

Thanks for any insight and if I need to file a bug report I am happy to help,
Joe

On Fri, Dec 11, 2015 at 10:59 AM, Tony Parker <anthony.parker@apple.com <mailto:anthony.parker@apple.com>> wrote:
Hi Joe,

Try this as a workaround: Set the LD_LIBRARY_PATH environment variable to $INSTALLED_LOCATION_OF_SWIFT/usr/lib/swift/linux

This should only affect the REPL and not compiled code.

I think this is supposed to be fixed in the top of tree Swift but not in the Dec 1 binary drop.

- Tony

On Dec 11, 2015, at 5:54 AM, Joseph Bell via swift-corelibs-dev <swift-corelibs-dev@swift.org <mailto:swift-corelibs-dev@swift.org>> wrote:

All,

Howdy. I am using swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04 that was released on December 1. The following code:

import Foundation

let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "dd-MM-yyyy"
let dateStr = dateFormatter.stringFromDate(NSDate())

print(dateStr)

results in

LLVM ERROR: Program used external function '_TFC10Foundation6NSDateCfT_S0_' which could not be resolved!

when executed with the swift driver, and then when compiled with swiftc the print statement just gives a blank newline.

I don't know if this is a known issue (I haven't found any reference on the status page or elsewhere indicating this was unimplemented), or I have an environmental problem.

Thoughts?

Joe

_______________________________________________
swift-corelibs-dev mailing list
swift-corelibs-dev@swift.org <mailto:swift-corelibs-dev@swift.org>
https://lists.swift.org/mailman/listinfo/swift-corelibs-dev