Re: Getting Objective-C 2.0 working

2012-06-30 Thread David Chisnall
On 30 Jun 2012, at 18:38, guillaume_c wrote:

>  I have tried ./configure but with no success

There is no configure script, but there is a Makefile.  Maybe that would be a 
sensible thing to try next...

David

-- Sent from my PDP-11
___
Gnustep-dev mailing list
Gnustep-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/gnustep-dev


Re: Getting Objective-C 2.0 working

2012-06-30 Thread guillaume_c

Hi,

A newbie question (I am trying to switch from OS X to Ubuntu as a
development platform). I came to this thread as I encountered the error
"'objc/blocks_runtime.h' file not found" when compiling an ObjC program that
uses blocks. I have uninstalled GNUStep and I have downloaded libobjc2-1.6.
Now, what do I do? I have tried ./configure but with no success... Which
instructions should I follow to install libobjc2?  Thanks!

Guillaume

-- 
View this message in context: 
http://old.nabble.com/Getting-Objective-C-2.0-working-tp33868046p34096037.html
Sent from the GNUstep - Dev mailing list archive at Nabble.com.


___
Gnustep-dev mailing list
Gnustep-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/gnustep-dev


Re: Getting Objective-C 2.0 working

2012-05-18 Thread Laurent Michel

On May 18, 2012, at 2:40 PM, David Chisnall wrote:

> On 18 May 2012, at 18:41, Laurent Michel wrote:
> 
>> Calling [GSMutableSet -enumerateObjectsUsingBlock:] with incorrect 
>> signature.  Method has v12@0:4^{?=^vii^?}8, selector has v12@0:4@?8
> 
> This sounds like you did not compile GNUstep with a compiler with blocks 
> support (which also means that you will get exciting things happening if you 
> try subclassing NSRegularExpression).  In this case, GNUstep will fall back 
> to defining the block type as a struct and doing some hackery to invoke the 
> block.

Hmm. That's odd. Everything was compiled with clang and clang++ and linked with 
gcc
I followed these directions: 
http://heronsperch.blogspot.com/2011/07/building-clang-for-use-with-gnustep.html

I also uses -fblocks everywhere in my own makefiles. I'll double check just in 
case.


> 
> Try adding -fblocks to the CFLAGS your GNUstep install.

Ok. I'll do that and recompile. That's probably the reason (my own makefile use 
-fblocks but the GNUstep ones might not).

>  This is default on *BSD, but not on some other operating systems.  It should 
> be implicit if you are using the GNU runtime and specify the non-fragile ABI 
> though, so the fact that it isn't implies that yo are using the fragile ABI 
> (which I would recommend against).  Try specifying --disable-mixed-abi (or 
> something like that, try --help to find the correct option) to configure for 
> base.

Good point. My own sources are compiled as follows:

clang -g -I/usr/GNUstep/System/Library/Headers -I. -fblocks 
-fobjc-nonfragile-abi -c CPFactory.m 

so I already use nonfragile and blocks. But I didn't muck with the GNUstep 
CFLAGS and I bet that these guys do not have these two options. 

The code runs though. Kudos on the GNUstep libs. Once I figured out (with the 
list help) the magical makefile, it all compiled cleanly (only this runtime 
issue left).

Thanks David!

--
  Laurent


> 
> David
> 
> -- Sent from my Apple II

___
Gnustep-dev mailing list
Gnustep-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/gnustep-dev


Re: Getting Objective-C 2.0 working

2012-05-18 Thread David Chisnall
On 18 May 2012, at 18:41, Laurent Michel wrote:

> Calling [GSMutableSet -enumerateObjectsUsingBlock:] with incorrect signature. 
>  Method has v12@0:4^{?=^vii^?}8, selector has v12@0:4@?8

This sounds like you did not compile GNUstep with a compiler with blocks 
support (which also means that you will get exciting things happening if you 
try subclassing NSRegularExpression).  In this case, GNUstep will fall back to 
defining the block type as a struct and doing some hackery to invoke the block.

Try adding -fblocks to the CFLAGS your GNUstep install.  This is default on 
*BSD, but not on some other operating systems.  It should be implicit if you 
are using the GNU runtime and specify the non-fragile ABI though, so the fact 
that it isn't implies that yo are using the fragile ABI (which I would 
recommend against).  Try specifying --disable-mixed-abi (or something like 
that, try --help to find the correct option) to configure for base.

David

