MantisBT - CMake
View Issue Details
0007425CMakeCMakepublic2008-07-29 18:062008-10-01 10:20
Scott McCreary 
Bill Hoffman 
normalminoralways
closedfixed 
CMake-2-6 
 
0007425: Haiku failure to build CMake
I have created a couple of patches that help get CMake closer to building on Haiku, but it's still not quite there yet:
http://ports.haiku-files.org/wiki/dev-util/cmake [^]
No tags attached.
png cmake-build-on-haiku-stalls.png (163,373) 2008-09-10 16:44
https://public.kitware.com/Bug/file/1712/cmake-build-on-haiku-stalls.png
png
Issue History
2008-07-29 18:06Scott McCrearyNew Issue
2008-07-31 13:38Bill HoffmanNote Added: 0012904
2008-07-31 13:38Bill HoffmanStatusnew => assigned
2008-07-31 13:38Bill HoffmanAssigned To => Bill Hoffman
2008-07-31 14:01Scott McCrearyNote Added: 0012907
2008-08-21 13:31Scott McCrearyNote Added: 0013129
2008-08-21 14:56Bill HoffmanNote Added: 0013133
2008-08-21 15:04Scott McCrearyNote Added: 0013134
2008-08-21 22:46Bill HoffmanNote Added: 0013151
2008-09-09 14:14Bill HoffmanNote Added: 0013386
2008-09-09 14:47Scott McCrearyNote Added: 0013390
2008-09-09 15:12Bill HoffmanNote Added: 0013393
2008-09-10 16:44Scott McCrearyFile Added: cmake-build-on-haiku-stalls.png
2008-09-10 16:48Scott McCrearyNote Added: 0013401
2008-09-10 16:59Bill HoffmanNote Added: 0013403
2008-09-10 17:22Scott McCrearyNote Added: 0013404
2008-09-11 08:44Bill HoffmanNote Added: 0013407
2008-09-11 08:45Bill HoffmanNote Added: 0013408
2008-09-11 14:05Scott McCrearyNote Added: 0013437
2008-09-11 15:22Bill HoffmanNote Added: 0013445
2008-09-12 01:05Scott McCrearyNote Added: 0013446
2008-09-12 11:17Bill HoffmanNote Added: 0013450
2008-09-12 11:25Bill HoffmanNote Added: 0013453
2008-09-12 13:10Bill HoffmanNote Added: 0013456
2008-09-12 15:30Bill HoffmanNote Added: 0013459
2008-09-12 15:38Bill HoffmanNote Added: 0013460
2008-09-12 15:44Scott McCrearyNote Added: 0013461
2008-09-12 15:52Bill HoffmanNote Added: 0013462
2008-09-12 15:57Scott McCrearyNote Added: 0013463
2008-10-01 10:20Bill HoffmanStatusassigned => closed
2008-10-01 10:20Bill HoffmanNote Added: 0013640
2008-10-01 10:20Bill HoffmanResolutionopen => fixed

Notes
(0012904)
Bill Hoffman   
2008-07-31 13:38   
Would you be willing to run a dashboard if we got cmake building?
(0012907)
Scott McCreary   
2008-07-31 14:01   
Maybe. I do daily builds of Haiku on my PC. There may be a way that I can add a dashboard into that script. Contact me at scottmc2 at gmail com for more info.
(0013129)
Scott McCreary   
2008-08-21 13:31   
I've made some updates to my patch file:
http://ports.haiku-files.org/browser/haikuports/trunk/dev-util/cmake/cmake-2.6.1-haiku.diff [^]
But I'm still not able to get cmake to build on Haiku.
(0013133)
Bill Hoffman   
2008-08-21 14:56   
What are the errors you have right now?
(0013134)
Scott McCreary   
2008-08-21 15:04   
During make, it either errors out with this, or stalls just on the "loading initial cache file" part. This output is from 2.6.0 but I get similar results on 2.6.1 as well. If I copy and paste the g++ line it compiles that part ok, so it seems it's something just after that, that is causing the error/hangup. Something in the cmcurl code?

