[Vm-dev] [Unix] UUID

Bert Freudenberg bert at freudenbergs.de
Sun Jun 3 19:20:07 UTC 2012


On 03.06.2012, at 04:54, David T. Lewis wrote:

> It's working for me. The header is /usr/include/uuid/uuid.h and CMake is
> generating a Makefile with the necessary "-I/usr/include/uuid" that allows
> the header to be found.
> 
> I'm not entirely sure how the CMake part works, I just know that it's working
> on my PC. The macro is implemented in platforms/unix/cmake/Plugins.cmake, so
> check to make sure that file is up to date also.
> 
> Dave

The problem is, at least on Fedora 14 (which OLPC's stable release is based on), if you install uuid-devel, there actually *is* a /usr/include/uuid.h. With the old config.cmake, at least the plugin was disabled. With the latest in SVN, the plugin is *not* disabled:

$ sudo yum install uuid-devel
...
$ ../unix/cmake/configure
-- UUIDPlugin: /usr/include/uuid.h
-- UUIDPlugin: sys/uuid.h not found
-- UUIDPlugin: libuuid not found
-- Looking for uuidgen
-- Looking for uuidgen - not found
-- Looking for uuid_generate
-- Looking for uuid_generate - not found

I think this is because CMake looks for any uuid.h, not specifically uuid/uuid.h. Consequently, compilation fails with an error, because it ends up using the wrong uuid.h:

$ make UUIDPlugin
Scanning dependencies of target UUIDPlugin
Building C object UUIDPlugin/CMakeFiles/UUIDPlugin.dir/home/olpc/Squeak-4.4.7.2357-src/unix/src/plugins/UUIDPlugin/UUIDPlugin.c.o
Building C object UUIDPlugin/CMakeFiles/UUIDPlugin.dir/home/olpc/Squeak-4.4.7.2357-src/unix/plugins/UUIDPlugin/sqUnixUUID.c.o
/home/olpc/Squeak-4.4.7.2357-src/unix/plugins/UUIDPlugin/sqUnixUUID.c: In function ‘MakeUUID’:
/home/olpc/Squeak-4.4.7.2357-src/unix/plugins/UUIDPlugin/sqUnixUUID.c:16:10: error: storage size of ‘uuid’ isn’t known
/home/olpc/Squeak-4.4.7.2357-src/unix/plugins/UUIDPlugin/sqUnixUUID.c: In function ‘sqUUIDInit’:
/home/olpc/Squeak-4.4.7.2357-src/unix/plugins/UUIDPlugin/sqUnixUUID.c:46:10: error: storage size of ‘uuid’ isn’t known
make[3]: *** [UUIDPlugin/CMakeFiles/UUIDPlugin.dir/home/olpc/Squeak-4.4.7.2357-src/unix/plugins/UUIDPlugin/sqUnixUUID.c.o] Error 1
make[2]: *** [UUIDPlugin/CMakeFiles/UUIDPlugin.dir/all] Error 2
make[1]: *** [UUIDPlugin/CMakeFiles/UUIDPlugin.dir/rule] Error 2
make: *** [UUIDPlugin] Error 2

After I install libuuid-devel, it *still* uses the wrong uuid.h:

$ sudo yum install libuuid-devel
$ ../unix/cmake/configure
-- UUIDPlugin: /usr/include/uuid.h
-- UUIDPlugin: sys/uuid.h not found
-- UUIDPlugin: /usr/lib/libuuid.so
$ make UUIDPlugin
Building C object UUIDPlugin/CMakeFiles/UUIDPlugin.dir/home/olpc/Squeak-4.4.7.2357-src/unix/plugins/UUIDPlugin/sqUnixUUID.c.o
/home/olpc/Squeak-4.4.7.2357-src/unix/plugins/UUIDPlugin/sqUnixUUID.c: In function ‘MakeUUID’:
/home/olpc/Squeak-4.4.7.2357-src/unix/plugins/UUIDPlugin/sqUnixUUID.c:16:10: error: storage size of ‘uuid’ isn’t known
/home/olpc/Squeak-4.4.7.2357-src/unix/plugins/UUIDPlugin/sqUnixUUID.c: In function ‘sqUUIDInit’:
/home/olpc/Squeak-4.4.7.2357-src/unix/plugins/UUIDPlugin/sqUnixUUID.c:46:10: error: storage size of ‘uuid’ isn’t known
make[3]: *** [UUIDPlugin/CMakeFiles/UUIDPlugin.dir/home/olpc/Squeak-4.4.7.2357-src/unix/plugins/UUIDPlugin/sqUnixUUID.c.o] Error 1
make[2]: *** [UUIDPlugin/CMakeFiles/UUIDPlugin.dir/all] Error 2
make[1]: *** [UUIDPlugin/CMakeFiles/UUIDPlugin.dir/rule] Error 2
make: *** [UUIDPlugin] Error 2

Only if I remove the other uuid.h, CMake and C picks up the right one:

$ sudo rpm -e uuid-devel
$ ../unix/cmake/configure
-- UUIDPlugin: /usr/include/uuid/uuid.h
-- UUIDPlugin: sys/uuid.h not found
-- UUIDPlugin: /usr/lib/libuuid.so
$ make UUIDPlugin
Scanning dependencies of target UUIDPlugin
Building C object UUIDPlugin/CMakeFiles/UUIDPlugin.dir/home/olpc/Squeak-4.4.7.2357-src/unix/src/plugins/UUIDPlugin/UUIDPlugin.c.o
Building C object UUIDPlugin/CMakeFiles/UUIDPlugin.dir/home/olpc/Squeak-4.4.7.2357-src/unix/plugins/UUIDPlugin/sqUnixUUID.c.o
Linking C shared module so.UUIDPlugin
Built target UUIDPlugin

Therefore, IMHO, it is essential that CMake looks for uuid/uuid.h, not just uuid.h, and that the C file includes uuid/uuid.h, not uuid.h.

Possibly you could simulate the problem by creating an empty /usr/include/uuid.h on your system?

- Bert -




More information about the Vm-dev mailing list