Opened 10 years ago

Closed 8 years ago

#3561 closed enhancement (invalid)

Objective C not supported by gcc

Reported by: js Owned by: jprostko
Priority: low Milestone: Unscheduled
Component: Build System Version: R1/Development
Keywords: objective c gnu gcc Cc: michaelvoliveira@…
Blocked By: Blocking:
Has a Patch: yes Platform: All

Description

Hi!

The gcc that comes with Haiku does not support Objective C. This is not a big problem atm, as there aren't many (any?) Objective C apps for Haiku yet, but it won't hurt to enable it. All you need to do is change the configure line of gcc and add objc to --enable-languages there (currently you have --enable-languages=c,c++, you could change it to either --enable-languages=c,c++,objc,obj-c++ or --enable-languages=c,c++,objc. Including obj-c++ would be better so that bindings for Haiku's C++ APIs could be written). Reason is that I like Haiku and I'd like to port my Objective C Framework Library to it so that applications using it run out of the box on Haiku.

Attachments (1)

haiku-objc.patch.bz2 (246.2 KB ) - added by js 8 years ago.

Download all attachments as: .zip

Change History (16)

comment:1 by bonefish, 10 years ago

Priority: normallow

comment:2 by mmadia, 10 years ago

Owner: changed from bonefish to jprostko

re-assigning to Joe as part of the GCC 4.4.x upgrade

comment:3 by js, 10 years ago

jprostko sent me a build that seems to work. However, my resulting binary has problems finding libobjc.so. It seems that using the static version works, though.

comment:4 by michaelvoliveira, 9 years ago

Cc: michaelvoliveira@… added
Keywords: objetive c gnu preprocessor added
Version: R1/pre-alpha1R1/Development

Some news about this ticket? Maybe Korli could handle that

comment:5 by js, 8 years ago

I wrote a patch to add ObjC support, please apply it: https://webkeks.org/haiku-objc.patch

I successfully compiled ObFW <https://webkeks.org/objfw/> with it and all tests ran (You need to type make install in srcs though before the tests run, as it seems LD_LIBRARY_PATH is ignored by Haiku).

by js, 8 years ago

Attachment: haiku-objc.patch.bz2 added

comment:6 by js, 8 years ago

Has a Patch: set

comment:7 by js, 8 years ago

Keywords: objective gcc added; objetive preprocessor removed

comment:8 by jprostko, 8 years ago

I believe the plan is to only have C/C++ language support as part of the buildtools in the Haiku repository, as they are the only ones that are needed to build Haiku. Obviously, what you are getting at is having the GCC optional package have Objective C support though.

I think the best plan is to set up something at Haiku Ports in sys-devel for GCC so anybody can build GCC however they want, including other language support, for example. That way we can leave any patches having to do with anything other than C or C++ out of the trunk of the Haiku buildtools. Based on size constraints we tend to have for release images, the Development package that comes with Haiku may or may not include other language support in the future.

I think at some point we kind of need more than just C/C++ though in a GCC package, whether that is included in the main GCC package or some kind of alternate package with support for all languages that Haiku supports built-in. Right now there is a DevelopmentJava available, but making something like DevelopmentObjc would be kind of messy compared to that, given its nature.

I think this needs discussed a bit in any case, so I'm personally not going to just apply the patch to the buildtools. It is cool you got it working, but I want to discuss it first (here or elsewhere) to decide the best course of action.

By the way, how much space does the .so for objc take up? I doubt it's much, and if it isn't, maybe it can just be added to the GCC optional package without any consequence. We'd have to keep the source somewhere though, and I think keeping it at HaikuPorts would make more sense than in the main buildtools repo.

comment:9 by js, 8 years ago

I tend to disagree, as ObjC is reaaally small and easy to maintain. I had to patch 0 lines of code, all I did was get the gcc-4.4.4-objc package, extract it in the right place and add it to --enable-language. The .a file is 370 KB, so not noticable at all. It is a pain to checkout GCC and build it, it took several hours using 2 cores on my Core 2 Duo 2.66 GHz. Not including it basically means preventing everyone with a slower machine from using ObjC. I really don't see any reason not to include it, as it is part of GCC and not even really a new language, but an addition to C + a 370 KB runtime. I can fully understand why you don't want Ada and Fortran in there, but for ObjC I don't see a reason. It's small, it's C, it doesn't hurt and it's a massive pain to add it later. Plus you want an Objective-C++ compiler that is guaranteed to be compatible to the rest of the system - and you can only have that if your systems C++ compiler and your Objective-C++ compiler are the same. This is important for interfacing the BeAPI stuff.

comment:10 by zooey, 8 years ago

Sorry, but I don't think we should include support for any other language than c & c++ in our basic gcc package (since those are the languages directly supported by haiku). Any other languages, no matter how small, should come as separate package.

It doesn't matter that it's a pain to download gcc and build a specific language backend, since you're free to do that once and create an optional package for objc and/or objc++. That can then be installed as easily as gcc.

comment:11 by axeld, 8 years ago

An optional package could be hosted at Haiku, and could be an alternative for the basic package.

In the future, I'm not sure how zooey planned the packagement in this regard, ie. if a certain functionality could be provided by different packages solving mostly the same dependencies.

comment:12 by michaelvoliveira, 8 years ago

Could you provide an optional package JS? I need to build some dependency for games

comment:13 by js, 8 years ago

@zooey: And how do you want to solve the issue with interfacing BeAPI? Can you please give me a valid reason not to include it? If you don't want to maintain that part of gcc, I'll be happy to do so. As said, the *unstripped* libobjc.a is just 350 KB. If you think that's too much overhead, exclude the libobjc.a and cc1obj and cc1objplus from the package, but build it with support for it. Even in order to install it as an optional package, it needs to be built with the rest. And as it's that small anyway, I don't see any reason not to include it. IMHO ObjC is just C anyway, so if you want to include C and C++, I don't see any reason to not include ObjC as well. There are far more reasons to build gcc with ObjC support than without. I suggest you rethink including it.

comment:14 by js, 8 years ago

@michaelvoliveira: Sure, but which games do use ObjC? I guess you also need GNUstep then?

comment:15 by scottmc, 8 years ago

Milestone: R1Unscheduled
Resolution: invalid
Status: newclosed

@js can you put together a .bep file for this and open a ticket at haikuports? we could then make it available as an optionalpackage.

Note: See TracTickets for help on using tickets.