Dear Open Hub Users,
We’re excited to announce that we will be moving the Open Hub Forum to
https://community.blackduck.com/s/black-duck-open-hub.
Beginning immediately, users can head over,
register,
get technical help and discuss issue pertinent to the Open Hub. Registered users can also subscribe to Open Hub announcements here.
On May 1, 2020, we will be freezing https://www.openhub.net/forums and users will not be able to create new discussions. If you have any questions and concerns, please email us at
[email protected]
When trying to build ohcount on OS X, I get:
computer-van-reinier-lamers:~/Source/ohcount reinier$ rake
(in /Users/reinier/Source/ohcount)
/Users/reinier/Source/ohcount/test/unit/*_test.rb
/usr/local/bin/ruby extconf.rb
checking for pcre_compile() in -lpcre... no
BUILD_TYPE: RELEASE
creating Makefile
make
gcc -I. -I. -I/usr/local/lib/ruby/1.8/universal-darwin8.0 -I. -fno-common -g -O2 -fno-common -pipe -fno-common -g -O2 -Wall -DNDEBUG
-arch i386 -c common.c
In file included from common.c:1:
common.h:32:18: error: pcre.h: No such file or directory
In file included from common.h:35,
from common.c:1:
compiledstate.h:13: error: parse error before 'pcre'
compiledstate.h:13: warning: no semicolon at end of struct or union
compiledstate.h:14: warning: type defaults to 'int' in declaration of 'pcreextra'
compiledstate.h:14: warning: data definition has no type or storage class
compiledstate.h:16: error: parse error before '}' token
compiledstate.h:16: warning: type defaults to 'int' in declaration of 'CompiledState'
compiledstate.h:16: warning: data definition has no type or storage class
compiledstate.h:19: error: parse error before '*' token
compiledstate.h:20: error: parse error before '' token
In file included from common.h:36,
from common.c:1:
polyglot.h:14: error: parse error before 'CompiledState'
polyglot.h:14: warning: no semicolon at end of struct or union
polyglot.h:16: error: parse error before '}' token
polyglot.h:16: warning: type defaults to 'int' in declaration of 'Polyglot'
polyglot.h:16: warning: data definition has no type or storage class
polyglot.h:18: error: parse error before '' token
polyglot.h:19: error: parse error before '' token
In file included from common.h:37,
from common.c:1:
polyglots.h:12: error: parse error before '' token
polyglots.h:12: warning: type defaults to 'int' in declaration of 'POLYGLOTS'
polyglots.h:12: warning: data definition has no type or storage class
In file included from common.h:39,
from common.c:1:
parser.h:32: error: parse error before 'Polyglot'
common.c: In function 'die':
common.c:5: warning: implicit declaration of function 'exit'
common.c:5: warning: incompatible implicit declaration of built-in function 'exit'
make: *** [common.o] Error 1
rake aborted!
Command failed with status (2): [make...]
/Users/reinier/Source/ohcount/rakefile:64
I have installed PCRE via fink but gcc is not looking at the PCRE headers during the build. Manually fixing the Makefile in ext/ can get me beyond this error, but then gives me a dynamic linker error. Is there a nice way to build ohcount on OS X?
Hi tux_rocker,
I do all of my development on a Mac, so building under OS X really should be the cleanest way to go!
We rely on the ruby lib 'mkmf' to do the heavy lifting here. This lib is supposed to find the pcre library and instruct gcc where to find it. Try this:
~$ irb
irb(main):001:0> require 'mkmf'
=> true
irb(main):002:0> havelibrary('pcre','pcrecompile')
checking for pcre_compile() in -lpcre... yes
=> true
If you don't get true
responses at each step, you have problems either with mkmf
or pcre
.
It's been a long time, but I believe I installed pcre on my Mac using DarwinPorts (sudo port install pcre
). That might give you better results than fink. I'm running pcre 6.7.0, which is pretty old.
Let me know what the irb results are, and try installing with DarwinPorts. I'll have time to help you investigate this some more tomorrow.
Thanks,
Robin
I installed PCRE from MacPorts after removing it with fink. Then I get:
irb(main):001:0> require 'mkmf'
=> true
irb(main):002:0> havelibrary 'pcre', 'pcrecompile'
checking for pcre_compile() in -lpcre... no
=> false
irb(main):003:0>
I fixed it by installing Ruby from MacPorts, too.
Hmm, I'm sorry you had so much trouble getting this set up. I seem to recall having trouble getting Ruby set up on my own laptop a long time ago.
I think OS X 10.4 comes with a version of Ruby pre-installed that you can't easily uninstall with a package manager; and it's a pretty old and oddly-configured version of Ruby. It's been a while so my memory of this is shaky.
It would be nice to put together some good directions for getting this all running on Mac OS X from scratch, but unfortunately that mean reinstalling a clean OS on one of our Macs. We need an intern :-).
Hopefully your notes above may help the next victim.
Thanks,
Robin
So my recipe was:
That's not too hard :-)
The Ruby I originally tried to build ohcount with was not the one that Apple ships, but came from some binary package that's advertised on the web to get up and running with Ruby on Rails quickly.
Hi tux_rocker,
I finally discovered your Haskell patch over on labs.ohloh.net (for some reason my timeline report wasn't showing your patch submission).
I'm psyched to get Haskell into our line counter, but I had some trouble with the Git patches (sigh). More info in the Trac ticket.
Thanks,
Robin
tux_rocker, thanks for the OSX instructions
Has anyone tried to build ohcount on Leopard?
A how-to similar to the Ubuntu/Gentoo/ArchLinux pages would be very useful.
I build Ohcount on Leopard every day. The problem is, my machine has a two-year hodge-podge of ports, finks, build-from-source's, upgrades, and rm -rf's that make it impossible to figure out how my machine got into this state. Ironically, because it's the platform I use most, it's the platform I can least describe.
The Ubuntu instructions resulted from the magical ability to install a clean server image on a virtual box in just a few minutes to confirm the instructions. I have no such capability on Leopard, as far as I know.
I agree such a set of instructions would be helpful. Anyone know how to get a clean Leopard install in a virtual box?
ok I followed tux_rocker's instructions on Mac 10.5.2 but I'm stuck at point vi. When I try to build ohcount, I get error messages that suggest the built-in version of Ruby is used instead of the one downloaded via MacPorts:
gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -fno-common -arch ppc -arch i386 -Os -pipe -fno-common -g -O2 -Wall -DNDEBUG -c common.c
I have changed my path in .tcshrc so that the Macports paths come earlier than /usr/bin, am I missing something in point iii.?
I'm just guessing here, since I can't really see your error in what you pasted above.
However, the path fix is probably not enough. As some grepping will reveal, many evil-doers put the full path to /usr/bin/ruby in the shebang line of their scripts.
In /usr/bin, try replacing /usr/bin/ruby with a symlink to the MacPorts version. It's hardcore, but it tends to work.
I've found a solution to this problem, at least for PPC Leopard (on a G4 PowerBook), please take a look here
Hope this helps! :)
Cheers