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

Fix intinite loop of cmake wrapper of osxcross. #49

Merged
merged 1 commit into from
Mar 15, 2021

Conversation

iwasakims
Copy link
Contributor

@iwasakims iwasakims commented Oct 22, 2020

Running cmake in the container with CROSS_TRIPLE=x86_64-apple-darwin hangs. The cause is wrapper of cmake (osxcross-cmake). Running cmake in the script results in recursively calling itself due to the PATH in the container.

root@6955a97b22e3:/workdir# /usr/bin/cmake --version
cmake version 3.7.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).
root@6955a97b22e3:/workdir# which cmake
/usr/x86_64-apple-darwin14/bin/cmake
root@6955a97b22e3:/workdir# cat /usr/x86_64-apple-darwin14/bin/cmake
#!/bin/bash

# set -x

# check if we are a symlink
if [ "$(readlink -f $0)" != "$0" ]; then
    exec "$(readlink -f $0)" $@
    exit $?
fi

# normal behavior -> proxy to osxcross binary
triple=$(echo "$0" | cut -d/ -f3)
binary=$(basename "$0")
binary_path="/usr/osxcross/bin/$triple-$binary"

exec "$binary_path" $@
# ls -l /usr/osxcross/bin/x86_64-apple-darwin14-cmake
lrwxrwxrwx. 1 root root 14 Oct 20 12:29 /usr/osxcross/bin/x86_64-apple-darwin14-cmake -> osxcross-cmake
root@6955a97b22e3:/workdir# cat /usr/osxcross/bin/osxcross-cmake
#!/usr/bin/env bash
set -e

dir=`dirname "$0"`
progname=`basename "$0"`

host=${progname%-cmake}
if test "$host" = "osxcross" ; then
   echo "Do not invoke this script directly."
   exit 1
fi

eval "`$dir/$host-osxcross-conf`"
export OSXCROSS_HOST="$host"

exec cmake -DCMAKE_TOOLCHAIN_FILE="$OSXCROSS_TARGET_DIR"/toolchain.cmake "$@"

@moul moul merged commit cf3fe68 into multiarch:master Mar 15, 2021
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 this pull request may close these issues.

2 participants