-- Sent from my Apple II
___
Gnustep-dev mailing list
Gnustep-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/gnustep-dev


Re: Getting Objective-C 2.0 working

2012-05-18 Thread Laurent Michel
I'm answering my own email.

On 
http://wwwmain.gnustep.org/resources/downloads.php?site=ftp%3A%2F%2Fftp.gnustep.org%2Fpub%2Fgnustep%2F

Do *not* use GNUstep-startup

Download the four individual packages (Make/Base/GUI/Backend) and

#1 : compile / install make
#2 : compile / install libobjc2
#3 : compile / install the three remaining (Base/Gui/Backend)

Enjoy!

It works ;-)

Very happy camper.

-- 
  Laurent


PS/ Only issue I have now is in my code:

Calling [GSMutableSet -enumerateObjectsUsingBlock:] with incorrect signature.  
Method has v12@0:4^{?=^vii^?}8, selector has v12@0:4@?8


This happens when the following runs (and that runs fine on MacOS 10.7.x)

-(float)varOrdering:(id)x
{
   __block float h = 0.0;
   NSSet* theConstraints = _cv[[x getId]];   
   [theConstraints enumerateObjectsUsingBlock:^void(id obj, BOOL *stop) {
  if ([obj nbUVars] - 1 > 0)
 h += _w[[obj getId]];
   }];
   return h / [x domsize];
}


That enumerateObjects looks innocuous to me.






On May 18, 2012, at 12:03 PM, Laurent Michel wrote:

> Dear Eric (and everybody else reading! ;-)),
> 
> One more question, if I can abuse of your time some more
> 
> To make a long story short, I apparently failed to get GNUstep compiled with 
> the newer libobjc2 runtime you pointed me at, but my own
> code does compile against that runtime. However, my code does not link 
> succesfully against the GNUstep I cobbled together on Ubuntu. 
> 
> Any attempt to build GNUstep with the gcc tool suite pulls a different 
> (older) libobjc runtime and the two are incompatible. So I eventually decide 
> to remove all the tools that came with ubuntu and try to build GNUstep with 
> clang. 
> 
> Note that I successfully build the libobjc2 you pointed me to. 
> 
> To attempt a build of GNUstep:
> 
> 1. export CC=clang
> 2. ./InstallGNUstep
> 
> Step #2 fails to succesffully configure GNUstep though. Here is the report it 
> produces at the end:
> 
> * Startup configuration report  *
> *
> --
> W107 Warning
> No XML library support was found. The GNUstep uses XML for many basic
> functions, such as reading/writing property lists. XML will automatically
> be disabled, but this is probably not what you want. If possible you should
> stop installation and install an xml library.
> --
> W125 Warning 
> The OpenSSL package (libcrypto, etc) is needed to access https connections
> with NSURL and for other purposes. This package is optional so you are
> not required to install it.
> --
> E150 Error
> You do not have the GNU Objective-C compiler installed
> Check to make sure you have a full installation of the GCC
> compiler that includes the Objective-C headers and libraries
> --
> W272 Warning
> You do not have a recent version of the libobjc library. Startup
> will install one.
> --
> E281 Error
> I don't seem to be able to use your Objective-C compiler to produce
> working binaries!  Please check your Objective-C compiler installation.
> For gcc-3.0.x make sure that your compiler's libgcc_s and libobjc
> can be found by the dynamic linker - usually that requires you to add
> the directory given by gcc -print-file-name=libobjc.so to your
> LD_LIBRARY_PATH or /etc/ld.so.conf.
> 
> 
> However: 
> 1. I do have libxml2 and libxml2-dev
> 2. I do lhave libopenssl and its dev package as well
> 3. Scrolling up, I can see that the configure invoked by this script did try 
> to use clang. 
> 
> For instance:
> 
> checking for library combo... gnu-gnu-gnu
> checking for prefix... checking for gcc... clang
> checking whether the C compiler works... yes
> checking for C compiler default output file name... a.out
> checking for suffix of executables... 
> checking whether we are cross compiling... no
> checking for suffix of object files... o
> checking whether we are using the GNU C compiler... yes
> checking whether clang accepts -g... yes
> checking for clang option to accept ISO C89... none needed
> checking how to run the C preprocessor... clang -E
> configure: Configuring on linux-gnu
> checking compiler version... gcc major version is 4
> checking for apple compiler... no
> checking for ar... ar
> checking for ld... ld
> checking for dlltool... no
> checking for gawk... no
> checking for awk... awk
> checking for patch... patch
> checking for ranlib... ranlib
> checking for a BSD-compatible install... /usr/bin/install -c
> checking whether ln -s works... yes
> checking for whoami... /usr/bin/whoami
> checking for gmake... no
> checking for make... make
> checking make version > 3.75... yes GNU Make 3.81
> checking broken make... ok
> checking binuti

