Skip to contentSkip to conversation

stubdom/libxc-x86_64 compile error with valgrind installed

DISCUSSION Simon Martin 4 participants 11 messages Jul 21, 2014

lore
Share & tools
lore
#0 lore raw

Hello all,

I am building on Debian Wheezy and I have valgrind installed. About a month ago I started having compilation problems. I assume it must have something to do with Andrew's valgrind patch of June 10th.

The problem seems to lie in the fact that valgrind is in /usr/include, however -nostdinc is specified on the compilation so we don't get it.

I removed -nostdinc from stubdom/Makefile and it compiled correctly. Reading the gcc documentation this *should* be safe, as it will only
search the default directories *after* the explicit include
directories. That being said, there is probably a better fix for this.

Regards.

Signature · 2 lines
Best regards,
 Simon                          mailto:[email protected]
#1 lore raw
Quoted 6 lines · Simon Martin

Hello all,

I am building on Debian Wheezy and I have valgrind installed. About a month ago I started having compilation problems. I assume it must have something to do with Andrew's valgrind patch of June 10th.

Quoted 7 lines

The problem seems to lie in the fact that valgrind is in /usr/include, however -nostdinc is specified on the compilation so we don't get it.

I removed -nostdinc from stubdom/Makefile and it compiled correctly. Reading the gcc documentation this *should* be safe, as it will only
search the default directories *after* the explicit include
directories. That being said, there is probably a better fix for this.

The best fix would be to teach tools/configure.ac about stubdom builds somehow and pass the appropriate options when configuring.

The quick fix is probably to tools/libxc/xc_private.h:
-#if defined(HAVE_VALGRIND_MEMCHECK_H) && !defined(NDEBUG)
+#if defined(HAVE_VALGRIND_MEMCHECK_H) && !defined(NDEBUG) && !defined(__MINIOS__)

Does that work for you?

Ian.

#2 lore raw

Hello Ian,

Quoted 5 lines

The quick fix is probably to tools/libxc/xc_private.h:

(quoted diff) +1 -1
-#if defined(HAVE_VALGRIND_MEMCHECK_H) && !defined(NDEBUG)
+#if defined(HAVE_VALGRIND_MEMCHECK_H) && !defined(NDEBUG) && !defined(__MINIOS__)

Does that work for you?

Works here. Thanks.

Signature · 2 lines
Best regards,
 Simon                            mailto:[email protected]
#3 lore raw
In reply to Simon Martin
Quoted 9 lines · Simon Martin

Hello all,

I am building on Debian Wheezy and I have valgrind installed. About a month ago I started having compilation problems. I assume it must have something to do with Andrew's valgrind patch of June 10th.

The problem seems to lie in the fact that valgrind is in /usr/include, however -nostdinc is specified on the compilation so we don't get it.

Quoted 7 lines

I removed -nostdinc from stubdom/Makefile and it compiled correctly. Reading the gcc documentation this *should* be safe, as it will only
search the default directories *after* the explicit include
directories. That being said, there is probably a better fix for this.

Regards.

The problem is that stubdoms are blindly using the regular environment config.h without reconfiguring libxc for their reduced environment.

As a result, config.h is correctly stating that memcheck.h exists in the regular environment, even when it is included into the reduced stubdom environment.

While removing -nostdinc does fix your problem, it is not the correct fix. memcheck.h is safe to use in this instance, but most header files you find in /usr/include are not.

I am not sure what is the correct solution here is. Introducing an explicit --{en,dis}able-valgrind to the main ./configure will still break for anyone who chooses to enable it. I suspect a fix involves someone draining the swamp which is the stubdom build system.

~Andrew

#4 lore raw
Quoted 3 lines · Andrew Cooper

I am not sure what is the correct solution here is. Introducing an explicit --{en,dis}able-valgrind to the main ./configure will still break for anyone who chooses to enable it.

I proposed a bodge which I think would be acceptable (assuming it works)

Quoted 2 lines

I suspect a fix involves
someone draining the swamp which is the stubdom build system.

I'm hopeful that the rump kernel work will at least reduce it to a manageable mire...

Ian.

#5 lore raw
Quoted 5 lines · Ian Campbell
Quoted 3 lines · Andrew Cooper

I am not sure what is the correct solution here is. Introducing an explicit --{en,dis}able-valgrind to the main ./configure will still break for anyone who chooses to enable it.

I proposed a bodge which I think would be acceptable (assuming it works)

I saw. It most certainly is a bodge, but is probably the best short term course of action.

Doesn't it need an extra check for the rump stuff?

Quoted 8 lines
Quoted 3 lines

I suspect a fix involves
someone draining the swamp which is the stubdom build system.

I'm hopeful that the rump kernel work will at least reduce it to a manageable mire...

Ian.

Lets hope!

~Andrew

#6 lore raw
Quoted 11 lines · Andrew Cooper
Quoted 5 lines · Ian Campbell
Quoted 3 lines · Andrew Cooper

I am not sure what is the correct solution here is. Introducing an explicit --{en,dis}able-valgrind to the main ./configure will still break for anyone who chooses to enable it.

I proposed a bodge which I think would be acceptable (assuming it works)

I saw. It most certainly is a bodge, but is probably the best short term course of action.

Doesn't it need an extra check for the rump stuff?

I don't know...

Ian, the proposal is tools/libxc/xc_private.h:
-#if defined(HAVE_VALGRIND_MEMCHECK_H) && !defined(NDEBUG)
+#if defined(HAVE_VALGRIND_MEMCHECK_H) && !defined(NDEBUG) && !defined(__MINIOS__)

Ian.

#7 lore raw
Quoted 17 lines · Ian Campbell
Quoted 10 lines · Andrew Cooper
Quoted 5 lines · Ian Campbell
Quoted 3 lines · Andrew Cooper

I am not sure what is the correct solution here is. Introducing an explicit --{en,dis}able-valgrind to the main ./configure will still break for anyone who chooses to enable it.

I proposed a bodge which I think would be acceptable (assuming it works)

I saw. It most certainly is a bodge, but is probably the best short term course of action.

Doesn't it need an extra check for the rump stuff?

I don't know...

Ian, the proposal is tools/libxc/xc_private.h:

(quoted diff) +1 -1
-#if defined(HAVE_VALGRIND_MEMCHECK_H) && !defined(NDEBUG)
+#if defined(HAVE_VALGRIND_MEMCHECK_H) && !defined(NDEBUG) && !defined(__MINIOS__)
Quoted 2 lines

Ian.

Nor do I, but IanJ's series changed most (all?) the #if !defined(__MINIOS__) into #if !defined(__MINIOS__) || !defined(__RUMPUSER_XEN__)

Therefore, I suspect the same is needed here.

~Andrew

#8 lore raw
Quoted 18 lines · Andrew Cooper
Quoted 17 lines · Ian Campbell
Quoted 10 lines · Andrew Cooper
Quoted 5 lines · Ian Campbell
Quoted 3 lines · Andrew Cooper

I am not sure what is the correct solution here is. Introducing an explicit --{en,dis}able-valgrind to the main ./configure will still break for anyone who chooses to enable it.

I proposed a bodge which I think would be acceptable (assuming it works)

I saw. It most certainly is a bodge, but is probably the best short term course of action.

Doesn't it need an extra check for the rump stuff?

I don't know...

Ian, the proposal is tools/libxc/xc_private.h:

(quoted diff) +1 -1
-#if defined(HAVE_VALGRIND_MEMCHECK_H) && !defined(NDEBUG)
+#if defined(HAVE_VALGRIND_MEMCHECK_H) && !defined(NDEBUG) && !defined(__MINIOS__)
Quoted 8 lines
Quoted 2 lines

Ian.

Nor do I, but IanJ's series changed most (all?) the #if !defined(__MINIOS__) into #if !defined(__MINIOS__) || !defined(__RUMPUSER_XEN__)

Therefore, I suspect the same is needed here.

&& rather than || in this case though I think?

Ian.

#9 lore raw
Quoted 26 lines · Ian Campbell
Quoted 25 lines · Andrew Cooper
Quoted 17 lines · Ian Campbell
Quoted 10 lines · Andrew Cooper
Quoted 5 lines · Ian Campbell
Quoted 3 lines · Andrew Cooper

I am not sure what is the correct solution here is. Introducing an explicit --{en,dis}able-valgrind to the main ./configure will still break for anyone who chooses to enable it.

I proposed a bodge which I think would be acceptable (assuming it works)

I saw. It most certainly is a bodge, but is probably the best short term course of action.

Doesn't it need an extra check for the rump stuff?

I don't know...

Ian, the proposal is tools/libxc/xc_private.h:

(quoted diff) +1 -1
-#if defined(HAVE_VALGRIND_MEMCHECK_H) && !defined(NDEBUG)
+#if defined(HAVE_VALGRIND_MEMCHECK_H) && !defined(NDEBUG) && !defined(__MINIOS__)
Quoted 2 lines

Ian.

Nor do I, but IanJ's series changed most (all?) the #if !defined(__MINIOS__) into #if !defined(__MINIOS__) || !defined(__RUMPUSER_XEN__)

Quoted 3 lines
Quoted 1 line

Therefore, I suspect the same is needed here.

&& rather than || in this case though I think?

That said -- I'd have hoped that the rumpkernel changes would have resulted in !HAVE_VALGRIND_MEMCHECK_H, so maybe not?

Ian.

#10 lore raw
In reply to Andrew Cooper

Andrew Cooper writes ("Re: [Xen-devel] stubdom/libxc-x86_64 compile error with valgrind installed"):

Quoted 8 lines · Ian Campbell
Quoted 7 lines · Andrew Cooper
Quoted 1 line

Doesn't it need an extra check for the rump stuff?

I don't know...

Ian, the proposal is tools/libxc/xc_private.h:

(quoted diff) +1 -1
-#if defined(HAVE_VALGRIND_MEMCHECK_H) && !defined(NDEBUG)
+#if defined(HAVE_VALGRIND_MEMCHECK_H) && !defined(NDEBUG) && !defined(__MINIOS__)

...

Quoted 5 lines

Nor do I, but IanJ's series changed most (all?) the #if !defined(__MINIOS__) into #if !defined(__MINIOS__) || !defined(__RUMPUSER_XEN__)

Therefore, I suspect the same is needed here.

No, this bodge isn't needed for __RUMPUSER_XEN__. The rump kernel build runs configure with the rump kernel build system which doesn't see the system's valgrind.h. I.e., the rump kernel build environment used for building tools/libxc/ doesn't have the bug that the stubdom build system has.

There are some __RUMPUSER_XEN__ in libxc but they are just for selecting the right implementations of various components - in particular, to make hypercalls directly but use the devices in /dev/ for xenstore and evtchn. (And for disabling dynamic loading.)

Ian.