bwalex / tc-play

Free and simple TrueCrypt/VeraCrypt Implementation based on dm-crypt
BSD 2-Clause "Simplified" License
551 stars 56 forks source link

cmake Ubuntu deps missing #50

Closed r3cgm closed 10 years ago

r3cgm commented 10 years ago

On Ubuntu 13.10, there are two missing cmake hooks necessary to compile tc-play:

username@backup:~/tc-play/objdir$ cmake .. -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) CMake Error at CMakeLists.txt:30 (message): Could not find the devmapper library

-- Configuring incomplete, errors occurred!

The other one is the UUID library, which you can see cmake fail on if you swap the order of detection between devmapper and uuid:

username@backup:~/tc-play/objdir$ cmake .. -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) CMake Error at CMakeLists.txt:30 (message): Could not find the uuid library

-- Configuring incomplete, errors occurred!

These both result from cmake not having built-in modules for these libraries.

Would it be possible please to ship a version of FindUUID.cmake and FindDevMapper.cmake with tc-play, or otherwise update the README with extra instructions to build this package properly?

I realize this is more of a cmake issue than a tc-play issue, but it would be useful to have these instructions included with tc-play anyway.

bwalex commented 10 years ago

There is no such thing as FindUUID or FindDevMapper used in my CMakeLists - I use the FindPkgConfig module via pkg_check_modules. As far as I know, FindPkgConfig is a built-in. Do you have pkg-config installed? I would've expected it to be installed by default, but try:

apt-get install pkg-config
r3cgm commented 10 years ago

Great, the build now succeeds. Much nicer to have the objects and bins built in a segregated /objdir directory rather than intermixed in the main directory.

There was one minor warning which didn't seem to affect anything but I'll mention just for the sake of completeness.

/home/r3cgm/tc-play/tcplay.c: In function modify_volume': /home/r3cgm/tc-play/tcplay.c:1295:7: warning:offset_backup' may be used uninitialized in this function [-Wmaybe-uninitialized] if ((error = write_to_disk(dev, offset_backup, blksz, ^

I modified line 1175 from:

off_t offset, offset_backup;

to:

off_t offset, offset_backup = 0;

...and the warning went away, but I don't know if that's the preferred way to prevent this warning. If that looks correct I'd be happy to submit the change as a formal code patch.

Thanks for the response and for taking the time to create this tool.

bwalex commented 10 years ago

I know about that warning - it's bogus. The code through that function can never result in offset_backup being uninitialized, but the conditions ensuring it doesn't happen are non-trivial for the compiler.

I'll add a note to the README reminding people to install pkg-config before using the cmake approach.