Re: Getting Objective-C 2.0 working

2012-05-18 Thread Laurent Michel
Dear Eric (and everybody else reading! ;-)),

One more question, if I can abuse of your time some more

To make a long story short, I apparently failed to get GNUstep compiled with 
the newer libobjc2 runtime you pointed me at, but my own
code does compile against that runtime. However, my code does not link 
succesfully against the GNUstep I cobbled together on Ubuntu. 

Any attempt to build GNUstep with the gcc tool suite pulls a different (older) 
libobjc runtime and the two are incompatible. So I eventually decide to remove 
all the tools that came with ubuntu and try to build GNUstep with clang. 

Note that I successfully build the libobjc2 you pointed me to. 

To attempt a build of GNUstep:

1. export CC=clang
2. ./InstallGNUstep

Step #2 fails to succesffully configure GNUstep though. Here is the report it 
produces at the end:

* Startup configuration report  *
*
--
W107 Warning
No XML library support was found. The GNUstep uses XML for many basic
functions, such as reading/writing property lists. XML will automatically
be disabled, but this is probably not what you want. If possible you should
stop installation and install an xml library.
--
W125 Warning 
The OpenSSL package (libcrypto, etc) is needed to access https connections
with NSURL and for other purposes. This package is optional so you are
not required to install it.
--
E150 Error
You do not have the GNU Objective-C compiler installed
Check to make sure you have a full installation of the GCC
compiler that includes the Objective-C headers and libraries
--
W272 Warning
You do not have a recent version of the libobjc library. Startup
will install one.
--
E281 Error
I don't seem to be able to use your Objective-C compiler to produce
working binaries!  Please check your Objective-C compiler installation.
For gcc-3.0.x make sure that your compiler's libgcc_s and libobjc
can be found by the dynamic linker - usually that requires you to add
the directory given by gcc -print-file-name=libobjc.so to your
LD_LIBRARY_PATH or /etc/ld.so.conf.


However: 
1. I do have libxml2 and libxml2-dev
2. I do lhave libopenssl and its dev package as well
3. Scrolling up, I can see that the configure invoked by this script did try to 
use clang. 

For instance:

checking for library combo... gnu-gnu-gnu
checking for prefix... checking for gcc... clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether clang accepts -g... yes
checking for clang option to accept ISO C89... none needed
checking how to run the C preprocessor... clang -E
configure: Configuring on linux-gnu
checking compiler version... gcc major version is 4
checking for apple compiler... no
checking for ar... ar
checking for ld... ld
checking for dlltool... no
checking for gawk... no
checking for awk... awk
checking for patch... patch
checking for ranlib... ranlib
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking for whoami... /usr/bin/whoami
checking for gmake... no
checking for make... make
checking make version > 3.75... yes GNU Make 3.81
checking broken make... ok
checking binutils version > 2.9... yes GNU ld (GNU Binutils for Ubuntu) 2.22
checking iconv version > 2.1... yes 2.15
checking iconv support... yes, in libc
checking for xml2-config... /usr/bin/xml2-config
checking for libxml - version >= 2.3.0... no
*** Could not run libxml test program, checking why...
checking the Objective-C runtime... GNU


It also says it is going to try to use the GNU version of the objective-C 
runtime. So I suspect that he can't locate the newer one I gave
even though I added it in ldconfig:

root@ubuntu:/usr/local/src/gnustep-startup-0.28.0# ldconfig -p|grep objc
libobjcxx.so.4.6.0 (libc6) => /usr/local/lib/libobjcxx.so.4.6.0
libobjcxx.so.4.6 (libc6) => /usr/local/lib/libobjcxx.so.4.6
libobjcxx.so.4 (libc6) => /usr/local/lib/libobjcxx.so.4
libobjcxx.so (libc6) => /usr/local/lib/libobjcxx.so
libobjc.so.4.6.0 (libc6) => /usr/local/lib/libobjc.so.4.6.0
libobjc.so.4.6 (libc6) => /usr/local/lib/libobjc.so.4.6
libobjc.so.4 (libc6) => /usr/local/lib/libobjc.so.4
libobjc.so (libc6) => /usr/local/lib/libobjc.so


