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

[bug] Spurious '-find' argument to XCRun #8328

Closed
Erlkoenig90 opened this issue Jan 13, 2021 · 5 comments · Fixed by #8329
Closed

[bug] Spurious '-find' argument to XCRun #8328

Erlkoenig90 opened this issue Jan 13, 2021 · 5 comments · Fixed by #8329

Comments

@Erlkoenig90
Copy link
Contributor

Environment Details (include every applicable attribute)

  • Operating System+version: Linux / Mac OS X
  • Compiler+version: clang 10.0
  • Conan version: 1.32.1
  • Python version: 3.8.5

Steps to reproduce (Include if Applicable)

Attempt to cross-compile boost with compiler=apple-clang in the profile on Linux using the osxcross toolchain.

Logs (Executed commands with output) (Include/Attach if Applicable)

ERROR: boost/1.75.0: Error in build() method, line 649
	self._create_user_config_jam(self._boost_build_dir)
while calling '_create_user_config_jam', line 1003
	contents += " -isysroot %s" % tools.XCRun(self.settings).sdk_path
	CalledProcessErrorWithStderr: Command 'xcrun -find -sdk macosx --show-sdk-path' returned non-zero exit status 1.

The Boost recipe attempts to run xcrun -find -sdk macosx --show-sdk-path which is an illegal command line. Tthe original Apple xcrun tool just ignores the superfluous -find, but the osxcross one silently errors out with return code 1.

To fix this, the -find argument should be removed from

    def _invoke(self, args):
        def cmd_output(cmd):
            return check_output_runner(cmd).strip()

        command = ['xcrun', '-find']
        if self.sdk:
            command.extend(['-sdk', self.sdk])
        command.extend(args)
        return cmd_output(command)

in the apple.py file. The find function already adds the --find argument when finding tools. I'll submit a PR.

Erlkoenig90 added a commit to Erlkoenig90/conan that referenced this issue Jan 13, 2021
@SSE4
Copy link
Contributor

SSE4 commented Jan 13, 2021

from man xcrun:

       -f, --find
              Enable "find" mode, in which the resolved tool path  is  printed
              instead of the tool being executed.

@Erlkoenig90
Copy link
Contributor Author

-find doesn't appear to be necessary for --show-sdk-path, i.e. xcrun -sdk macosx --show-sdk-path works as intended.

@SSE4
Copy link
Contributor

SSE4 commented Jan 13, 2021

same result for me (native macOS):

➜  conan-io git:(apple_sdk_subsettings) ✗ xcrun -find -sdk macosx --show-sdk-path
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk
➜  conan-io git:(apple_sdk_subsettings) ✗ xcrun  -sdk macosx --show-sdk-path
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk

@SSE4
Copy link
Contributor

SSE4 commented Jan 13, 2021

@Erlkoenig90 unlreated to the bug, how is osxcross expirience with conan in general? (e.g. how many packages build or fail, any other problems you have encountered)
what is the profile you're using?

@Erlkoenig90
Copy link
Contributor Author

Erlkoenig90 commented Jan 13, 2021

It's a mixed bag. Some things work, others require debugging and patching things upstream. Until this and this is merged I have to use custom packages.

E.g. I had previously set compiler=clang in the profile, which worked. I now updated conan and Boost failed to build, so I changed it to apple-clang and also had to fix this very bug, which makes Boost compile, but now Glib breaks with:

[129/394] Linking target glib/gtester
FAILED: glib/gtester 
x86_64-apple-darwin19-clang  -o glib/gtester glib/gtester.p/gtester.c.o -L/home/niklas.guertler/.conan/data/libffi/3.2.1/_/_/package/534dcc368c999e07e81f146b3466b8f656ef1f55/lib -L/home/niklas.guertler/.conan/data/pcre/8.41/_/_/package/2de1c6e286cfa249eac839173525a95723b8979f/lib -L/home/niklas.guertler/.conan/data/gettext/0.21/produkte+apps+devices+conan+conan-center-index/wo/package/63fda00e22d6d7607ba4f2d523c1e799e36835de/lib -L/home/niklas.guertler/.conan/data/zlib/1.2.11/_/_/package/534dcc368c999e07e81f146b3466b8f656ef1f55/lib -L/home/niklas.guertler/.conan/data/bzip2/1.0.8/_/_/package/25d69afe851bfb8cb5aedd20123fa41e061f316e/lib -L/home/niklas.guertler/.conan/data/libiconv/1.16/_/_/package/534dcc368c999e07e81f146b3466b8f656ef1f55/lib -Wl,-dead_strip_dylibs -Wl,-headerpad_max_install_names -Wl,-undefined,error -Wl,-framework,CoreFoundation -Wl,-framework,Carbon -Wl,-framework,Foundation -Wl,-framework,AppKit -framework CoreFoundation -m64 glib/libglib-2.0.a -lgnuintl -liconv /home/niklas.guertler/.conan/data/pcre/8.41/_/_/package/2de1c6e286cfa249eac839173525a95723b8979f/lib/libpcre.a -Wl,-rpath=/home/niklas.guertler/.conan/data/pcre/8.41/_/_/package/2de1c6e286cfa249eac839173525a95723b8979f/lib /home/niklas.guertler/.conan/data/bzip2/1.0.8/_/_/package/25d69afe851bfb8cb5aedd20123fa41e061f316e/lib/libbz2.a -Wl,-rpath=/home/niklas.guertler/.conan/data/bzip2/1.0.8/_/_/package/25d69afe851bfb8cb5aedd20123fa41e061f316e/lib /home/niklas.guertler/.conan/data/zlib/1.2.11/_/_/package/534dcc368c999e07e81f146b3466b8f656ef1f55/lib/libz.a -Wl,-rpath=/home/niklas.guertler/.conan/data/zlib/1.2.11/_/_/package/534dcc368c999e07e81f146b3466b8f656ef1f55/lib -lgnuintl -liconv -liconv
ld: unknown option: -rpath=/home/niklas.guertler/.conan/data/pcre/8.41/_/_/package/2de1c6e286cfa249eac839173525a95723b8979f/lib
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)

So the goose-chase continues... Probably something about the meson toolchain file.
Edit: I just remembered that I already fixed this issue in #7716 but it wasn't merged either.

My profile is:

[settings]
os=Macos
os_build=Linux
arch=x86_64
arch_build=x86_64
compiler=apple-clang
compiler.version=10.0
compiler.cppstd=17
compiler.libcxx=libc++
build_type=Release

[build_requires]
[env]
CC=x86_64-apple-darwin19-clang
CXX=x86_64-apple-darwin19-clang++
AR=x86_64-apple-darwin19-ar
RANLIB=x86_64-apple-darwin19-ranlib
LD=x86_64-apple-darwin19-ld
PATH=[$PROFILE_DIR/../meson-wrappers/x86_64-apple-darwin19-macosx-clang]
CONAN_CMAKE_TOOLCHAIN_FILE=[$PROFILE_DIR/../cmake-toolchain-files/x86_64-apple-darwin19-macosx-clang]

I'm using a wrapper to call meson with the appropriate toolchain file, to which I set the PATH in the profile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants