xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH VTPM fix] Fix compilation bug with cmake
@ 2013-01-16 19:05 Matthew Fioravante
  2013-01-16 19:09 ` Matthew Fioravante
  0 siblings, 1 reply; 7+ messages in thread
From: Matthew Fioravante @ 2013-01-16 19:05 UTC (permalink / raw)
  To: xen-devel, Ian.Campbell; +Cc: Matthew Fioravante

Some older versions of cmake don't pass compiler
flags correctly when -DCMAKE_C_FLAGS and
-DCMAKE_C_COMPILER are both specified. This
behavior was observed on debian squeeze with
cmake 2.8.2. This patch fixes the bug by
using CC=${CC} cmake .. instead of
-DCMAKE_C_COMPILER.

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
---
 stubdom/Makefile |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/stubdom/Makefile b/stubdom/Makefile
index 71f4aeb..1109805 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -209,7 +209,7 @@ tpm_emulator-$(XEN_TARGET_ARCH): tpm_emulator-$(TPMEMU_VERSION).tar.gz
 	mv tpm_emulator-$(TPMEMU_VERSION) $@
 	patch -d $@ -p1 < tpmemu-$(TPMEMU_VERSION).patch;
 	mkdir $@/build
-	cd $@/build; $(CMAKE) .. -DCMAKE_C_COMPILER=${CC} -DCMAKE_C_FLAGS="-std=c99 -DTPM_NO_EXTERN $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-declaration-after-statement"
+	cd $@/build; CC=${CC} $(CMAKE) .. -DCMAKE_C_FLAGS="-std=c99 -DTPM_NO_EXTERN $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-declaration-after-statement"
 	touch $@
 
 TPMEMU_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libtpm.a
-- 
1.7.10.4

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

* Re: [PATCH VTPM fix] Fix compilation bug with cmake
  2013-01-16 19:05 [PATCH VTPM fix] Fix compilation bug with cmake Matthew Fioravante
@ 2013-01-16 19:09 ` Matthew Fioravante
  2013-01-17  9:47   ` Ian Campbell
  2013-01-17 13:51   ` Ian Campbell
  0 siblings, 2 replies; 7+ messages in thread
From: Matthew Fioravante @ 2013-01-16 19:09 UTC (permalink / raw)
  To: xen-devel@lists.xen.org, Ian.Campbell@citrix.com