So it is present. 

I checked the header and:

root@ubuntu:/usr/local/src/gnustep-startup-0.28.0/build# updatedb
root@ubuntu:/usr/local/src/gnust

Re: Getting Objective-C 2.0 working

2012-05-18 Thread Laurent Michel
Thanks Eric. That helps a lot! I got caught by the libobjc2 naming in Ubuntu. 
(there is even a libobjc3 package under Ubuntu).  I'll give it a try this 
morning from source.

Thanks for the pointer!

Sent from my iPad

On May 17, 2012, at 11:09 PM, Eric Wasylishen  wrote:

> Hi Laurent,
> 
> To use blocks in GNUstep you need to use the GNUstep Objective-C runtime, 
> a.k.a. libobjc2, whose releases are available here: 
> http://download.gna.org/gnustep/  
> 
> Unfortunately, I don't think this library is available in debian/ubuntu 
> (though I could be wrong!). Confusingly, the package called "libobjc2" in 
> debian/ubuntu is unrelated to the GNUstep Objective-C runtime and doesn't 
> support blocks.
> 
> So, as far as I know, what you'll need to do is remove the Ubuntu packages 
> for gnustep you installed, then install libobjc2 and GNUstep again from the 
> source packages. (Latest gnustep releases are at: 
> http://wwwmain.gnustep.org/resources/downloads.php)
> 
> 
> The Etoile ObjectiveC2 framework no longer exists and isn't something you 
> need to worry about. IIRC, the initial support in GNUstep for the modern 
> Objective-C runtime api's was started in that framework in Etoile, but that 
> code has since been merged into GNUstep and libobjc2.
> 
> Hope this helps,
> 
> Eric
> 
> On 2012-05-17, at 9:27 PM, Laurent Michel wrote:
> 
>> Dear All,
>> 
>> I develop on MaOS and would love to port my code to Linux. Essentially, I 
>> use Objective-C 2.0 with clang as a compiler.
>> I created an Ubuntu 12.04 VM under VMWare and installed GNUStep through that 
>> channel. I compiled a silly hello world and that worked fine.
>> My problems started when I tried to compile my own code which makes *heavy* 
>> use of Objective-C blocks. I always end-up seeing this message:
>> 
>> clang -I/usr/GNUstep/System/Library/Headers  -fblocks -fobjc-nonfragile-abi 
>> -c CPFactory.m 
>> In file included from CPFactory.m:27:
>> In file included from ./CPFactory.h:27:
>> In file included from 
>> /usr/GNUstep/System/Library/Headers/Foundation/Foundation.h:30:
>> /usr/GNUstep/System/Library/Headers/GNUstepBase/GSVersionMacros.h:287:14: 
>> fatal error: 'objc/blocks_runtime.h' file not found
>> 
>> 
>> namely, it cannot find objc/blocks_runtime.h
>> 
>> I started googling around and I found lots of conflicting information on the 
>> topic as well as reference to Etoile, and ObjectiveC2 (a framework) but it 
>> seems largely incompatible with GNUStep. I'll looking for some directions to 
>> get going with a simple code that uses blocks. For instance, a silly test 
>> like:
>> 
>> #import 
>> 
>> int foo(int (^b)(int)) {
>>  return b(5);
>> }
>> 
>> int main() {
>> 
>>  int y = 10;
>>  int z = foo(^(int x) {
>> return y + x; 
>> });
>>  NSLog(@"result is %d\n",z);
>> }
>> 
>> 
>> Should compile and run when linked against the Foundation framework. 
>> 
>> Any pointer is greatly appreciated.
>> 
>> --
>> Laurent
>> 
>> 
>> 
>> 
>> ___
>> Gnustep-dev mailing list
>> Gnustep-dev@gnu.org
>> https://lists.gnu.org/mailman/listinfo/gnustep-dev
> 

___
Gnustep-dev mailing list
Gnustep-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/gnustep-dev


Re: Getting Objective-C 2.0 working

2012-05-17 Thread Eric Wasylishen
Hi Laurent,

To use blocks in GNUstep you need to use the GNUstep Objective-C runtime, 
a.k.a. libobjc2, whose releases are available here: 
http://download.gna.org/gnustep/  

Unfortunately, I don't think this library is available in debian/ubuntu (though 
I could be wrong!). Confusingly, the package called "libobjc2" in debian/ubuntu 
is unrelated to the GNUstep Objective-C runtime and doesn't support blocks.

