[p4ruby] p4ruby on Mac Snow Leopard

Andy Koch andy.koch at pc-doctor.com
Mon Mar 29 14:50:28 PDT 2010


Well, I'm not sure why but I installed the recent 10.6.3 update and after reboot tried this again and it appears to be working.

[~]
andy at hst-26-147->rv
ruby 1.8.7 (2009-06-08 patchlevel 173) [universal-darwin10.0]
 
[~]
andy at hst-26-147->irb
irb(main):001:0> require 'p4'
/Library/Ruby/Site/1.8/universal-darwin10.0/P4.bundle: warning: no super class for `P4Exception', Object assumed
/Library/Ruby/Site/1.8/universal-darwin10.0/P4.bundle: warning: no super class for `P4', Object assumed
/Library/Ruby/Site/1.8/universal-darwin10.0/P4.bundle: warning: no super class for `P4::MergeData', Object assumed
/Library/Ruby/Site/1.8/universal-darwin10.0/P4.bundle: warning: no super class for `P4::Map', Object assumed
=> true
irb(main):002:0> exit
 
[~]
andy at hst-26-147->cd src/perforce/09.2/p4ruby-2009.2/
 
[~/src/perforce/09.2/p4ruby-2009.2]
andy at hst-26-147->ruby p4conf.rb --apidir /Users/andy/src/perforce/09.2/darwin8u/p4api-2009.2.238357/

Starting to configure P4/Ruby for building

Found 2009.2 Perforce API in /Users/andy/src/perforce/09.2/darwin8u/p4api-2009.2.238357

P4/Ruby Configuration Summary
-----------------------------

Using Perforce API Version: 2009.2
API headers and libs from : /Users/andy/src/perforce/09.2/darwin8u/p4api-2009.2.238357
OS name                   : DARWIN
OS version                : 10
Platform                  : X86
CFLAGS                    : -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common $(cflags) -I/Users/andy/src/perforce/09.2/darwin8u/p4api-2009.2.238357/include/p4 -DOS_DARWIN -DOS_DARWIN10 -DOS_DARWIN10X86 -DCASE_INSENSITIVE 
LIBPATH                   : /Users/andy/src/perforce/09.2/darwin8u/p4api-2009.2.238357/lib
libs                      : -lclient -lrpc -lsupp 

Creating extconf.h
creating Makefile
 
[~/src/perforce/09.2/p4ruby-2009.2]
andy at hst-26-147->make
g++ -bundle -o P4.bundle clientuserruby.o p4.o p4clientapi.o p4mapmaker.o p4mergedata.o p4result.o p4specdata.o specmgr.o -L/Users/andy/src/perforce/09.2/darwin8u/p4api-2009.2.238357/lib -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L. -arch i386 -arch x86_64  -framework Carbon    -lruby -lclient -lrpc -lsupp  -lpthread -ldl  
 
[~/src/perforce/09.2/p4ruby-2009.2]
andy at hst-26-147->sudo make install
Password:
/usr/bin/install -c -m 0755 P4.bundle /Library/Ruby/Site/1.8/universal-darwin10.0
 
[~/src/perforce/09.2/p4ruby-2009.2]
andy at hst-26-147->irb
irb(main):001:0> require 'p4'
=> true
irb(main):002:0> p4 = P4.new
=> #<P4:0x101333180>
irb(main):003:0> p4.connect
=> true
irb(main):004:0> exit


----- Original Message -----
From: "Tony Smith" <tony at smee.org>
To: "Andy Koch" <andy.koch at pc-doctor.com>
Cc: "Sven Erik Knop" <sknop at perforce.com>, p4ruby at perforce.com, support at perforce.com
Sent: Monday, March 29, 2010 3:03:52 AM GMT -08:00 US/Canada Pacific
Subject: Re: [p4ruby] p4ruby on Mac Snow Leopard

Hi Andy, 

I've downloaded and installed Ruby Enterprise Edition, and I see the problems you experienced. I've had a good look at it, and I just can't make P4Ruby work with it. 

On my installation, it doesn't even have a libruby.dylib for us to link with, so even getting it to link is a problem. I solved that manually, by using libruby-static.a instead (no idea why it's a static libary for REE), but when I try to load the module it dies immediately. If they're shooting for source-code compatibility with vanilla Ruby, I'm sorry to say that they missed. 

REE is not a version of Ruby that we test P4Ruby with, or certify it for, and it seems there are significant incompatibilities with standard Ruby for C/C++ based extensions (I'm sure pure Ruby extensions are fine). If anyone succeeds in getting it working with P4Ruby, please let us know, but for now, it'll have to remain unsupported. 

Regards, 

Tony 

Tony Smith wrote: 

Hi Andy, 

Glad you got it working :). 

Do you still have the full output from one of your failed builds? I'd like to take a look at this in more detail, but to do so I'll need the gory details. The Ruby version story is interesting - I'm on Snow Leopard, and using the Ruby that came with it (not the one from MacPorts), and it works fine. It does however output a completely different version string 

ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0] 

Which is the same as Sven's. I note you're using 'Ruby Enterprise Edition': are you perhaps on Mac OSX Server? 

Thanks, 

Tony 

Andy Koch wrote: 

OK, I dropped my source installed Ruby and installed from MacPorts with the 'universal' option.

then compiled with this Ruby from 09.2 sources

and it works!  w00t!!

still a bit disconcerting that it's not working on the other Ruby versions, 

but I've got something to work with now so I can placate some badgering coworkers

Thanks for all the help

fyi...

[~/src/perforce/09.2/p4ruby-2009.2]
andy at hst-26-147->ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin10]

[~/src/perforce/09.2/p4ruby-2009.2]
andy at hst-26-147->port installed | grep ruby
  ruby @1.8.7-p249_1+darwin+thread_hooks+universal (active)
 
----- Original Message -----
From: "Sven Erik Knop" <sknop at perforce.com> To: "Andy Koch" <andy.koch at pc-doctor.com> Cc: "Tony Smith" <tony at smee.org> , p4ruby at perforce.com Sent: Thursday, March 25, 2010 10:58:12 AM GMT -08:00 US/Canada Pacific
Subject: Re: [p4ruby] p4ruby on Mac Snow Leopard

That is interesting.

Here is my version

$ ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]

This version has been built as a universal binary. I wouldn't be 
surprised if the troubles come from the mismatch between the ruby build 
and the API build.

Do you have access to a universal-darwin build of ruby?

Cheers

Sven Erik

On 25/03/2010 17:51, Andy Koch wrote: 

I'm using 1.8.7 REE

[~/src/perforce/09.2/p4ruby-2009.2]
andy at pdd-andy-mbp->rv
ruby 1.8.7 (2009-12-24 patchlevel 248) [i686-darwin10.2.0], MBARI 0x6770, Ruby Enterprise Edition 2010.01

tried 09.2 with both darwin80u and macosx104u but still no luck

darwin80u complains of undefined symbols
macos104u complains of wrong architecture

I'll try some different Rubies as I have RVM and try to find one that works.



----- Original Message -----
From: "Sven Erik Knop" <sknop at perforce.com> To: "Andy Koch" <andy.koch at pc-doctor.com> Cc: "Tony Smith" <tony at smee.org> , p4ruby at perforce.com Sent: Thursday, March 25, 2010 10:17:47 AM GMT -08:00 US/Canada Pacific
Subject: Re: [p4ruby] p4ruby on Mac Snow Leopard

Hi Andy,

which version of Ruby are you using?

Also, could you try to use P4Ruby 2009.2 with the 9.2 API? This is the
version that I use on my Snow Leopard Mac, and it compiled without problems.

Cheers

Sven Erik

On 25/03/2010 16:55, Andy Koch wrote: 

Hi Tony,

