diff --git a/conanfile.py b/conanfile.py index a76537ff81..e813054bc8 100644 --- a/conanfile.py +++ b/conanfile.py @@ -96,23 +96,6 @@ class BasiliskConan(ConanFile): # set cmake generator default generator = None - # make sure conan is configured to use the libstdc++11 by default - if platform.system() != "Darwin": - try: - subprocess.check_output(["conan", "profile", "new", "default", "--detect"], stdout=subprocess.DEVNULL) - except: - pass - - if platform.system() == "Linux": - try: - subprocess.check_output(["conan", "profile", "update", - "settings.compiler.libcxx=libstdc++11", "default"]) - print("\nConfiguring: " + statusColor + "use libstdc++11 by default" + endColor) - - except: - pass - - print(statusColor + "Checking conan configuration:" + endColor + " Done") def system_requirements(self): if not self.options.deprecatedBuild: @@ -347,6 +330,25 @@ def add_basilisk_to_sys_path(self): warnings.warn("Installation via 'conanfile.py' is deprecated. Please use `pip` installation instead!", DeprecationWarning) # TODO: Disable this usage entirely, including all "deprecatedBuild" items. + # make sure conan is configured to use the libstdc++11 by default + # XXX: This needs to be run before dispatching to Conan (i.e. outside of the + # ConanFile object), because it affects the configuration of the first run. + # (Running it here fixes https://github.com/AVSLab/basilisk/issues/525) + if platform.system() != "Darwin": + try: + subprocess.check_output(["conan", "profile", "new", "default", "--detect"]) + except: + pass + + if platform.system() == "Linux": + try: + # XXX: This fixes a linker issue due to the dual C++ ABI. + subprocess.check_output(["conan", "profile", "update", "settings.compiler.libcxx=libstdc++11", "default"]) + print("\nConfiguring: " + statusColor + "use libstdc++11 by default" + endColor) + except: + pass + print(statusColor + "Checking conan configuration:" + endColor + " Done") + parser = argparse.ArgumentParser(description="Configure the Basilisk framework.") # define the optional arguments parser.add_argument("--generator", help="cmake generator") diff --git a/setup.py b/setup.py index 4b796d4a27..7d5e2064d0 100644 --- a/setup.py +++ b/setup.py @@ -58,6 +58,7 @@ from unittest.mock import patch from subprocess import run +import platform from typing import List from pathlib import Path @@ -120,6 +121,22 @@ def get_source_files(self) -> List[str]: return [] def run(self) -> None: + if platform.system() != "Darwin": + try: + # XXX: Configure default Conan profile. + run(["conan", "profile", "new", "default", "--detect"]) + except: + pass + + if platform.system() == "Linux": + try: + # XXX: This is necessary to set the C++ Dual ABI such that some + # libraries, such as opencv, build correctly (without undefined + # symbols). Fixes (https://github.com/AVSLab/basilisk/issues/525). + run(["conan", "profile", "update", "settings.compiler.libcxx=libstdc++11", "default"]) + except: + pass + for ext in self.conan_extensions: # Configure Conan and install dependencies with the appropriate settings. run([