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

Can't build Dr. Memory when giving DR root as a relative path #67

Closed
derekbruening opened this issue Nov 28, 2014 · 17 comments
Closed

Can't build Dr. Memory when giving DR root as a relative path #67

derekbruening opened this issue Nov 28, 2014 · 17 comments

Comments

@derekbruening
Copy link
Contributor

From timurrrr@google.com on October 27, 2010 11:04:46

(Taken from my comments on r75 )
I build it with the following .bat file:
svn checkout -r 474 http://dynamorio.googlecode.com/svn/trunk/ dynamorio
mkdir dynamorio\build
cd dynamorio\build
cmake -G"NMake Makefiles" -DBUILD_DOCS:BOOL=OFF -DNTDLL_LIBPATH:FILEPATH=C:\WinDDK\7600.16385.1\lib\wxp\i386\ntdll.lib .. && nmake install
cmake -G"NMake Makefiles" -DDEBUG=ON -DBUILD_DOCS:BOOL=OFF -DNTDLL_LIBPATH:FILEPATH=C:\WinDDK\7600.16385.1\lib\wxp\i386\ntdll.lib .. && nmake install
cd ....
svn checkout -r 75 http://drmemory.googlecode.com/svn/trunk/ drmemory
mkdir drmemory\build
cd drmemory\build
cmake -G"NMake Makefiles" -DUSE_DRSYMS=ON -DDynamoRIO_DIR:FILEPATH=....\dynamorio\exports\cmake -DBUILD_DOCS:BOOL=OFF -DNTDLL_LIBPATH:FILEPATH=C:\WinDDK\7600.16385.1\lib\wxp\i386\ntdll.lib .. && nmake install

The last command fails with:
[ 36%] Building C object CMakeFiles/drmemorylib.dir/drmemory/replace.c.obj
replace.c
C:\drmemory-build\drmemory\drmemory\replace.c(517) : error C2059: syntax error : '{'
C:\drmemory-build\drmemory\drmemory\replace.c(519) : error C2143: syntax error : missing ';' before ','
C:\drmemory-build\drmemory\drmemory\replace.c(521) : error C2143: syntax error : missing ';' before ')'
C:\drmemory-build\drmemory\drmemory\replace.c(525) : error C2065: 'orig_addr' : undeclared identifier
C:\drmemory-build\drmemory\drmemory\replace.c(525) : warning C4047: 'function' : 'app_pc' differs in levels of indirection from 'int'
C:\drmemory-build\drmemory\drmemory\replace.c(525) : warning C4024: 'replace_all_strlen' : different types for formal and actual parameter 4
C:\drmemory-build\drmemory\drmemory\replace.c(529) : error C2059: syntax error : 'else'
C:\drmemory-build\drmemory\drmemory\replace.c(536) : error C2059: syntax error : 'if'
C:\drmemory-build\drmemory\drmemory\replace.c(538) : error C2059: syntax error : 'else'
C:\drmemory-build\drmemory\drmemory\replace.c(542) : error C2059: syntax error : '}'

Can you please run the same set of commands and verify it's working / fails?
I can't keep up with the source anymore!

Original issue: http://code.google.com/p/drmemory/issues/detail?id=67

@derekbruening
Copy link
Contributor Author

From timurrrr@google.com on October 27, 2010 08:23:33

With r79 , I get the following error:

cd drmemory\build
cmake -G"NMake Makefiles" -DUSE_DRSYMS=ON -DDynamoRIO_DIR:FILEPATH=....\dynamorio\exports\cmake -DBUILD_DOCS:BOOL=OFF -DNTDLL_LIBPATH:FILEPATH=C:\WinDDK\7600.16385.1\lib\wxp\i386\ntdll.lib .. && nmake install

CMake Warning at CMakeLists.txt:379 (find_package):
Could not find module FindDynamoRIO.cmake or a configuration file for
package DynamoRIO.

Adjust CMAKE_MODULE_PATH to find FindDynamoRIO.cmake or set DynamoRIO_DIR
to the directory containing a CMake configuration file for DynamoRIO. The
file will have one of the following names:

DynamoRIOConfig.cmake
dynamorio-config.cmake

... though there IS the file in Dynamorio_DIR!
C:\drmemory-build\drmemory\build>dir ....\dynamorio\exports\cmake
...
Directory of C:\drmemory-build\dynamorio\exports\cmake
...
27.10.2010 18:47 21 559 DynamoRIOConfig.cmake
27.10.2010 18:47 2 904 DynamoRIOConfigVersion.cmake
27.10.2010 18:52 2 501 DynamoRIOTarget32-noconfig.cmake
27.10.2010 18:47 1 272 DynamoRIOTarget32.cmake
...

@derekbruening
Copy link
Contributor Author

From derek.br...@gmail.com on October 27, 2010 08:47:51