that sounded promising, but still getting errors and seeing reference to Carbon framework.



[~/src/p4ruby-2009.1]
andy at pdd-andy-mbp->ruby p4conf.rb --apidir /Users/andy/src/p4api-2009.1.205670/

Starting to configure P4/Ruby for building

Found 2009.1 Perforce API in /Users/andy/src/p4api-2009.1.205670

P4/Ruby Configuration Summary
-----------------------------

Using Perforce API Version: 2009.1
API headers and libs from : /Users/andy/src/p4api-2009.1.205670
OS name                   : DARWIN
OS version                : 10
Platform                  : X86
CFLAGS                    : -g -O2  -pipe -fno-common $(cflags) -I/Users/andy/src/p4api-2009.1.205670/include/p4 -DOS_DARWIN -DOS_DARWIN10 -DOS_DARWIN10X86 -DCASE_INSENSITIVE
LIBPATH                   : /Users/andy/src/p4api-2009.1.205670/lib
libs                      : -lclient -lrpc -lsupp

Creating extconf.h
creating Makefile

[~/src/p4ruby-2009.1]
andy at pdd-andy-mbp->make
g++ -bundle -o P4.bundle clientuserruby.o p4.o p4clientapi.o p4mapmaker.o p4mergedata.o p4result.o p4specdata.o specmgr.o -L/Users/andy/src/p4api-2009.1.205670/lib -L. -L/Users/andy/.rvm/rubies/ree-1.8.7-2010.01/lib -L.  -framework Carbon    -lclient -lrpc -lsupp  -ldl -lobjc
Undefined symbols:
    "_rb_hash_aref", referenced from:
        SpecDataRuby::GetLine(SpecElem*, int, char const**)in p4specdata.o
        SpecDataRuby::SetLine(SpecElem*, int, StrPtr const*, Error*)in p4specdata.o
        SpecMgr::InsertItem(unsigned long, StrPtr const*, StrPtr const*)in specmgr.o
    "_rb_hash_aset", referenced from:
        SpecDataRuby::SetLine(SpecElem*, int, StrPtr const*, Error*)in p4specdata.o
        SpecDataRuby::SetLine(SpecElem*, int, StrPtr const*, Error*)in p4specdata.o
        SpecMgr::InsertItem(unsigned long, StrPtr const*, StrPtr const*)in specmgr.o
        SpecMgr::InsertItem(unsigned long, StrPtr const*, StrPtr const*)in specmgr.o
        SpecMgr::InsertItem(unsigned long, StrPtr const*, StrPtr const*)in specmgr.o
        SpecMgr::SpecFields(StrPtr*)      in specmgr.o





----- Original Message -----
From: "Tony Smith" <tony at smee.org> To: "Andy Koch" <andy.koch at pc-doctor.com> Cc: p4ruby at perforce.com Sent: Thursday, March 25, 2010 2:47:52 AM GMT -08:00 US/Canada Pacific
Subject: Re: [p4ruby] p4ruby on Mac Snow Leopard

Hi Andy,

The macosx version of the API requires the Carbon framework, but the
darwin version doesn't (the macosx version is for building GUI clients
with, while the darwin build is for non-GUI stuff).  The errors you're
getting are to do with architecture support though: ruby wants to link
for more than one architecture, but the P4API you're using only supports
x86 (not x86_64).

I recommend using the 'darwin8u' builds on Mac as they are universal
binaries suitable for use on PPC, x86 and x86_64 platforms. Try with
this build and see if it works any better: http://www.perforce.com/downloads/perforce/r09.1/bin.darwin80u/p4api.tgz Tony

Andy Koch wrote: 

Hi Tony,

Trying install p4ruby on Mac Snow Leopard (10.6.2) and am having some compilation issues.

I'm using p4ruby and p4api from the 09.1 dir of perforce.com

Wondering if this bit "-framework Carbon" is the problem?  Does this need to change to Cocoa?

please advise&   thank you


here is my console output...


