-
Notifications
You must be signed in to change notification settings - Fork 262
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
BUILD: drmemory build failure caused by strcasestr declaration error #2522
Comments
How much older? If this is changed is it going to break older toolchains? |
Re: older toolchains: I'm not sure, but I suspect it doesn't matter: Note that the fix would presumably be to just copy the check used by drltrace already present in the tree. |
Actually, I was being optimistic. The hits are all over the tree and applying a surgical fix is a lot of work. I went back through older glibc versions. strcasestr was added here (heh, back when I worked at Cygnus :-) ):
I downloaded glibc-2.1.1 from 1999 and it has The original definition (from glibc 2.1.1) was:
Today's definition (from glibc 2.40) is:
Both still use What do you want to do? |
Looks like the supplied strcasestr implementation is for Windows. It must have been missing from Linux somewhere? Though if it was there in 1999 that seems doubtful. Seems like making the supplied version Windows-only would be fine. #2429 has some overlap here. There /usr/include/string.h has a If nothing else but the C++ overload returns |
data point: I found this comment in utils_shared.c:
So it seems we do need to define this for linux for libraries "that do not want a libc dependence". |
The definition of strcasestr is char *strcasestr(const char *text, const char *pattern); but drmemory uses const char *strcasestr(const char *text, const char *pattern); This causes build errors when both /usr/include/string.h and common/utils.h are included in linux. The definition for strcasestr for C has always not had the `const` in the result type (going back to its original addition to glibc in 1997). Thus we're pretty safe in not breaking anything on *nix. The other main use case of drmemory's strcasestr is on Windows, which does not have strcasestr. Tested: $ cmake && make Fixes #2522
Open question: Why do current linux builds succeed? Unable to repro the success by replicating by hand, eg, ci-x86.yml. |
I would assume the GA VM compiler version doesn't give a warning while your local version does. |
Describe the bug
strcasestr's definition is char *(const char *, const char *) whereas drmemory/common/utils.h uses the older
const char *(const char *, const char *).
This causes a build failure on linux (64-bit, recent vintage).
To Reproduce
Steps to reproduce the behavior:
$ git clone https://github.com/DynamoRIO/drmemory.git
$ cd drmemory
$ ./make/git/dev-setup.sh
$ cd ..
$ mkdir build
$ cd build
$ cmake ../drmemory
$ make -k # other failures may be present: -k keeps going so that strcasestr failure is seen
Versions
The text was updated successfully, but these errors were encountered: