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

Filter libtool warning about table of contents #15325

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
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: 10 additions & 3 deletions tools/objc/libtool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,22 @@ if [ -z ${MY_LOCATION+x} ]; then
fi
fi

WRAPPER="${MY_LOCATION}/xcrunwrapper.sh"
function libtool() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably worth naming this something slightly different to avoid confusion that we're calling libtool directly, maybe libtool_func (or ideally something better)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would invoke_libtool be okay?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good

# Just invoke libtool via xcrunwrapper
"${MY_LOCATION}/xcrunwrapper.sh" libtool "$@" \
2> >(grep -v "the table of contents is empty (no object file members in the"`
`" library define global symbols)$" >&2)
Comment on lines +38 to +39
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this grep not matching cause an unexpected failure?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could also be less strict here if you wanted

Copy link
Contributor Author

@cpsauer cpsauer Apr 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When running, I'm seeing things succeed fine when the grep doesn't match. Does that resolve the concern?
(I think your concern is a non-zero exit code from grep leading to a non-zero exit code of the script.)

Copy link
Contributor Author

@cpsauer cpsauer Apr 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I kinda like the full thing to self-document the warning, but can remove if you want.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that resolves the concern, I was worried grep would still error. it looks like it's because of the -v that it doesn't?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I think so. I was concerned about that, too, when writing

# ^ Filtering a warning that's unlikely to indicate a real issue
# ...and not silencable via a flag.
}

if [ ! -f "${MY_LOCATION}"/libtool_check_unique ] ; then
echo "libtool_check_unique not found. Please file an issue at github.com/bazelbuild/bazel"
exit 1
elif "${MY_LOCATION}"/libtool_check_unique "$@"; then
# If there are no duplicate .o basenames,
# libtool can be invoked with the original arguments.
"${WRAPPER}" libtool "$@"
libtool "$@"
exit
fi

Expand Down Expand Up @@ -131,4 +138,4 @@ for arg in "$@"; do
done

printf '%s\n' "${ARGS[@]}" > "$TEMPDIR/processed.params"
"${WRAPPER}" libtool "@$TEMPDIR/processed.params"
libtool "@$TEMPDIR/processed.params"