[~/src/p4ruby-2009.1]
andy at pdd-andy-mbp->ruby p4conf.rb --apidir /Users/andy/src/p4api-2009.1.211694/

Starting to configure P4/Ruby for building

Found 2009.1 Perforce API in /Users/andy/src/p4api-2009.1.211694

P4/Ruby Configuration Summary
-----------------------------

Using Perforce API Version: 2009.1
API headers and libs from : /Users/andy/src/p4api-2009.1.211694
OS name                   : DARWIN
OS version                : 10
Platform                  : X86
CFLAGS                    : -g -O2  -pipe -fno-common $(cflags) -I/Users/andy/src/p4api-2009.1.211694/include/p4 -DOS_DARWIN -DOS_DARWIN10 -DOS_DARWIN10X86 -DCASE_INSENSITIVE
LIBPATH                   : /Users/andy/src/p4api-2009.1.211694/lib
libs                      : -lclient -lrpc -lsupp

Creating extconf.h
creating Makefile

[~/src/p4ruby-2009.1]
andy at pdd-andy-mbp->make
g++ -bundle -o P4.bundle clientuserruby.o p4.o p4clientapi.o p4mapmaker.o p4mergedata.o p4result.o p4specdata.o specmgr.o -L/Users/andy/src/p4api-2009.1.211694/lib -L. -L/Users/andy/.rvm/rubies/ree-1.8.7-2010.01/lib -L.  -framework Carbon    -lclient -lrpc -lsupp  -ldl -lobjc
ld: warning: in /Users/andy/src/p4api-2009.1.211694/lib/libclient.a, missing required architecture x86_64 in file
ld: warning: in /Users/andy/src/p4api-2009.1.211694/lib/librpc.a, missing required architecture x86_64 in file
ld: warning: in /Users/andy/src/p4api-2009.1.211694/lib/libsupp.a, missing required architecture x86_64 in file
Undefined symbols:
    "FileSys::Compare(FileSys*, Error*)", referenced from:
        ClientUserRuby::Diff(FileSys*, FileSys*, int, char*, Error*)in clientuserruby.o
    "Spec::Count()", referenced from:
        SpecMgr::SpecFields(StrPtr*)      in specmgr.o
    "_rb_str_new", referenced from:

<<   snip - there is 1000+ additional compiler dump>> --------------------------------------------------------------------------------
This email and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed. If
you have received this email in error please notify the system manager. Please
note that any views or opinions presented in this email are solely those of the
author and do not necessarily represent those of Perforce Software. Finally,
the recipient should check this email and any attachments for the presence of
viruses. Perforce Software accepts no liability for any damage caused by any
virus transmitted by this email.

Perforce Software UK Ltd is registered in England and Wales as company no.
3816019 at the following address: West Forest Gate, Wellington Road, Wokingham,
RG40 2AQ, UK
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed. If 
you have received this email in error please notify the system manager. Please 
note that any views or opinions presented in this email are solely those of the 
author and do not necessarily represent those of Perforce Software. Finally, 
the recipient should check this email and any attachments for the presence of 
viruses. Perforce Software accepts no liability for any damage caused by any 
virus transmitted by this email.

Perforce Software UK Ltd is registered in England and Wales as company no. 
3816019 at the following address: West Forest Gate, Wellington Road, Wokingham,
RG40 2AQ, UK
-------------------------------------------------------------------------------- 

-- 
Andy Koch, Web Applications Developer	
PC-Doctor, Inc.
9805 Double R Boulevard, Suite 301
Reno, NV 89521
775-336-4079
andy.koch at pc-doctor.com

CONFIDENTIALITY
The information contained in this message is confidential. It is intended to be read only by the individual or entity to whom it is addressed or by an authorized designee. If the reader of this message is not the intended recipient, be aware that distribution of this message in any form is strictly prohibited. If you have received this message in error, please immediately notify the sender and destroy any copy of this message.



More information about the p4ruby mailing list