g++ -lroot -lbe -I/boot/home/cmake-2.6.0-haiku-test/Source -I/boot/home/cmake
-2.6.0-haiku-test/Bootstrap.cmk cmake.o cmakemain.o cmakewizard.o cmCommandArgu
mentLexer.o cmCommandArgumentParser.o cmCommandArgumentParserHelper.o cmDepends.
o cmDependsC.o cmDocumentationFormatter.o cmDocumentationFormatterText.o cmPolic
ies.o cmProperty.o cmPropertyMap.o cmPropertyDefinition.o cmPropertyDefinitionMa
p.o cmMakeDepend.o cmMakefile.o cmExportFileGenerator.o cmExportInstallFileGener
ator.o cmInstallDirectoryGenerator.o cmGeneratedFileStream.o cmGlobalGenerator.o
 cmLocalGenerator.o cmInstallGenerator.o cmInstallExportGenerator.o cmInstallFil
esGenerator.o cmInstallScriptGenerator.o cmInstallTargetGenerator.o cmSourceFile
.o cmSourceFileLocation.o cmSystemTools.o cmVersion.o cmFileTimeComparison.o cmG
lobalUnixMakefileGenerator3.o cmLocalUnixMakefileGenerator3.o cmMakefileExecutab
leTargetGenerator.o cmMakefileLibraryTargetGenerator.o cmMakefileTargetGenerator
.o cmMakefileUtilityTargetGenerator.o cmBootstrapCommands.o cmCommands.o cmTarge
t.o cmTest.o cmCustomCommand.o cmDocumentVariables.o cmCacheManager.o cmListFile
Cache.o cmComputeLinkDepends.o cmComputeLinkInformation.o cmOrderDirectories.o c
mComputeTargetDepends.o cmComputeComponentGraph.o cmExprLexer.o cmExprParser.o c
mExprParserHelper.o cmListFileLexer.o Directory.o Glob.o RegularExpression.o Sys
temTools.o ProcessUNIX.o String.o System.o -o cmake
loading initial cache file /boot/home/cmake-2.6.0-haiku-test/Bootstrap.cmk/Initi
alCacheFlags.cmake
CMake Error at Utilities/cmcurl/CMake/OtherTests.cmake:89 (MESSAGE):
 Unable to link function recv
Call Stack (most recent call first):
 Utilities/cmcurl/CMakeLists.txt:689 (INCLUDE)


-- Configuring done
---------------------------------------------
Error when bootstrapping CMake:
Problem while running initial CMake
---------------------------------------------
(0013151)
Bill Hoffman   
2008-08-21 22:46   
That means it bootstraps fine, but when the bootstrap cmake is run it gets a cmake error here:

Utilities/cmcurl/CMake/OtherTests.cmake:89


Which means it can not find a recv function. Is there one on the system? If so can you create a small c program that uses recv that works?
(0013386)
Bill Hoffman   
2008-09-09 14:14   
ping
(0013390)
Scott McCreary   
2008-09-09 14:47   
I posted to the Haiku dev mailing list and got this back:

> recv() is the syscall for receiving data on a network socket. In order
> to use it you'll need a) a socket file descriptor, b) sys/socket.h,
> and c) to link to libnetwork.so.

So perhaps it's not including sys/socket.h or linking with -lnetwork?
I may have already tried doing that, but it's been a couple weeks since I've done anything with this.
(0013393)
Bill Hoffman   
2008-09-09 15:12   
Sounds like all we need to do is add -lnetwork to get it working.

Try adding this:

Utilities/cmcurl/CMakeLists.txt

CHECK_LIBRARY_EXISTS_CONCAT("network" recv HAVE_LIBNETWORK)
(0013401)
Scott McCreary   
2008-09-10 16:48   
I added that check and updated make patch in progress:
http://ports.haiku-files.org/browser/haikuports/trunk/dev-util/cmake/cmake-2.6.1-haiku-2.diff?rev=151 [^] (seems I need to fix a typo in that patch, in one comment it says limb instead of libm, I'll fix it on my next update)
It is now stalling right after building the first cmake. I attached a screenshot to show where it's stalling and the contents of the CMakeSystem.cmake and CMakeOutput.log files from the CMakeFiles folder.
(0013403)
Bill Hoffman   
2008-09-10 16:59   
It is stuck running the bootstrap cmake which is good. You should be able to kill that and run it by hand.

cd build-tree
./Bootstrap.cmk/cmake --debug-output --trace ../CMake
(0013404)
Scott McCreary   
2008-09-10 17:22   
Nope.
That stalls as well. It prints out:
Running with debug output on.

And updates the CMakeSystem.cmake and CMakeOutput.log file like the previous run did, but then nothing...
Waited over 10 minutes and nothing seems to have happened.
Any other ideas to try?
(0013407)
Bill Hoffman   
2008-09-11 08:44   
Is there a debugger ? I would try that if not you will have to add some print statements. Sounds like it is not getting very far.

You could add come std::cerr << "here " type of stuff into cmakemain.cxx also in cmake.cxx cmake::Run. Is there an strace on the system?
(0013408)
Bill Hoffman   
2008-09-11 08:45   
Can I have remote access to the system?
(0013437)
Scott McCreary   
2008-09-11 14:05   
Here's a url where you can get the vmware image I am using:
http://www.fileden.com/files/2006/12/15/512895/haiku-dev.7z.001 [^]
http://www.fileden.com/files/2006/12/15/512895/haiku-dev.7z.002 [^]
It's zipped with 7zip, and also contains the vmx file. You would then just need to have vmware player in order to use it. It's a 500Meg image once expanded, but there's less than 50meg free on the image, so let me know if that becomes an issue and I can see about creating a larger image to work in.
My email address is listed about if you need any help.
Here's where you can get the free vmware player for most OSes:
http://www.vmware.com/download/player/ [^]
(0013445)
Bill Hoffman   
2008-09-11 15:22   
OK, I got the vm machine working. The trouble seems to be in the process execution code. If you run
strace ./Bootstrap.cmk/cmake

It gets stuck after a fork. This is when cmake is testing the compiler.
(0013446)
Scott McCreary   
2008-09-12 01:05   
I made a change to the patch, removing an ifndef in processunix.c and that seems to have fixed the bootstrapping part:
http://ports.haiku-files.org/browser/haikuports/trunk/dev-util/cmake/cmake-2.6.1-haiku-2.diff [^]
but now it appears that make it trying to make a win9x version? Here's my updated portlog which includes the terminal output:
http://ports.haiku-files.org/wiki/dev-util/cmake/2.6.1/1?version=3 [^]
How to get cmake to know that it's building for Haiku?
(0013450)
Bill Hoffman   
2008-09-12 11:17   
I can not get past the bootstrap part, and am not sure which ifndef you removed to fix the problem. I have the vm machine running, and should be able to fix it. Are you sure that diff is current?
(0013453)
Bill Hoffman   
2008-09-12 11:25   
Never mind, I have it working now, I will try to figure out the next part. Looks like it is very close.
(0013456)
Bill Hoffman   
2008-09-12 13:10   
OK, I found one thing.

Modules/CMakeFortranCompilerId.F90.in

! is not a comment character in c or c++, you have several of these:
! Haiku also defines __BEOS__ so we must
! put it prior to the check for __BEOS__
(0013459)
Bill Hoffman   
2008-09-12 15:30   
OK, I found the platform issue. For some reason the popen code is getting duplicate output with a newline in it. The code is in Source/cmSystemTools.cxx bool RunCommandViaPopen. When uname -s is run with this code, it gets an output of
Haiku
Haiku

including the newline in the middle.

Any ideas?
(0013460)
Bill Hoffman   
2008-09-12 15:38   
Never mind again, I found a work around...

  while(!feof(cpipe))
    {
    if(verbose)
      {
      cmSystemTools::Stdout(buffer);
      }
    output += buffer;
    buffer[0] = 0; // needed to add this line
    fgets(buffer, BUFFER_SIZE, cpipe);
    }

Now it finds the Platform file.
(0013461)
Scott McCreary   
2008-09-12 15:44   
In Source/cmSystemTools.cxx there's three places where there is am ifdef __BEOS__, these "might" need to be changed to:
if defined __BEOS__ && !defined __HAIKU__
since Haiku is also defining __BEOS__ at least until they hit R2.
This may or may not help.
(0013462)
Bill Hoffman   
2008-09-12 15:52   
How do I install cvs on this vm machine?

It is running the bootstrap right now. Looks like it might work. The popen thing was causing the last bit of trouble. I would like to check out cvs cmake on this so I can check in the code once I make the changes.
(0013463)
Scott McCreary   
2008-09-12 15:57   
There's a cvs that works for Haiku here:
http://haiku-files.org/files/optional-packages/ [^]
Use wget if firefox isn't working nicely for you.
wget http://haiku-files.org/files/optional-packages/cvs-1.11.21-gcc2-2008-07-23.zip [^]
(0013640)
Bill Hoffman   
2008-10-01 10:20   
OK, this is working in CVS, I will merge the fixes into the 2.6 branch. Now we need to setup a nightly build for this so it can stay working.


You should be able to run a script like this one:

http://www.cdash.org/CDash/viewNotes.php?buildid=185566 [^]

ctest -S nameofscript.cmake -VV

That should create a nightly dashboard for Haiku.