[-- Attachment #1.1: Type: text/plain, Size: 1529 bytes --]

On 01/16/2013 02:05 PM, Matthew Fioravante wrote:
> Some older versions of cmake don't pass compiler
> flags correctly when -DCMAKE_C_FLAGS and
> -DCMAKE_C_COMPILER are both specified. This
> behavior was observed on debian squeeze with
> cmake 2.8.2. This patch fixes the bug by
> using CC=${CC} cmake .. instead of
> -DCMAKE_C_COMPILER.
Ian, can you test this patch on your system and see if make cross-tpmemu 
passes -DTPM_NO_EXTERN etc.. as it should?

This patch can go right ontop of the vtpm v9 set. If you want I can roll 
it into the original patch set and release a v10.
>
> Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
> ---
>   stubdom/Makefile |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/stubdom/Makefile b/stubdom/Makefile
> index 71f4aeb..1109805 100644
> --- a/stubdom/Makefile
> +++ b/stubdom/Makefile
> @@ -209,7 +209,7 @@ tpm_emulator-$(XEN_TARGET_ARCH): tpm_emulator-$(TPMEMU_VERSION).tar.gz
>   	mv tpm_emulator-$(TPMEMU_VERSION) $@
>   	patch -d $@ -p1 < tpmemu-$(TPMEMU_VERSION).patch;
>   	mkdir $@/build
> -	cd $@/build; $(CMAKE) .. -DCMAKE_C_COMPILER=${CC} -DCMAKE_C_FLAGS="-std=c99 -DTPM_NO_EXTERN $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-declaration-after-statement"
> +	cd $@/build; CC=${CC} $(CMAKE) .. -DCMAKE_C_FLAGS="-std=c99 -DTPM_NO_EXTERN $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-declaration-after-statement"
>   	touch $@
>   
>   TPMEMU_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libtpm.a



[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 1459 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [PATCH VTPM fix] Fix compilation bug with cmake
  2013-01-16 19:09 ` Matthew Fioravante
@ 2013-01-17  9:47   ` Ian Campbell
  2013-01-17  9:59     ` Ian Campbell
  2013-01-17 15:44     ` Fioravante, Matthew E.
  2013-01-17 13:51   ` Ian Campbell
  1 sibling, 2 replies; 7+ messages in thread
From: Ian Campbell @ 2013-01-17  9:47 UTC (permalink / raw)
  To: Matthew Fioravante; +Cc: xen-devel@lists.xen.org

On Wed, 2013-01-16 at 19:09 +0000, Matthew Fioravante wrote:
> On 01/16/2013 02:05 PM, Matthew Fioravante wrote:
> > Some older versions of cmake don't pass compiler
> > flags correctly when -DCMAKE_C_FLAGS and
> > -DCMAKE_C_COMPILER are both specified. This
> > behavior was observed on debian squeeze with
> > cmake 2.8.2. This patch fixes the bug by
> > using CC=${CC} cmake .. instead of
> > -DCMAKE_C_COMPILER.
> Ian, can you test this patch on your system and see if make cross-tpmemu 
> passes -DTPM_NO_EXTERN etc.. as it should?

I applied it to v9 and I'm afraid the result was:
        ld -nostdlib -L/local/scratch/ianc/devel/committer.git/stubdom/cross-root-x86_64/x86_64-xen-elf/lib  -m elf_x86_64 -T arch/x86/minios-x86_64.lds /local/scratch/ianc/devel/committer.git/stubdom/mini-os-x86_64-vtpm/mini-os.o  -o /local/scratch/ianc/devel/committer.git/stubdom/mini-os-x86_64-vtpm/mini-os
        ld: warning: section `.bss' type changed to PROGBITS
        /local/scratch/ianc/devel/committer.git/stubdom/mini-os-x86_64-vtpm/mini-os.o: In function `mkdirs':
        tpm_emulator_extern.c:(.text+0xbd95): undefined reference to `__errno_location'
        tpm_emulator_extern.c:(.text+0xbdad): undefined reference to `__errno_location'
        /local/scratch/ianc/devel/committer.git/stubdom/mini-os-x86_64-vtpm/mini-os.o: In function `_tpm_extern_init':
        tpm_emulator_extern.c:(.text+0xbe7f): undefined reference to `open'
        tpm_emulator_extern.c:(.text+0xbe9b): undefined reference to `__errno_location'
        /local/scratch/ianc/devel/committer.git/stubdom/mini-os-x86_64-vtpm/mini-os.o: In function `_tpm_write_to_storage':
        tpm_emulator_extern.c:(.text+0xc1e9): undefined reference to `open'
        /local/scratch/ianc/devel/committer.git/stubdom/mini-os-x86_64-vtpm/mini-os.o: In function `_tpm_read_from_storage':
        tpm_emulator_extern.c:(.text+0xc27b): undefined reference to `open'
        tpm_emulator_extern.c:(.text+0xc2a2): undefined reference to `lseek'
        tpm_emulator_extern.c:(.text+0xc2ba): undefined reference to `lseek'
        make[1]: *** [/local/scratch/ianc/devel/committer.git/stubdom/mini-os-x86_64-vtpm/mini-os] Error 1
        make[1]: Leaving directory `/local/scratch/ianc/devel/committer.git/extras/mini-os'
        make: *** [vtpm-stubdom] Error 2
        make: Leaving directory `/local/scratch/ianc/devel/committer.git/stubdom'

> This patch can go right ontop of the vtpm v9 set. If you want I can roll 
> it into the original patch set and release a v10.

I had v9 + this fix:

$ git log --oneline origin/staging..HEAD
3fff288 Fix compilation bug with cmake
36f6168 Add conditional build of subsystems to configure.ac
572bd96 Add a top level configure script
11d83aa stubdom: Add autoconf
3331272 README: Add cmake dependency
23d9686 Add vtpm documentation
5998e1e vtpm/vtpmmgr and required libs to stubdom/Makefile
799420c add stubdom/vtpmmgr code
7883739 add vtpm-stubdom code

Ian.

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

* Re: [PATCH VTPM fix] Fix compilation bug with cmake
  2013-01-17  9:47   ` Ian Campbell
@ 2013-01-17  9:59     ` Ian Campbell
  2013-01-17 15:44     ` Fioravante, Matthew E.
  1 sibling, 0 replies; 7+ messages in thread
From: Ian Campbell @ 2013-01-17  9:59 UTC (permalink / raw)
  To: Matthew Fioravante; +Cc: xen-devel@lists.xen.org

On Thu, 2013-01-17 at 09:47 +0000, Ian Campbell wrote:
> On Wed, 2013-01-16 at 19:09 +0000, Matthew Fioravante wrote:
> > On 01/16/2013 02:05 PM, Matthew Fioravante wrote:
> > > Some older versions of cmake don't pass compiler
> > > flags correctly when -DCMAKE_C_FLAGS and
> > > -DCMAKE_C_COMPILER are both specified. This
> > > behavior was observed on debian squeeze with
> > > cmake 2.8.2. This patch fixes the bug by
> > > using CC=${CC} cmake .. instead of
> > > -DCMAKE_C_COMPILER.
> > Ian, can you test this patch on your system and see if make cross-tpmemu 
> > passes -DTPM_NO_EXTERN etc.. as it should?
> 
> I applied it to v9 and I'm afraid the result was:
>         ld -nostdlib -L/local/scratch/ianc/devel/committer.git/stubdom/cross-root-x86_64/x86_64-xen-elf/lib  -m elf_x86_64 -T arch/x86/minios-x86_64.lds /local/scratch/ianc/devel/committer.git/stubdom/mini-os-x86_64-vtpm/mini-os.o  -o /local/scratch/ianc/devel/committer.git/stubdom/mini-os-x86_64-vtpm/mini-os
>         ld: warning: section `.bss' type changed to PROGBITS
>         /local/scratch/ianc/devel/committer.git/stubdom/mini-os-x86_64-vtpm/mini-os.o: In function `mkdirs':
>         tpm_emulator_extern.c:(.text+0xbd95): undefined reference to `__errno_location'
>         tpm_emulator_extern.c:(.text+0xbdad): undefined reference to `__errno_location'
>         /local/scratch/ianc/devel/committer.git/stubdom/mini-os-x86_64-vtpm/mini-os.o: In function `_tpm_extern_init':
>         tpm_emulator_extern.c:(.text+0xbe7f): undefined reference to `open'
>         tpm_emulator_extern.c:(.text+0xbe9b): undefined reference to `__errno_location'
>         /local/scratch/ianc/devel/committer.git/stubdom/mini-os-x86_64-vtpm/mini-os.o: In function `_tpm_write_to_storage':
>         tpm_emulator_extern.c:(.text+0xc1e9): undefined reference to `open'
>         /local/scratch/ianc/devel/committer.git/stubdom/mini-os-x86_64-vtpm/mini-os.o: In function `_tpm_read_from_storage':
>         tpm_emulator_extern.c:(.text+0xc27b): undefined reference to `open'
>         tpm_emulator_extern.c:(.text+0xc2a2): undefined reference to `lseek'
>         tpm_emulator_extern.c:(.text+0xc2ba): undefined reference to `lseek'
>         make[1]: *** [/local/scratch/ianc/devel/committer.git/stubdom/mini-os-x86_64-vtpm/mini-os] Error 1
>         make[1]: Leaving directory `/local/scratch/ianc/devel/committer.git/extras/mini-os'
>         make: *** [vtpm-stubdom] Error 2
>         make: Leaving directory `/local/scratch/ianc/devel/committer.git/stubdom'

These references are from the same file as before and my logs show:

[ 31%] Building C object tpm/CMakeFiles/tpm.dir/tpm_emulator_extern.o
        cd /local/scratch/ianc/devel/committer.git/stubdom/tpm_emulator-x86_64/build/tpm
         && /usr/lib/ccache/gcc   -I/opt/local/include
        -I/local/scratch/ianc/devel/committer.git/stubdom/tpm_emulator-x86_64
        -I/local/scratch/ianc/devel/committer.git/stubdom/tpm_emulator-x86_64/build  
         -Wall -Werror -Wno-unused-parameter -Wpointer-arith
        -Wcast-align
         -Wwrite-strings -Wextra -o
         CMakeFiles/tpm.dir/tpm_emulator_extern.o  
        -c /local/scratch/ianc/devel/committer.git/stubdom/tpm_emulator-x86_64/tpm/tpm_emulator_extern.c

IOW no -DTPM_NO_EXTERN.

The only use of TPM_NO_EXTERN in my logs is in the invocation of cmake:

        cd tpm_emulator-x86_64/build; CC=gcc /usr/bin/cmake .. 
        -DCMAKE_C_FLAGS="-std=c99 -DTPM_NO_EXTERN
        -isystem /local/scratch/ianc/devel/committer.git/stubdom/../extras/mini-os/include
        -D__MINIOS__ -DHAVE_LIBC
        -isystem /local/scratch/ianc/devel/committer.git/stubdom/../extras/mini-os/include/posix
        -isystem /local/scratch/ianc/devel/committer.git/stubdom/../tools/xenstore 
        -isystem /local/scratch/ianc/devel/committer.git/stubdom/../extras/mini-os/include/x86
        -isystem /local/scratch/ianc/devel/committer.git/stubdom/../extras/mini-os/include/x86/x86_64
        -U __linux__ -U __FreeBSD__ -U __sun__ -nostdinc
        -isystem /local/scratch/ianc/devel/committer.git/stubdom/../extras/mini-os/include/posix
        -isystem /local/scratch/ianc/devel/committer.git/stubdom/cross-root-x86_64/x86_64-xen-elf/include
        -isystem /usr/lib/gcc/x86_64-linux-gnu/4.4.5/include
        -isystem /local/scratch/ianc/devel/committer.git/stubdom/lwip-x86_64/src/include
        -isystem /local/scratch/ianc/devel/committer.git/stubdom/lwip-x86_64/src/include/ipv4
        -I/local/scratch/ianc/devel/committer.git/stubdom/include
        -I/local/scratch/ianc/devel/committer.git/stubdom/../xen/include
        -mno-red-zone -O1 -fno-omit-frame-pointer  -m64 -mno-red-zone
        -fno-reorder-blocks -fno-asynchronous-unwind-tables -m64 -g
        -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes
        -Wdeclaration-after-statement   -fno-stack-protector
        -fno-exceptions
        -Wno-declaration-after-statement"

Ian.

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

* Re: [PATCH VTPM fix] Fix compilation bug with cmake
  2013-01-16 19:09 ` Matthew Fioravante
  2013-01-17  9:47   ` Ian Campbell
@ 2013-01-17 13:51   ` Ian Campbell
  1 sibling, 0 replies; 7+ messages in thread
From: Ian Campbell @ 2013-01-17 13:51 UTC (permalink / raw)
  To: Matthew Fioravante; +Cc: xen-devel@lists.xen.org

On Wed, 2013-01-16 at 19:09 +0000, Matthew Fioravante wrote:
> This patch can go right ontop of the vtpm v9 set. If you want I can
> roll it into the original patch set and release a v10. 

If you need to do a v10 (i.e. if my failures are still real) then please
do. If we don't end up needing v10 then I'll do it when I apply.

If you do end up doing v10 and it isn't too hard could I get you to pull
three autoconf patches to the front? There are other patches which
depend on them and this way I can apply them even if we haven't got to
the bottom of these build issues yet.

Ian.

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

* Re: [PATCH VTPM fix] Fix compilation bug with cmake
  2013-01-17  9:47   ` Ian Campbell
  2013-01-17  9:59     ` Ian Campbell
@ 2013-01-17 15:44     ` Fioravante, Matthew E.
  2013-01-17 15:59       ` Ian Campbell
  1 sibling, 1 reply; 7+ messages in thread
From: Fioravante, Matthew E. @ 2013-01-17 15:44 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel@lists.xen.org

Did you rebuild cross-tpmemu from scratch? If tpm_emulator-x86_64/build/CmakeCache.txt exists before you apply this it wont work. Be sure to rm -rf tpm_emulator-x86_64 before application.

> -----Original Message-----
> From: Ian Campbell [mailto:Ian.Campbell@citrix.com]
> Sent: Thursday, January 17, 2013 4:47 AM
> To: Fioravante, Matthew E.
> Cc: xen-devel@lists.xen.org
> Subject: Re: [PATCH VTPM fix] Fix compilation bug with cmake
> 
> On Wed, 2013-01-16 at 19:09 +0000, Matthew Fioravante wrote:
> > On 01/16/2013 02:05 PM, Matthew Fioravante wrote:
> > > Some older versions of cmake don't pass compiler flags correctly
> > > when -DCMAKE_C_FLAGS and -DCMAKE_C_COMPILER are both specified.
> This
> > > behavior was observed on debian squeeze with cmake 2.8.2. This patch
> > > fixes the bug by using CC=${CC} cmake .. instead of
> > > -DCMAKE_C_COMPILER.
> > Ian, can you test this patch on your system and see if make
> > cross-tpmemu passes -DTPM_NO_EXTERN etc.. as it should?
> 
> I applied it to v9 and I'm afraid the result was:
>         ld -nostdlib -L/local/scratch/ianc/devel/committer.git/stubdom/cross-root-
> x86_64/x86_64-xen-elf/lib  -m elf_x86_64 -T arch/x86/minios-x86_64.lds
> /local/scratch/ianc/devel/committer.git/stubdom/mini-os-x86_64-vtpm/mini-
> os.o  -o /local/scratch/ianc/devel/committer.git/stubdom/mini-os-x86_64-
> vtpm/mini-os
>         ld: warning: section `.bss' type changed to PROGBITS
>         /local/scratch/ianc/devel/committer.git/stubdom/mini-os-x86_64-
> vtpm/mini-os.o: In function `mkdirs':
>         tpm_emulator_extern.c:(.text+0xbd95): undefined reference to
> `__errno_location'
>         tpm_emulator_extern.c:(.text+0xbdad): undefined reference to
> `__errno_location'
>         /local/scratch/ianc/devel/committer.git/stubdom/mini-os-x86_64-
> vtpm/mini-os.o: In function `_tpm_extern_init':
>         tpm_emulator_extern.c:(.text+0xbe7f): undefined reference to `open'
>         tpm_emulator_extern.c:(.text+0xbe9b): undefined reference to
> `__errno_location'
>         /local/scratch/ianc/devel/committer.git/stubdom/mini-os-x86_64-
> vtpm/mini-os.o: In function `_tpm_write_to_storage':
>         tpm_emulator_extern.c:(.text+0xc1e9): undefined reference to `open'
>         /local/scratch/ianc/devel/committer.git/stubdom/mini-os-x86_64-
> vtpm/mini-os.o: In function `_tpm_read_from_storage':
>         tpm_emulator_extern.c:(.text+0xc27b): undefined reference to `open'
>         tpm_emulator_extern.c:(.text+0xc2a2): undefined reference to `lseek'
>         tpm_emulator_extern.c:(.text+0xc2ba): undefined reference to `lseek'
>         make[1]: *** [/local/scratch/ianc/devel/committer.git/stubdom/mini-os-
> x86_64-vtpm/mini-os] Error 1
>         make[1]: Leaving directory
> `/local/scratch/ianc/devel/committer.git/extras/mini-os'
>         make: *** [vtpm-stubdom] Error 2
>         make: Leaving directory `/local/scratch/ianc/devel/committer.git/stubdom'
> 
> > This patch can go right ontop of the vtpm v9 set. If you want I can
> > roll it into the original patch set and release a v10.
> 
> I had v9 + this fix:
> 
> $ git log --oneline origin/staging..HEAD
> 3fff288 Fix compilation bug with cmake
> 36f6168 Add conditional build of subsystems to configure.ac
> 572bd96 Add a top level configure script 11d83aa stubdom: Add autoconf
> 3331272 README: Add cmake dependency
> 23d9686 Add vtpm documentation
> 5998e1e vtpm/vtpmmgr and required libs to stubdom/Makefile 799420c add
> stubdom/vtpmmgr code
> 7883739 add vtpm-stubdom code
> 
> Ian.

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

* Re: [PATCH VTPM fix] Fix compilation bug with cmake
  2013-01-17 15:44     ` Fioravante, Matthew E.
@ 2013-01-17 15:59       ` Ian Campbell
  0 siblings, 0 replies; 7+ messages in thread
From: Ian Campbell @ 2013-01-17 15:59 UTC (permalink / raw)
  To: Fioravante, Matthew E.; +Cc: xen-devel@lists.xen.org

On Thu, 2013-01-17 at 15:44 +0000, Fioravante, Matthew E. wrote:
> Did you rebuild cross-tpmemu from scratch? If
> tpm_emulator-x86_64/build/CmakeCache.txt exists before you apply this
> it wont work. Be sure to rm -rf tpm_emulator-x86_64 before
> application.

I used my usual script which includes a "make distclean" and a "git
clean -f -dx". These are pretty thorough and remove *-x86_64.

Ian.

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

end of thread, other threads:[~2013-01-17 15:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-16 19:05 [PATCH VTPM fix] Fix compilation bug with cmake Matthew Fioravante
2013-01-16 19:09 ` Matthew Fioravante
2013-01-17  9:47   ` Ian Campbell
2013-01-17  9:59     ` Ian Campbell
2013-01-17 15:44     ` Fioravante, Matthew E.
2013-01-17 15:59       ` Ian Campbell
2013-01-17 13:51   ` Ian Campbell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).