So, as far as I know, what you'll need to do is remove the Ubuntu packages for 
gnustep you installed, then install libobjc2 and GNUstep again from the source 
packages. (Latest gnustep releases are at: 
http://wwwmain.gnustep.org/resources/downloads.php)


The Etoile ObjectiveC2 framework no longer exists and isn't something you need 
to worry about. IIRC, the initial support in GNUstep for the modern Objective-C 
runtime api's was started in that framework in Etoile, but that code has since 
been merged into GNUstep and libobjc2.

Hope this helps,

Eric

On 2012-05-17, at 9:27 PM, Laurent Michel wrote:

> Dear All,
> 
> I develop on MaOS and would love to port my code to Linux. Essentially, I use 
> Objective-C 2.0 with clang as a compiler.
> I created an Ubuntu 12.04 VM under VMWare and installed GNUStep through that 
> channel. I compiled a silly hello world and that worked fine.
> My problems started when I tried to compile my own code which makes *heavy* 
> use of Objective-C blocks. I always end-up seeing this message:
> 
> clang -I/usr/GNUstep/System/Library/Headers  -fblocks -fobjc-nonfragile-abi 
> -c CPFactory.m 
> In file included from CPFactory.m:27:
> In file included from ./CPFactory.h:27:
> In file included from 
> /usr/GNUstep/System/Library/Headers/Foundation/Foundation.h:30:
> /usr/GNUstep/System/Library/Headers/GNUstepBase/GSVersionMacros.h:287:14: 
> fatal error: 'objc/blocks_runtime.h' file not found
> 
> 
> namely, it cannot find objc/blocks_runtime.h
> 
> I started googling around and I found lots of conflicting information on the 
> topic as well as reference to Etoile, and ObjectiveC2 (a framework) but it 
> seems largely incompatible with GNUStep. I'll looking for some directions to 
> get going with a simple code that uses blocks. For instance, a silly test 
> like:
> 
> #import 
> 
> int foo(int (^b)(int)) {
>   return b(5);
> }
> 
> int main() {
> 
>   int y = 10;
>   int z = foo(^(int x) {
>return y + x; 
>  });
>   NSLog(@"result is %d\n",z);
> }
> 
> 
> Should compile and run when linked against the Foundation framework. 
> 
> Any pointer is greatly appreciated.
> 
> --
>  Laurent
> 
> 
> 
> 
> ___
> Gnustep-dev mailing list
> Gnustep-dev@gnu.org
> https://lists.gnu.org/mailman/listinfo/gnustep-dev


___
Gnustep-dev mailing list
Gnustep-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/gnustep-dev


Getting Objective-C 2.0 working

2012-05-17 Thread Laurent Michel
Dear All,

I develop on MaOS and would love to port my code to Linux. Essentially, I use 
Objective-C 2.0 with clang as a compiler.
I created an Ubuntu 12.04 VM under VMWare and installed GNUStep through that 
channel. I compiled a silly hello world and that worked fine.
My problems started when I tried to compile my own code which makes *heavy* use 
of Objective-C blocks. I always end-up seeing this message:

clang -I/usr/GNUstep/System/Library/Headers  -fblocks -fobjc-nonfragile-abi -c 
CPFactory.m 
In file included from CPFactory.m:27:
In file included from ./CPFactory.h:27:
In file included from 
/usr/GNUstep/System/Library/Headers/Foundation/Foundation.h:30:
/usr/GNUstep/System/Library/Headers/GNUstepBase/GSVersionMacros.h:287:14: fatal 
error: 'objc/blocks_runtime.h' file not found


namely, it cannot find objc/blocks_runtime.h

I started googling around and I found lots of conflicting information on the 
topic as well as reference to Etoile, and ObjectiveC2 (a framework) but it 
seems largely incompatible with GNUStep. I'll looking for some directions to 
get going with a simple code that uses blocks. For instance, a silly test like:

#import 

int foo(int (^b)(int)) {
   return b(5);
}

int main() {

   int y = 10;
   int z = foo(^(int x) {
 return y + x; 
  });
   NSLog(@"result is %d\n",z);
}


Should compile and run when linked against the Foundation framework. 

Any pointer is greatly appreciated.

--
  Laurent




___
Gnustep-dev mailing list
Gnustep-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/gnustep-dev