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

autogen then configure then make install yields non-working tree #1148

Closed
jbrandeb opened this issue Mar 22, 2018 · 3 comments
Closed

autogen then configure then make install yields non-working tree #1148

jbrandeb opened this issue Mar 22, 2018 · 3 comments

Comments

@jbrandeb
Copy link

jbrandeb commented Mar 22, 2018

Thanks for CppUtest!
When we are using a program that includes string.h or , then compile fails with this sequence:
./autogen.sh
./configure --prefix=~/cpputest
make
make install

cd examples
make CPPUTEST_HOME=~/cpputest
compiling HelloTest.cpp
/usr/include/string.h:166:37: error: expected identifier before string constant
 extern char *strdup (const char *__s)
                                     ^
/usr/include/string.h:166:37: error: expected ‘,’ or ‘...’ before string constant
In file included from <command-line>:0:0:
/home/jbrandeb/cpputest/include/CppUTest/MemoryLeakDetectorMallocMacros.h:62:21: error: conflicting declaration of C function ‘char* cpputest_strdup_location(const char*, int)’
 #define strdup(str) cpputest_strdup_location(str, __FILE__, __LINE__)
                     ^
/home/jbrandeb/cpputest/include/CppUTest/MemoryLeakDetectorMallocMacros.h:55:14: note: previous declaration ‘char* cpputest_strdup_location(const char*, const char*, int)’
 extern char* cpputest_strdup_location(const char* str, const char* file, int line);
              ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/string.h:174:55: error: expected identifier before string constant
 extern char *strndup (const char *__string, size_t __n)
                                                       ^
/usr/include/string.h:174:55: error: expected ‘,’ or ‘...’ before string constant
/home/jbrandeb/cpputest/include/CppUTest/MemoryLeakDetectorMallocMacros.h:63:25: error: conflicting declaration of C function ‘char* cpputest_strndup_location(const char*, size_t, int)’
 #define strndup(str, n) cpputest_strndup_location(str, n, __FILE__, __LINE__)
                         ^
/home/jbrandeb/cpputest/include/CppUTest/MemoryLeakDetectorMallocMacros.h:56:14: note: previous declaration ‘char* cpputest_strndup_location(const char*, size_t, const char*, int)’
 extern char* cpputest_strndup_location(const char* str, size_t n, const char* file, int line);
              ^~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [../build/MakefileWorker.mk:504: objs/AllTests/HelloTest.o] Error 1

I'll issue a pull request with the code changed to generate the bug.

@jbrandeb
Copy link
Author

#1149 has the example that fails to build. I've isolated it down to the fact that the cmake generated code doesn't have any of the new strdup code due to missing the HAVE_STRDUP define, which configure ends up with.

@jacob-keller
Copy link
Contributor

I think this is fixed by #1192

@jbrandeb
Copy link
Author

I think you're right, thanks Jake!

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

No branches or pull requests

2 participants