r79 requires DR 2.1 so it requires a full build from the latest DR sources (b/c of DR issue #34)

@derekbruening
Copy link
Contributor Author

From derek.br...@gmail.com on October 27, 2010 08:48:02

r79 requires DR 2.1 so it requires a full build from the latest DR sources (b/c of DR issue #34)

@derekbruening
Copy link
Contributor Author

From timurrrr@google.com on October 27, 2010 09:27:00

r474 is the latest DR revision, isn't it?
What is the difference between "full build" and what I do?

@derekbruening
Copy link
Contributor Author

From derek.br...@gmail.com on October 27, 2010 09:31:24

I first tried your .bat with r75 and I did hit the "Could not find module FindDynamoRIO.cmake..." but when I switch its DynamoRIO_DIR to use an absolute path it configures and builds. With r79 I get the same behavior. Looks like a CMake issue: probably CMake cd's to a subdir and then references the path or something. In my own builds it looks like I'm always using absolute paths. With Unix Makefiles in cygwin I see the same behavior.

I have not been able to repro the TRY_EXCEPT syntax errors: I have to assume something prevented the newer DR exported include files from replacing the older. Can you repro that and check whether DR_TRY_EXCEPT is in the exported headers? It's building fine for me other than not working w/ the relative DynamoRIO_DIR path.

@derekbruening
Copy link
Contributor Author

From derek.br...@gmail.com on October 27, 2010 09:35:43

r474 is the latest DR revision, isn't it?

Yes, sorry, I didn't check before posting my comment. Dr. Memory r79 + requires DynamoRIO r469 +.

@derekbruening
Copy link
Contributor Author

From derek.br...@gmail.com on October 27, 2010 09:45:34

Interestingly when the build dir is not a child of the source dir (which is my standard practice and IMHO cleaner), a relative path for DynamoRIO_DIR does work.

@derekbruening
Copy link
Contributor Author

From timurrrr@google.com on October 27, 2010 10:06:12

r79 compiled fine with absolute path given to DynamoRIO_DIR
Looks like it was really trying to access some older DynamoRIO directory but no idea which one and why...
Ha! I also have r436 in the C:\dynamorio, maybe you've typed extra ".." somewhere in the CMake? Or is it my extra ".." in the DynamoRIO_DIR?...

Anyways, thank you very much for the quick help!

Status: Verified

@derekbruening
Copy link
Contributor Author

From timurrrr@google.com on October 27, 2010 10:07:24

"-DDynamoRIO_DIR:FILEPATH=..\dynamorio\exports\cmake" works. D'oh!

@derekbruening
Copy link
Contributor Author

From timurrrr@google.com on October 27, 2010 10:14:14

... but not quite entirely:
"CMake Error: File C:/drmemory-build/drmemory/build/../dynamorio/exports/cmake/../License.txt does not exist." at the very end.

@derekbruening
Copy link
Contributor Author

From timurrrr@google.com on October 27, 2010 10:22:57

Can you please fix this small issue? I'm not good at CMake...
(lowering to P:Low)

Summary: Can't build Dr. Memory when giving DR root as a relative path
Status: Accepted
Labels: -Priority-Critical Priority-Low

@derekbruening
Copy link
Contributor Author

From derek.br...@gmail.com on October 27, 2010 10:39:57

Can you re-list the exact command sequence you're using now? I'm not sure where you're putting your build dir, etc.

@derekbruening
Copy link
Contributor Author

From timurrrr@google.com on October 27, 2010 10:45:36

(in C:\drmemory-build)
svn checkout -r 474 http://dynamorio.googlecode.com/svn/trunk/ dynamorio
mkdir dynamorio\build
cd dynamorio\build
cmake -G"NMake Makefiles" -DBUILD_DOCS:BOOL=OFF -DNTDLL_LIBPATH:FILEPATH=C:\WinDDK\7600.16385.1\lib\wxp\i386\ntdll.lib .. && nmake install
cmake -G"NMake Makefiles" -DDEBUG=ON -DBUILD_DOCS:BOOL=OFF -DNTDLL_LIBPATH:FILEPATH=C:\WinDDK\7600.16385.1\lib\wxp\i386\ntdll.lib .. && nmake install
cd ....
svn checkout -r 79 http://drmemory.googlecode.com/svn/trunk/ drmemory
mkdir drmemory\build
cd drmemory\build
cmake -G"NMake Makefiles" -DUSE_DRSYMS=ON -DDynamoRIO_DIR:FILEPATH=..\dynamorio\exports\cmake -DBUILD_DOCS:BOOL=OFF -DNTDLL_LIBPATH:FILEPATH=C:\WinDDK\7600.16385.1\lib\wxp\i386\ntdll.lib .. && nmake install

@derekbruening
Copy link
Contributor Author

From derek.br...@gmail.com on October 27, 2010 10:49:58

uh, am I missing something? you're two dirs deep, so your "..\dynamorio" is invalid, so find_package() must be searching standard places like Program Files and your home dir, etc. to find DynamoRIO. it is weird that it seems to find something that works for building drmem but then it tries to use the invalid path you passed in for installing: that doesn't make sense. what is DynamoRIO_DIR set to in your drmemory\build\CMakeCache.txt?

@derekbruening
Copy link
Contributor Author

From timurrrr@google.com on October 27, 2010 11:17:22

drmemory\build\CMakeCache.txt:
173 //No help, variable specified on the command line.
174 DynamoRIO_DIR:FILEPATH=../dynamorio/exports/cmake

@derekbruening
Copy link
Contributor Author

From derek.br...@gmail.com on October 27, 2010 12:40:21

if you build without specifying DynamoRIO_DIR at all, it should all work, and then CMakeCache.txt should contain the path it used.

I believe some CMakeLists.txt changes are in order:

  • look at DynamoRIO_CONFIG to see what's really being used instead of DynamoRIO_DIR

@derekbruening
Copy link
Contributor Author

From derek.br...@gmail.com on November 02, 2010 14:51:49

in r80 : handle relative and invalid DynamoRIO_DIR paths

  • expand relative path wrt build dir
  • check for valid path to avoid surprises if another is found
  • use found path instead of specified path

can you verify it works for you (you should now be able to use the original .. paths you were using)

Status: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant