Opened 13 years ago
Closed 13 years ago
#31734 closed defect (fixed)
VirtualBox 4.1.6 doesn't work with Lion and Xcode 4.2
Reported by: | jk@… | Owned by: | royliu@… |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.0.3 |
Keywords: | Cc: | ryandesign (Ryan Carsten Schmidt) | |
Port: | virtualbox |
Description
Virtualbox is unable to find libvncserver. Reinstalling LibVNCServer (@0.9.8.1) does not help.
Attachments (6)
Change History (54)
Changed 13 years ago by jk@…
comment:1 follow-up: 3 Changed 13 years ago by royliu@…
Owner: | changed from macports-tickets@… to royliu@… |
---|
comment:2 Changed 13 years ago by mf2k (Frank Schima)
Cc: | nomaintainer@… removed |
---|---|
Port: | @4.1.4 removed |
It is not useful to Cc nomaintainer.
comment:3 Changed 13 years ago by jk@…
Replying to royliu@…:
What does your VirtualBox
configure.log
say? Does it provide more information on top of MacPorts'main.log
?
configure.log:
***** Checking libvncserver ***** compiling the following source file: #include <cstdio> #include <rfb/rfbconfig.h> extern "C" int main() { const char* v=LIBVNCSERVER_VERSION; unsigned int major = 0, minor = 0, micro = 0; for (; *v !='.' && *v != '\0'; v++) major = major*10 + *v-'0'; if (*v == '.') v++; for (; *v !='.' && *v != '\0'; v++) minor = minor*10 + *v-'0'; if (*v == '.') v++; for (; *v !='.' && *v != '\0'; v++) micro = micro*10 + *v-'0'; printf("found version %s", LIBVNCSERVER_PACKAGE_VERSION); if (major*10000 + minor*100 + micro >= 907) { printf(", OK.\n"); return 0; } else { printf(", expected version 0.9.7 or higher\n"); return 1; } } using the following command line: /Developer/usr/bin/clang++ -mmacosx-version-min=10.6 -isysroot /Developer/SDKs/MacOSX10.6.sdk -Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk -g -O -Wall -o /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_emulators_virtualbox/virtualbox/work/VirtualBox-4.1.4_OSE/.tmp_out /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_emulators_virtualbox/virtualbox/work/VirtualBox-4.1.4_OSE/.tmp_src.cc "-lvncserver " /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_emulators_virtualbox/virtualbox/work/VirtualBox-4.1.4_OSE/.tmp_src.cc:2:10: fatal error: 'rfb/rfbconfig.h' file not found #include <rfb/rfbconfig.h> ^ 1 error generated.
Also, can you check for LibVNCServer headers?
~$ ls /opt/local/include/rfb/ keysym.h rfb.h rfbclient.h rfbconfig.h rfbint.h rfbproto.h rfbregion.h
Seems like the include/lib path isn't set properly. -L/opt/local/lib -I/opt/local/include is missing.
comment:4 Changed 13 years ago by royliu@…
Apparently I tried rebuilding VirtualBox, and got the same error as you. This coincides to being after an upgrade from Xcode 4.1 -> 4.2. FYI, I've gotten past that problem with this patch ...
--- configure.orig 2011-08-15 19:38:16.000000000 -0500 +++ configure 2011-08-15 19:38:16.000000000 -0500 @@ -995,6 +995,8 @@ } } EOF + INCVNCSERVER=`pkg-config libvncserver --cflags` + LIBVNCSERVER=`pkg-config libvncserver --libs` if test_compile "$LIBVNCSERVER $INCVNCSERVER" libvncserver libvncserver; then if test_execute; then cnf_append "VBOX_WITH_VNC" "1"
... only to run into another one:
kmk: gcc-4.2: Command not found
comment:5 Changed 13 years ago by royliu@…
Resolution: | → fixed |
---|---|
Status: | new → closed |
Committed in #36383. Let me know if you continue to have problems.
comment:8 Changed 13 years ago by royliu@…
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Summary: | Error configuring virtualbox-4.1.4_0+vde2+vnc, libvncserver not found → VirtualBox 4.1.4 doesn't work with Lion and Xcode 4.2 |
I'm reopening this. Apparently everything compiles, but VMs don't work yet.
comment:9 follow-up: 10 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)
Cc: | ryandesign@… added |
---|
It is correct for virtualbox's configure process to use pkg-config to find its dependencies.
It was not necessary to change the way in which the LibVNCServer dependency was specified.
Perhaps the reason why virtualbox was only unable to find libvncserver when the compiler is clang is that clang does not respect CPATH and LIBRARY_PATH.
Why is so much patching necessary to get virtualbox to use a different compiler? Why can't you just set configure.compiler
as we do in other ports? See wiki:PortfileRecipes#compiler .
comment:10 Changed 13 years ago by jk@…
So I tried this:
--- Portfile.orig 2011-10-25 12:41:35.000000000 +0200 +++ Portfile 2011-10-25 13:52:52.000000000 +0200 @@ -67,6 +67,10 @@ set kext_dir /Library/Extensions set startup_items_dir /Library/StartupItems +if {${configure.compiler} == "clang"} { + configure.compiler llvm-gcc-4.2 +} + post-patch { reinplace "s|@APPLICATIONS_DIR@|${applications_dir}|g" \
which configures nicely but results in problems using stdarg.h:
:info:build In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_emulators_virtualbox/virtualbox/work/Virtu alBox-4.1.4_OSE/include/iprt/stdarg.h:32, :info:build from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_emulators_virtualbox/virtualbox/work/Virtu alBox-4.1.4_OSE/include/iprt/assert.h:31, :info:build from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_emulators_virtualbox/virtualbox/work/Virtu alBox-4.1.4_OSE/src/VBox/Runtime/common/alloc/alloc.cpp:37: :info:build /Developer/SDKs/MacOSX10.6.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
Sorry if this is stupid, but I'm not really into this Portfile-thing... (yet)
Changed 13 years ago by jk@…
Attachment: | main.2.log added |
---|
main.log after setting configure.compiler...
comment:11 follow-up: 12 Changed 13 years ago by royliu@…
jk,
Have you tried syncing with the MacPorts tree and rebuilding? I believe everything will compile and everything will go fine ... until you actually try running a VM, in which case the VirtualBox will die horribly.
Ryan,
The reason for the compiler patches is that in Config.kmk, VirtualBox is setting its own compiler to be a non-LLVM GCC. We'll have to override that. I tried compiling with GCC 4.6, but there seems to be a problem with pragmas. Thinking about patching GCC itself ... I'm wondering if I should revert my recent changes so that VirtualBox builds for all non Xcode 4.2 users. It will stay broken for those on the edge. What do you think?
comment:12 Changed 13 years ago by jk@…
Replying to royliu@…:
Have you tried syncing with the MacPorts tree and rebuilding? I believe everything will compile and everything will go fine ... until you actually try running a VM, in which case the VirtualBox will die horribly.
Why should I update to an unusable version of VirtualBox which compiles fine but is in any terms useless?
...It will stay broken for those on the edge. What do you think?
Lion and XCode 4.2 are not bleeding edge anymore. Both of them are in production state for a while...
comment:13 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)
So, if virtualbox doesn't compile or doesn't run properly when compiled with clang or llvm-gcc-4.2, we need to make it use gcc-4.2, which a fallback to apple-gcc42. The usual verbiage to do that is in wiki:PortfileRecipes#compiler.
comment:14 Changed 13 years ago by jk@…
Ok, using this patch:
--- Portfile.orig 2011-10-25 12:41:35.000000000 +0200 +++ Portfile 2011-10-27 12:56:08.000000000 +0200 @@ -67,6 +67,17 @@ set kext_dir /Library/Extensions set startup_items_dir /Library/StartupItems +if {${configure.compiler} == "clang" || + ${configure.compiler} == "llvm-gcc-4.2"} { + configure.compiler gcc-4.2 + if {![file executable ${configure.cc}]} { + depends_build-append port:apple-gcc42 + configure.compiler apple-gcc-4.2 + # base (as of 2.0.3) doesn't set cxx for apple-gcc-4.2 + configure.cxx ${prefix}/bin/g++-apple-4.2 + } +} + post-patch { reinplace "s|@APPLICATIONS_DIR@|${applications_dir}|g" \
I end up with...
main.log:
:info:configure Checking for ssl: :info:configure libcrypto not found at -I/opt/local/include /opt/local/lib/libcrypto.dylib /opt/local/lib/libssl.dylib or openssl headers not found
configure.log:
***** Checking ssl ***** compiling the following source file: #include <cstdio> #include <openssl/opensslv.h> #include <openssl/ssl.h> extern "C" int main(void) { printf("found version %s", OPENSSL_VERSION_TEXT); SSL_library_init(); #if OPENSSL_VERSION_NUMBER >= 0x00908000 printf(", OK.\n"); return 0; #else printf(", expected version 0.9.8 or higher\n"); return 1; #endif } using the following command line: /usr/bin/g++-4.2 -mmacosx-version-min=10.6 -isysroot /Developer/SDKs/MacOSX10.6.sdk -Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk -g -O -Wall -o /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_emulators_virtualbox/virtualbox/work/VirtualBox-4.1.4_OSE/.tmp_out /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_emulators_virtualbox/virtualbox/work/VirtualBox-4.1.4_OSE/.tmp_src.cc "-I/opt/local/include /opt/local/lib/libcrypto.dylib /opt/local/lib/libssl.dylib" In file included from /opt/local/include/openssl/bio.h:67, from /opt/local/include/openssl/ssl.h:152, from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_emulators_virtualbox/virtualbox/work/VirtualBox-4.1.4_OSE/.tmp_src.cc:3: /Developer/SDKs/MacOSX10.6.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
Same problem as with llvm-gcc-4.2 but at a different place
comment:15 follow-up: 16 Changed 13 years ago by jk@…
BTW: using SDK 10.7 && llvm-gcc-4.2 for building VirtualBox does not result in stdarg.h errors, but does not build against opengl as stated in #31328
comment:16 follow-up: 17 Changed 13 years ago by royliu@…
comment:17 Changed 13 years ago by jk@…
Replying to royliu@…:
Replying to jk@…:
BTW: using SDK 10.7 && llvm-gcc-4.2 for building VirtualBox does not result in stdarg.h errors, but does not build against opengl as stated in #31328
... and I also take it that VMs don't run at all?
Hi Roy,
didn't checked that. It just breaks at building OpenGL stuff and I didn't tried building without it...
comment:18 follow-up: 19 Changed 13 years ago by royliu@…
jk,
Please try building without OpenGL. It'll be helpful to reproduce these bugs one by one.
-Roy
comment:19 follow-up: 20 Changed 13 years ago by jk@…
Building for SDK 10.7 without OpenGL compiles fine. VMs work.
--- Portfile.orig 2011-10-25 12:41:35.000000000 +0200 +++ Portfile 2011-11-04 14:35:57.000000000 +0100 @@ -67,6 +67,11 @@ set kext_dir /Library/Extensions set startup_items_dir /Library/StartupItems +if {${configure.compiler} == "clang"} { + configure.compiler llvm-gcc-4.2 + configure.args-append --disable-opengl +} + post-patch { reinplace "s|@APPLICATIONS_DIR@|${applications_dir}|g" \
--- files/patch-build.diff.orig 2011-11-04 14:26:06.000000000 +0100 +++ files/patch-build.diff 2011-11-04 14:26:20.000000000 +0100 @@ -65,7 +65,7 @@ --- /dev/null 2011-08-15 19:38:06.000000000 -0500 +++ LocalConfig.kmk 2011-08-15 19:38:17.000000000 -0500 @@ -0,0 +1,11 @@ -+VBOX_DEF_MACOSX_VERSION_MIN = 10.6 ++VBOX_DEF_MACOSX_VERSION_MIN = 10.7 +VBOX_DARWIN_NO_COMPACT_LINKEDIT = +VBOX_MACOS_10_5_WORKAROUND = +VBOX_PATH_APP_DOCS="@APPLICATIONS_DIR@/VirtualBox.app/Contents/MacOS"
comment:20 follow-up: 21 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)
Replying to jk@…:
+if {${configure.compiler} == "clang"} { + configure.compiler llvm-gcc-4.2 + configure.args-append --disable-opengl +}
What this patch is saying: if the default compiler was clang (i.e. Xcode 4.2+, which could be running on Lion or Snow Leopard), then set the compiler to llvm-gcc-4.2 and disable OpenGL. But if the default compiler was llvm-gcc-4.2 already (i.e. Xcode 4.0 or 4.1, on either Lion or Snow Leopard), then leave OpenGL enabled. I'm not understanding why the disabling of OpenGL has anything to do with what the default compiler used to be before the port overrode it. comment:ticket:31328:5 said there is an "incompatibility between the OpenGL library in Lion with VirtualBox"; if that's the case, then disabling OpenGL should be happening in a platform darwin 11
block, and should not be based on the compiler.
comment:21 follow-up: 22 Changed 13 years ago by jk@…
That's just a test. Nothing to commit into the port tree.
Clang didn't work, so I tried llvm-gcc-4.2. Which worked neither, so I compiled against SDK 10.7, which leads into problems with compiling OpenGL stuff. So I finally disabled OpenGL.
You see, it's just an attempt to compile this package on Lion with XCode 4.2 and not a final solution for this ticket.
comment:22 follow-up: 24 Changed 13 years ago by royliu@…
jk,
When you say that VMs work, does that mean one of them boots up and is usable? I tried reproducing your steps, saw the OpenGL problem with the 10.7 SDK, disabled OpenGL, built everything successfully, but still my VMs crashed.
-Roy
comment:23 Changed 13 years ago by royliu@…
I upgraded VirtualBox to 4.1.6 and added
--disable-opengl
if ${macosx_deployment_target}
is 10.7 in r86840. Please rebuild and see if there are further problems. Still crashing for me.
comment:24 follow-up: 25 Changed 13 years ago by jk@…
Replying to royliu@…:
jk,
When you say that VMs work, does that mean one of them boots up and is usable? I tried reproducing your steps, saw the OpenGL problem with the 10.7 SDK, disabled OpenGL, built everything successfully, but still my VMs crashed.
-Roy
Hi Roy, I have a WinXP (32bit) VM which boots up and is working fine. No problems here...
comment:25 follow-up: 26 Changed 13 years ago by royliu@…
jk,
Great news! Could you help me triage the problem? I recently committed some changes in r86840, and am wondering if you could rebuild off of that without any modifications. Two more questions:
- What variants were you using?
- Why didn't compiling with the 10.6 SDK work, such that it forced you to 10.7?
-Roy
Hi Roy, I have a WinXP (32bit) VM which boots up and is working fine. No problems here...
comment:26 Changed 13 years ago by jk@…
Replying to royliu@…:
jk,
Great news! Could you help me triage the problem? I recently committed some changes in r86840, and am wondering if you could rebuild off of that without any modifications. Two more questions:
- What variants were you using?
- Why didn't compiling with the 10.6 SDK work, such that it forced you to 10.7?
-Roy
Roy,
your patch builds fine but VMs are crashing now.
- I don't use any specific variants. Default is +vde2 +vnc
- Compiling with the 10.6 SDK neither worked with clang nor llvm-gcc-4.2 (see attached main.log and main.2.log).
comment:27 follow-up: 30 Changed 13 years ago by royliu@…
jk,
Did you upgrade to Xcode 4.2 from 4.1? If so, was there a leftover /usr/bin/gcc-4.2
?
Also, when things were working, on top of which virtualbox port revision did you apply your temporary patches from 2 days ago?
-Roy
comment:28 Changed 13 years ago by royliu@…
Summary: | VirtualBox 4.1.4 doesn't work with Lion and Xcode 4.2 → VirtualBox 4.1.6 doesn't work with Lion and Xcode 4.2 |
---|
comment:29 Changed 13 years ago by royliu@…
jk,
Thanks for all the work you've done so far! Since VirtualBox has now settled in a broken state, I've been thinking: If you submit a (temporary) patch that makes the crashes go away, we can chase down this problem for good!
-Roy
comment:30 follow-up: 31 Changed 13 years ago by jk@…
Replying to royliu@…:
Did you upgrade to Xcode 4.2 from 4.1? If so, was there a leftover
/usr/bin/gcc-4.2
?
Yes, I did an upgrade. There is also a gcc-4.2 binary.
Also, when things were working, on top of which virtualbox port revision did you apply your temporary patches from 2 days ago?
Sorry, I can't help you with that. I don't know the revision, since I'm not working on the svn tree...
comment:31 follow-up: 32 Changed 13 years ago by royliu@…
Aha, so that could explain why you've been getting working VMs. If you're brave, you may want to manually remove those remnants for consistency.
-Roy
Replying to jk@…:
Yes, I did an upgrade. There is also a gcc-4.2 binary.
comment:32 Changed 13 years ago by jk@…
I've deleted the remnants. I guess your assumption is right. The build must have used the gcc-4.2, since I can't create working builds any longer.
Replying to royliu@…:
Aha, so that could explain why you've been getting working VMs. If you're brave, you may want to manually remove those remnants for consistency.
comment:33 Changed 13 years ago by royliu@…
Everyone,
I have good news and bad news (mostly good news). I fixed the problem by using the apple-gcc42
port. The bad news is that apple-gcc42
itself has to get patched (I recently filed ticket #31948). To get everything working, you'll have to apply two patches:
patch-use-apple-gcc42.diff
-- This is for thevirtualbox
port itself.patch-isysroot.diff
-- This is for theapple-gcc42
port itself.
Let me know if things start working for you too.
Changed 13 years ago by royliu@…
Attachment: | patch-isysroot.diff added |
---|
A patch for the apple-gcc42 port itself.
comment:34 Changed 13 years ago by jk@…
Hi Roy,
your patches lead me to the follwing result:
:debug:configure Using compiler 'MacPorts Apple gcc 4.2' :debug:configure Executing org.macports.configure (virtualbox) ... :info:configure Checking for gcc: :info:configure ** CXX is empty!
Configure aborts after this...
comment:35 follow-up: 36 Changed 13 years ago by royliu@…
jk,
Could you provide the full log? Also, was this against a patched apple-gcc42
? You can test by downloading:
Running build_test.sh
in the same directory as test.cpp
should not give errors if you built a patched apple-gcc42
.
-Roy
Changed 13 years ago by jk@…
Attachment: | build_test.log added |
---|
comment:36 Changed 13 years ago by jk@…
Build test fails. See attached build_test.log
...
Replying to royliu@…:
Running
build_test.sh
in the same directory astest.cpp
should not give errors if you built a patchedapple-gcc42
.
comment:37 Changed 13 years ago by jk@…
Adding -lssl
to build_test.sh
does a clean build and a2.out gives :
found version OpenSSL 1.0.0e 6 Sep 2011, OK.
comment:38 follow-up: 39 Changed 13 years ago by royliu@…
Embarrassingly, test.cpp
is mismatched with apple-gcc42
nonetheless, the header search information seems to be correct. Could you provide the full log for the configure
failure?
Changed 13 years ago by jk@…
Attachment: | main.3.log added |
---|
comment:39 Changed 13 years ago by jk@…
Attached as main.3.log
...
Replying to royliu@…:
...Could you provide the full log for the
configure
failure?
comment:40 follow-up: 41 Changed 13 years ago by royliu@…
What does /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_emulators_virtualbox/virtualbox/work/VirtualBox-4.1.6_OSE/configure.log
itself say?
comment:41 Changed 13 years ago by jk@…
# Log file generated by # # './configure --with-qt-dir=/opt/local --with-openssl-dir=/opt/local --enable-vde --enable-vnc' # ***** Checking environment ***** Determined build machine: darwin.amd64, target machine: darwin.amd64 ***** Checking kBuild ***** found ***** Checking Darwin version ***** found version 10.7 (SDK: /Developer/SDKs/MacOSX10.6.sdk) ***** Checking gcc ***** ** CXX is empty!
Replying to royliu@…:
What does
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_emulators_virtualbox/virtualbox/work/VirtualBox-4.1.6_OSE/configure.log
itself say?
comment:42 follow-up: 43 Changed 13 years ago by royliu@…
This may be a problem with your build procedure. The configure
scripts check_avail
function is failing on an empty CXX
variable, and I don't see how that's possible, since we set it.
comment:43 follow-up: 44 Changed 13 years ago by jk@…
Roy,
my build procedure was:
- sudo port selfupdate
- sudo port clean virtualbox
- apply apple-gcc-4.2-patch to apple-gcc-4.2
- apply isysroot-patch to virtualbox
- sudo port install virtualbox
Replying to royliu@…:
This may be a problem with your build procedure. The
configure
scriptscheck_avail
function is failing on an emptyCXX
variable, and I don't see how that's possible, since we set it.
comment:44 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)
Replying to jk@…:
- apply apple-gcc-4.2-patch to apple-gcc-4.2
patch-use-apple-gcc42.diff is incomplete. Where it says "configure.compiler apple-gcc-4.2" it needs to use the entire block shown at the top of comment:14.
comment:45 Changed 13 years ago by jk@…
After all... it works!
I added
configure.cxx ${prefix}/bin/g++-apple-4.2
to the Portfile and everything is working now (including VMs).
Roy, thanks for the good work!
comment:46 Changed 13 years ago by royliu@…
I updated virtualbox
in r86992 and have updated the patch (overriding that of the same name).
Changed 13 years ago by royliu@…
Attachment: | patch-use-apple-gcc42.diff added |
---|
Use apple-gcc42 to compile VirtualBox (revision 2).
comment:47 Changed 13 years ago by royliu@…
comment:48 Changed 13 years ago by royliu@…
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
What does your VirtualBox
configure.log
say? Does it provide more information on top of MacPorts'main.log
? Also, can you check for LibVNCServer headers?