Skip to content

Commit

Permalink
check libc and arch in Linux build
Browse files Browse the repository at this point in the history
These checks allow us to detect compilation on systems which
may not meet requirements for stat(2) struct field layout
and __xstat64() libc ABI support on Linux.

From microsoft/VFSForGit@5b1236c.
  • Loading branch information
chrisd8088 committed Aug 18, 2020
1 parent 5e942ea commit 6614c18
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Scripts/Linux/BuildScalarForLinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,22 @@ if [ -z $VERSION ]; then
VERSION="0.2.173.2"
fi

ARCH=$(uname -m)
if test "$ARCH" != "x86_64"; then
>&2 echo "architecture must be x86_64 for struct stat; stopping"
exit 1
fi

CC=${CC:-cc}

echo 'main(){int i=1;const char *n="n";struct stat b;i=__xstat64(i,n,&b);}' | \
cc -xc -include sys/stat.h -o /dev/null - 2>/dev/null

if test $? != 0; then
>&2 echo "__xstat64() not found in libc ABI; stopping"
exit 1
fi

# If we're building the Profiling(Release) configuration, remove Profiling() for building .NET code
if [ "$CONFIGURATION" == "Profiling(Release)" ]; then
CONFIGURATION=Release
Expand Down

0 comments on commit 6614c18

Please sign in to comment.