Skip to content

Commit

Permalink
Test removing -latomic when building wheels (#252)
Browse files Browse the repository at this point in the history
* Update setup.py

* Use -latomic when linking against ASAN.

* Update setup.py

* Update setup.py
  • Loading branch information
psobot authored Sep 21, 2023
1 parent 040e833 commit 336cd89
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,20 +154,21 @@
if DEBUG:
ALL_CPPFLAGS += ["-DDEBUG=1", "-D_DEBUG=1"]
ALL_CPPFLAGS += ["-O0", "-g"]
if bool(int(os.environ.get("USE_ASAN", 0))):
ALL_CPPFLAGS += ["-fsanitize=address", "-fno-omit-frame-pointer"]
ALL_LINK_ARGS += ["-fsanitize=address"]
if platform.system() == "Linux":
ALL_LINK_ARGS += ["-shared-libasan"]
elif bool(int(os.environ.get("USE_TSAN", 0))):
ALL_CPPFLAGS += ["-fsanitize=thread"]
ALL_LINK_ARGS += ["-fsanitize=thread"]
elif bool(int(os.environ.get("USE_MSAN", 0))):
ALL_CPPFLAGS += ["-fsanitize=memory", "-fsanitize-memory-track-origins"]
ALL_LINK_ARGS += ["-fsanitize=memory"]
else:
ALL_CPPFLAGS += ["/Ox" if platform.system() == "Windows" else "-O3"]

if bool(int(os.environ.get("USE_ASAN", 0))):
ALL_CPPFLAGS += ["-fsanitize=address", "-fno-omit-frame-pointer"]
ALL_LINK_ARGS += ["-fsanitize=address"]
if platform.system() == "Linux":
ALL_LINK_ARGS += ["-shared-libasan", "-latomic"]
elif bool(int(os.environ.get("USE_TSAN", 0))):
ALL_CPPFLAGS += ["-fsanitize=thread"]
ALL_LINK_ARGS += ["-fsanitize=thread"]
elif bool(int(os.environ.get("USE_MSAN", 0))):
ALL_CPPFLAGS += ["-fsanitize=memory", "-fsanitize-memory-track-origins"]
ALL_LINK_ARGS += ["-fsanitize=memory"]


# Regardless of platform, allow our compiler to compile .mm files as Objective-C (required on MacOS)
UnixCCompiler.src_extensions.append(".mm")
Expand Down Expand Up @@ -226,7 +227,7 @@
)
include_paths = [flag[2:] for flag in flags]
ALL_INCLUDES += include_paths
ALL_LINK_ARGS += ["-lfreetype", "-latomic"]
ALL_LINK_ARGS += ["-lfreetype"]

ALL_RESOLVED_SOURCE_PATHS = [str(p.resolve()) for p in ALL_SOURCE_PATHS]
elif platform.system() == "Windows":
Expand Down

0 comments on commit 336cd89

Please sign in to comment.