DM-Crypt Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [dm-crypt] odd behavior with libcryptsetup.h
@ 2012-05-28  6:42 .. ink ..
  2012-05-28  7:00 ` Colin Misare
  0 siblings, 1 reply; 3+ messages in thread
From: .. ink .. @ 2012-05-28  6:42 UTC (permalink / raw)
  To: dm-crypt

#include <libcryptsetup.h>

int main( void )
{
	return 0 ;
}

A source file with the above code named "crypt.c" errors out when
compiling it with the following command:

gcc -o crypt crypt.c -I/include

"libcryptsetup.h" is located at "'/include" in my distro.
gcc version is 4.5.1.

The compile pass if i add any standard library header i have tried
above the libcryptsetup.h header,if its below or not present, the
compilation fail with below error. I googled why this happens but
havent found anything. using cryptsetup version 1.4.2

Errors produced are below.

gcc -o crypt crypt.c -I/include
In file included from crypt.c:3:0:
/include/libcryptsetup.h:187:46: error: expected declaration
specifiers or ‘...’ before ‘size_t’
/include/libcryptsetup.h:336:2: error: expected
specifier-qualifier-list before ‘size_t’
In file included from crypt.c:3:0:
/include/libcryptsetup.h:380:2: error: expected declaration specifiers
or ‘...’ before ‘size_t’
/include/libcryptsetup.h:474:2: error: expected declaration specifiers
or ‘...’ before ‘size_t’
/include/libcryptsetup.h:492:2: error: expected declaration specifiers
or ‘...’ before ‘size_t’
/include/libcryptsetup.h:493:2: error: expected declaration specifiers
or ‘...’ before ‘size_t’
/include/libcryptsetup.h:501:2: error: expected declaration specifiers
or ‘...’ before ‘size_t’
/include/libcryptsetup.h:537:2: error: expected declaration specifiers
or ‘...’ before ‘size_t’
/include/libcryptsetup.h:539:2: error: expected declaration specifiers
or ‘...’ before ‘size_t’
/include/libcryptsetup.h:573:2: error: expected declaration specifiers
or ‘...’ before ‘size_t’
/include/libcryptsetup.h:574:2: error: expected declaration specifiers
or ‘...’ before ‘size_t’
/include/libcryptsetup.h:576:2: error: expected declaration specifiers
or ‘...’ before ‘size_t’
/include/libcryptsetup.h:577:2: error: expected declaration specifiers
or ‘...’ before ‘size_t’
/include/libcryptsetup.h:584:2: error: expected declaration specifiers
or ‘...’ before ‘size_t’
/include/libcryptsetup.h:586:2: error: expected declaration specifiers
or ‘...’ before ‘size_t’
/include/libcryptsetup.h:606:2: error: expected declaration specifiers
or ‘...’ before ‘size_t’
/include/libcryptsetup.h:608:2: error: expected declaration specifiers
or ‘...’ before ‘size_t’
/include/libcryptsetup.h:686:2: error: expected declaration specifiers
or ‘...’ before ‘size_t’
/include/libcryptsetup.h:706:2: error: expected declaration specifiers
or ‘...’ before ‘size_t’
/include/libcryptsetup.h:707:2: error: expected declaration specifiers
or ‘...’ before ‘size_t’
/include/libcryptsetup.h:716:2: error: expected declaration specifiers
or ‘...’ before ‘size_t’
/include/libcryptsetup.h:738:2: error: expected declaration specifiers
or ‘...’ before ‘size_t’
/include/libcryptsetup.h:770:2: error: expected declaration specifiers
or ‘...’ before ‘size_t’
/include/libcryptsetup.h:772:2: error: expected declaration specifiers
or ‘...’ before ‘size_t’
/include/libcryptsetup.h:785:2: error: expected declaration specifiers
or ‘...’ before ‘size_t’
/include/libcryptsetup.h:963:59: error: expected declaration
specifiers or ‘...’ before ‘size_t’
/include/libcryptsetup.h:974:33: error: expected declaration
specifiers or ‘...’ before ‘size_t’

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dm-crypt] odd behavior with libcryptsetup.h
  2012-05-28  6:42 [dm-crypt] odd behavior with libcryptsetup.h .. ink ..
@ 2012-05-28  7:00 ` Colin Misare
  2012-05-28  7:47   ` Milan Broz
  0 siblings, 1 reply; 3+ messages in thread
From: Colin Misare @ 2012-05-28  7:00 UTC (permalink / raw)
  To: .. ink ..; +Cc: dm-crypt

[-- Attachment #1: Type: text/plain, Size: 4239 bytes --]

I see this behaviour as well with gcc 4.6.3 using the libcryptset.h from
git.

Some quick searching on Googe leads me to believe that size_t is supposed
to be in stddef.h. Like you noted simply adding that fixes the compilation.

diff --git a/lib/libcryptsetup.h b/lib/libcryptsetup.h
index 2b10add..e4b384f 100644
--- a/lib/libcryptsetup.h
+++ b/lib/libcryptsetup.h
@@ -33,6 +33,7 @@
 extern "C" {
 #endif

+#include <stddef.h>
 #include <stdint.h>

 struct crypt_device; /* crypt device handle */

On Mon, May 28, 2012 at 12:42 AM, .. ink .. <mhogomchungu@gmail.com> wrote:

> #include <libcryptsetup.h>
>
> int main( void )
> {
>        return 0 ;
> }
>
> A source file with the above code named "crypt.c" errors out when
> compiling it with the following command:
>
> gcc -o crypt crypt.c -I/include
>
> "libcryptsetup.h" is located at "'/include" in my distro.
> gcc version is 4.5.1.
>
> The compile pass if i add any standard library header i have tried
> above the libcryptsetup.h header,if its below or not present, the
> compilation fail with below error. I googled why this happens but
> havent found anything. using cryptsetup version 1.4.2
>
> Errors produced are below.
>
> gcc -o crypt crypt.c -I/include
> In file included from crypt.c:3:0:
> /include/libcryptsetup.h:187:46: error: expected declaration
> specifiers or ‘...’ before ‘size_t’
> /include/libcryptsetup.h:336:2: error: expected
> specifier-qualifier-list before ‘size_t’
> In file included from crypt.c:3:0:
> /include/libcryptsetup.h:380:2: error: expected declaration specifiers
> or ‘...’ before ‘size_t’
> /include/libcryptsetup.h:474:2: error: expected declaration specifiers
> or ‘...’ before ‘size_t’
> /include/libcryptsetup.h:492:2: error: expected declaration specifiers
> or ‘...’ before ‘size_t’
> /include/libcryptsetup.h:493:2: error: expected declaration specifiers
> or ‘...’ before ‘size_t’
> /include/libcryptsetup.h:501:2: error: expected declaration specifiers
> or ‘...’ before ‘size_t’
> /include/libcryptsetup.h:537:2: error: expected declaration specifiers
> or ‘...’ before ‘size_t’
> /include/libcryptsetup.h:539:2: error: expected declaration specifiers
> or ‘...’ before ‘size_t’
> /include/libcryptsetup.h:573:2: error: expected declaration specifiers
> or ‘...’ before ‘size_t’
> /include/libcryptsetup.h:574:2: error: expected declaration specifiers
> or ‘...’ before ‘size_t’
> /include/libcryptsetup.h:576:2: error: expected declaration specifiers
> or ‘...’ before ‘size_t’
> /include/libcryptsetup.h:577:2: error: expected declaration specifiers
> or ‘...’ before ‘size_t’
> /include/libcryptsetup.h:584:2: error: expected declaration specifiers
> or ‘...’ before ‘size_t’
> /include/libcryptsetup.h:586:2: error: expected declaration specifiers
> or ‘...’ before ‘size_t’
> /include/libcryptsetup.h:606:2: error: expected declaration specifiers
> or ‘...’ before ‘size_t’
> /include/libcryptsetup.h:608:2: error: expected declaration specifiers
> or ‘...’ before ‘size_t’
> /include/libcryptsetup.h:686:2: error: expected declaration specifiers
> or ‘...’ before ‘size_t’
> /include/libcryptsetup.h:706:2: error: expected declaration specifiers
> or ‘...’ before ‘size_t’
> /include/libcryptsetup.h:707:2: error: expected declaration specifiers
> or ‘...’ before ‘size_t’
> /include/libcryptsetup.h:716:2: error: expected declaration specifiers
> or ‘...’ before ‘size_t’
> /include/libcryptsetup.h:738:2: error: expected declaration specifiers
> or ‘...’ before ‘size_t’
> /include/libcryptsetup.h:770:2: error: expected declaration specifiers
> or ‘...’ before ‘size_t’
> /include/libcryptsetup.h:772:2: error: expected declaration specifiers
> or ‘...’ before ‘size_t’
> /include/libcryptsetup.h:785:2: error: expected declaration specifiers
> or ‘...’ before ‘size_t’
> /include/libcryptsetup.h:963:59: error: expected declaration
> specifiers or ‘...’ before ‘size_t’
> /include/libcryptsetup.h:974:33: error: expected declaration
> specifiers or ‘...’ before ‘size_t’
> _______________________________________________
> dm-crypt mailing list
> dm-crypt@saout.de
> http://www.saout.de/mailman/listinfo/dm-crypt
>

[-- Attachment #2: Type: text/html, Size: 4868 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [dm-crypt] odd behavior with libcryptsetup.h
  2012-05-28  7:00 ` Colin Misare
@ 2012-05-28  7:47   ` Milan Broz
  0 siblings, 0 replies; 3+ messages in thread
From: Milan Broz @ 2012-05-28  7:47 UTC (permalink / raw)
  To: Colin Misare; +Cc: dm-crypt, .. ink ..

On 05/28/2012 09:00 AM, Colin Misare wrote:
> I see this behaviour as well with gcc 4.6.3 using the libcryptset.h from git.
> 
> Some quick searching on Googe leads me to believe that size_t is
> supposed to be in stddef.h. Like you noted simply adding that fixes
> the compilation.

Yes, it should be included in header itself.
Actually I just fixed it before I read your reply here... :)

http://code.google.com/p/cryptsetup/source/detail?r=65c4c62f78e07408081a20f1bea2b29212b85e01#

Thanks,
Milan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-05-28  7:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-28  6:42 [dm-crypt] odd behavior with libcryptsetup.h .. ink ..
2012-05-28  7:00 ` Colin Misare
2012-05-28  7:47   ` Milan Broz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox