Skip to content
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

[SR-7787] SwiftPM build TSan build in release mode after ASan build gives linker errors #4814

Open
weissi opened this issue May 27, 2018 · 3 comments
Labels

Comments

@weissi
Copy link
Member

weissi commented May 27, 2018

Previous ID SR-7787
Radar rdar://problem/40617722
Original Reporter @weissi
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: 088db93625cb8635917cd370896fe0ea

Issue Description:

description

compiling TSan followed by ASan (or the other way around) in release mode creates linker error, need to wipe the build directory to make it work. (doing the same without the -c release -Xswiftc -enable-testing works fine)

repro

(needs Swift 4.2 pre-releases)

ASan then TSan

git clone https://github.com/apple/swift-nio.git
cd swift-nio
swift build --build-tests --sanitize=address -c release -Xswiftc -enable-testing
# observe how this works
swift build --build-tests --sanitize=thread -c release -Xswiftc -enable-testing

expected

works fine

actual

gives the following errors

Compile Swift Module 'NIOTests' (74 sources)
Linking ./.build/x86_64-apple-macosx10.10/release/NIOEchoServer
Undefined symbols for architecture x86_64:
  "___asan_init", referenced from:
      _asan.module_ctor in FileDescriptor.swift.o
      _asan.module_ctor in Linux.swift.o
      _asan.module_ctor in LinuxCPUSet.swift.o
      _asan.module_ctor in Resolver.swift.o
      _asan.module_ctor in Selectable.swift.o
  "___asan_register_globals", referenced from:
      _asan.module_ctor in FileDescriptor.swift.o
      _asan.module_ctor in Resolver.swift.o
      _asan.module_ctor in Selectable.swift.o
  "___asan_unregister_globals", referenced from:
      _asan.module_dtor in FileDescriptor.swift.o
      _asan.module_dtor in Resolver.swift.o
      _asan.module_dtor in Selectable.swift.o
  "___asan_version_mismatch_check_apple_1000", referenced from:
      _asan.module_ctor in FileDescriptor.swift.o
      _asan.module_ctor in Linux.swift.o
      _asan.module_ctor in LinuxCPUSet.swift.o
      _asan.module_ctor in Resolver.swift.o
      _asan.module_ctor in Selectable.swift.o
ld: symbol(s) not found for architecture x86_64

TSan then ASan

git clone https://github.com/apple/swift-nio.git
cd swift-nio
swift build --build-tests --sanitize=thread -c release -Xswiftc -enable-testing
# observe how this works
swift build --build-tests --sanitize=address -c release -Xswiftc -enable-testing

expected

works

actual

Compile Swift Module 'NIOTests' (74 sources)
Linking ./.build/x86_64-apple-macosx10.10/release/NIOEchoServer
Undefined symbols for architecture x86_64:
  "___tsan_init", referenced from:
      _tsan.module_ctor in FileDescriptor.swift.o
      _tsan.module_ctor in Linux.swift.o
      _tsan.module_ctor in LinuxCPUSet.swift.o
      _tsan.module_ctor in Resolver.swift.o
      _tsan.module_ctor in Selectable.swift.o
ld: symbol(s) not found for architecture x86_64
error: terminated(1): /Applications/Xcode-new.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /Users/johannes/devel/swift-nio/.build/release.yaml test output:
@belkadan
Copy link

Are we not treating --sanitize options as affecting the output files??

@ankitspd
Copy link
Member

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@hassila
Copy link

hassila commented Apr 29, 2022

See also apple/swift#58482

@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants