Skip to content

Strip linux binaries correctly when cross-compiling #199

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 12, 2023
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
13 changes: 12 additions & 1 deletion robotpy_build/command/build_dl.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import os
import os.path
import subprocess
import sys
import sysconfig

from ..platforms import get_platform
from ..static_libs import StaticLib
Expand Down Expand Up @@ -65,5 +67,14 @@ def run(self):

elif not debug and platform.os == "linux":
# strip any downloaded libraries
strip_exe = "strip"
if getattr(sys, "cross_compiling", False):
# This is a hack, but the information doesn't seem to be available
# in other accessible ways
ar_exe = sysconfig.get_config_var("AR")
if ar_exe.endswith("-ar"):
strip_exe = f"{ar_exe[:-3]}-strip"

for lib in all_libs:
subprocess.check_call(["strip", lib])
print(strip_exe, lib)
subprocess.check_call([strip_exe, lib])