(Re-)compiling the stdlib


(Christian Hoffmann) #1

Hi there,

quick question from someone who likes to get started on the stdlib and
therefore sometimes likes to change an implementation, just to get a better
understanding, what is going on.

So let's say, I changed something in Bool.swift, e.g. to let the
implementation of `description` in the `CustomStringConvertible`
extension return 'YES' or 'NO'.

Ok, so doing a
`./swift/utils/build-script --debug-swift-stdlib --build-subdir=ds --`
compiles fine -> Perfect!

Running the REPL via `./build/ds/swift-macosx-x86_64/bin/swift` gives:

*** You are running Swift's integrated REPL, ***
*** intended for compiler and stdlib ***
*** development and testing purposes only. ***
*** The full REPL is built as part of LLDB. ***
*** Type ':help' for assistance. ***
(swift) let someBool = true
// someBool : Bool = YES
(swift) print (someBool.description)
YES

Once again: Perfect and as expected!

So after seeing, that this was kind of a bad idea and resetting these
changes,
re-triggering the same build command
`./swift/utils/build-script --debug-swift-stdlib --build-subdir=ds --`
runs much faster (as expected), BUT:
a newly started REPL gives the same results, as before and not as I
would expect a `true` or `false`.

I also tried to add a new method:

let someBool = true
// someBool : Bool = YES
let someBoolStr = someBool.anotherFunc()
LLVM ERROR: Program used external function '__TFSb11anotherFuncfT_SS' which
could not be resolved!

Once again: After a clean build, everything seems to work perfect.
Any idea, what needs to be "retriggered", so that the REPL or `swiftc`
picks up the new stdlib?

Thank you and Regards,
Christian Hoffmann


(Jordan Rose) #2

We were seeing some issues recently where the stdlib wouldn't get copied (actually lipo'd) into its final destination. Doug Coleman reverted the problem commit yesterday in https://github.com/apple/swift/pull/5166. Can you update to the latest master and try again?

Jordan

ยทยทยท

On Oct 6, 2016, at 11:40, Christian Hoffmann via swift-dev <swift-dev@swift.org> wrote:

Hi there,

quick question from someone who likes to get started on the stdlib and
therefore sometimes likes to change an implementation, just to get a better
understanding, what is going on.

So let's say, I changed something in Bool.swift, e.g. to let the
implementation of `description` in the `CustomStringConvertible`
extension return 'YES' or 'NO'.

Ok, so doing a
`./swift/utils/build-script --debug-swift-stdlib --build-subdir=ds --`
compiles fine -> Perfect!

Running the REPL via `./build/ds/swift-macosx-x86_64/bin/swift` gives:

*** You are running Swift's integrated REPL, ***
*** intended for compiler and stdlib ***
*** development and testing purposes only. ***
*** The full REPL is built as part of LLDB. ***
*** Type ':help' for assistance. ***
(swift) let someBool = true
// someBool : Bool = YES
(swift) print (someBool.description)
YES

Once again: Perfect and as expected!

So after seeing, that this was kind of a bad idea and resetting these changes,
re-triggering the same build command
`./swift/utils/build-script --debug-swift-stdlib --build-subdir=ds --`
runs much faster (as expected), BUT:
a newly started REPL gives the same results, as before and not as I
would expect a `true` or `false`.

I also tried to add a new method:

let someBool = true
// someBool : Bool = YES
let someBoolStr = someBool.anotherFunc()
LLVM ERROR: Program used external function '__TFSb11anotherFuncfT_SS' which could not be resolved!

Once again: After a clean build, everything seems to work perfect.
Any idea, what needs to be "retriggered", so that the REPL or `swiftc`
picks up the new stdlib?

Thank you and Regards,
Christian Hoffmann

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