Skip to content

Add required flags for using the new SwiftOnoneSupport library #266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 25, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
foundation.CFLAGS = '-DDEPLOYMENT_TARGET_MACOSX '
foundation.LDFLAGS = '-licucore -twolevel_namespace -Wl,-alias_list,CoreFoundation/Base.subproj/DarwinSymbolAliases -sectcreate __UNICODE __csbitmaps CoreFoundation/CharacterSets/CFCharacterSetBitmaps.bitmap -sectcreate __UNICODE __properties CoreFoundation/CharacterSets/CFUniCharPropertyDatabase.data -sectcreate __UNICODE __data CoreFoundation/CharacterSets/CFUnicodeData-L.mapping -segprot __UNICODE r r '

if Configuration.current.build_mode == Configuration.Debug:
foundation.LDFLAGS += ' -lswiftSwiftOnoneSupport '

# For now, we do not distinguish between public and private headers (they are all private to Foundation)
# These are really part of CF, which should ultimately be a separate target
foundation.ROOT_HEADERS_FOLDER_PATH = "${PREFIX}/lib/swift"
Expand Down Expand Up @@ -68,6 +71,15 @@
'-I'+Configuration.current.variables["LIBDISPATCH_BUILD_DIR"]+'/tests' # for include of dispatch/private.h in CF
])

if Configuration.current.build_mode == Configuration.Release:
foundation.LDFLAGS += ' -lswiftSwiftOnoneSupport '
# In the future, remove the LDFLAGS line above and enable
# the optimizations. But currently, it results in a segmentation
# fault on one of the tests.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this causes a segfault in one of the tests and it is currently working that probably means there is an expectation failure that is not met in your library:

it is worth noting the lines below are incorrect and should not be modified at that point:

from lib/script.py:111

        if Configuration.current.build_mode == Configuration.Debug:
            swift_flags += "-g -Onone "
        elif Configuration.current.build_mode == Configuration.Release:
            swift_flags += "-O "

that modification runs just fine without your changes; can you get me the crash point by attaching lldb?

cd swift-corelibs-foundation
ninja test
LD_LIBRARY_PATH=../build/Ninja-ReleaseAssert/foundation-linux-x86_64/Foundation/:/home/phausler/Public/build/Ninja-ReleaseAssert/xctest-linux-x86_64 ../build/Ninja-ReleaseAssert/lldb-linux-x86_64/bin/lldb ../build/Ninja-ReleaseAssert/foundation-linux-x86_64/TestFoundation/TestFoundation

presuming you built as release mode in the standard layouts

#swift_cflags += [
# '-O'
#]

foundation.SWIFTCFLAGS = " ".join(swift_cflags)

foundation.LDFLAGS += '-lpthread -ldl -lm -lswiftCore -lxml2 '
Expand Down