[LLVMdev] CommandLine.cpp:189: error: `strdup' undeclared

Henrik Bach henrik_bach_llvm at hotmail.com
Sat Jul 3 09:30:03 PDT 2004


Hi Guys

I'm trying to port and build LLVM to the Interix environment. I've succeded 
until the Interix version of gcc program executes:

Before the patch:

gmake[1]: Entering directory `/usr/local/src/llvm/lib/Support'
gmake[1]: Leaving directory `/usr/local/src/llvm/lib/Support'
gmake[1]: Entering directory `/usr/local/src/llvm/lib/Support'
Compiling CommandLine.cpp
CommandLine.cpp: In function `void ParseCStringVector(std::vector<char*,
   std::allocator<char*> >&, const char*)':
CommandLine.cpp:189: error: `strdup' undeclared (first use this function)
CommandLine.cpp:189: error: (Each undeclared identifier is reported only 
once
   for each function it appears in.)
CommandLine.cpp: In function `void llvm::cl::ParseEnvironmentOptions(const
   char*, const char*, const char*)':
CommandLine.cpp:230: error: `strdup' undeclared (first use this function)
gmake[1]: *** [/usr/local/src/llvm/lib/Support/Debug/CommandLine.lo] Error 1
gmake[1]: Leaving directory `/usr/local/src/llvm/lib/Support'
gmake: *** [all] Error 1

After the patch:

gmake[1]: Entering directory `/usr/local/src/llvm/lib/Support'
gmake[1]: Leaving directory `/usr/local/src/llvm/lib/Support'
gmake[1]: Entering directory `/usr/local/src/llvm/lib/Support'
Compiling CommandLine.cpp
CommandLine.cpp: In function `void ParseCStringVector(std::vector<char*,
   std::allocator<char*> >&, const char*)':
CommandLine.cpp:190: error: `strdup' undeclared (first use this function)
CommandLine.cpp:190: error: (Each undeclared identifier is reported only 
once
   for each function it appears in.)
CommandLine.cpp: In function `void llvm::cl::ParseEnvironmentOptions(const
   char*, const char*, const char*)':
CommandLine.cpp:231: error: `strdup' undeclared (first use this function)
gmake[1]: *** [/usr/local/src/llvm/lib/Support/Debug/CommandLine.lo] Error 1
gmake[1]: Leaving directory `/usr/local/src/llvm/lib/Support'
gmake: *** [all] Error 1

It seems that the declaration of strdup is still missing.

I've ran a test run in the Support directory and the outcome was this:

%cd where-you-want-llvm-to-live
%cd cd lib/Support/
%gcc -c CommandLine.cpp -o CommandLine.o 2>&1 | tee -a Make.log
...
CommandLine.cpp:178: error: `input' undeclared (first use this function)
CommandLine.cpp:190: error: `output' undeclared (first use this function)
CommandLine.cpp:190: error: `strdup' undeclared (first use this function)
...
%

Line 178 and and the 1st line 190 (input and output) is not present when 
building via the supplied make file. I suspect it is a include path that's 
not correct. Where do your <string> and <cstring> live in the view of GCC 
and the make file?

I have a <cstring> located in '/opt/gcc.3.3/include/c++/3.3' and <string> 
located more places including in the listed directory.

My version of LLVM is 1.2 and gcc 3.3.


/Henrik

_________________________________________________________________
Få alle de nye og sjove ikoner med MSN Messenger http://www.msn.dk/messenger




More information about the llvm-dev mailing list