Runtime / exceptions model configuration options

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Runtime / exceptions model configuration options

Riccardo Mottola-5
Hi All,

I am a bit confused about how to configure different exceptions and
runtimes in gnustep make and gui!

I notice we have no clear section in a README or INSTALL file or on the
wiki, or, in case, I missed it.

I need to control of it to correctly test libobjc2 by David and also to
avoid this error:

"There are two separate       exception handling mechanisms available
... one based on the standard setjmp() function (which does not require
special compiler support), and one 'native' version where the compiler
manages the exception handling. If you try to use both in the same
executable, exception handlers will not work... which can be pretty
disastrous. This error is telling you that the gnustep-base library was
built using one form of exception handling, but that the gnustep-make
package you are using is building code to use the other form of
exception handling ... with the consequence that exception handling
would be broken in the program you are building. So, somehow your
gnustep-base and gnustep-make package are incompatible, and you need to
replace one of them with a version configured to match the other."

So we have standard and native.

I understand that standard is default for gcc. Fine.

The issue is when wanting to use libobjc2 and/or clang.

gnustep-make if used with clang enables native exceptions (most probably
becausde it is clang's default)

I think that if I use --with-library-combo=ng-gnu-gnu on gnustep-base I
enable automatically also native exceptions

How can I build e.g. with clang and standard exceptions? do I need to
pass specific CFLAGS perhaps or do we have ebtter options? I didn't find
any.

For example, would like to compile code with clang but standard
exceptions, so that I can rule out gcc issues with libobjc2.

Thank you,
Riccardo

_______________________________________________
Gnustep-dev mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/gnustep-dev
Reply | Threaded
Open this post in threaded view
|

Re: Runtime / exceptions model configuration options

Richard Frith-Macdonald-9


> On 6 Jun 2018, at 13:55, Riccardo Mottola <[hidden email]> wrote:
>
> Hi All,
>
> I am a bit confused about how to configure different exceptions and runtimes in gnustep make and gui!
>
> I notice we have no clear section in a README or INSTALL file or on the wiki, or, in case, I missed it.
>
> I need to control of it to correctly test libobjc2 by David and also to avoid this error:
>
> "There are two separate       exception handling mechanisms available ... one based on the standard setjmp() function (which does not require special compiler support), and one 'native' version where the compiler manages the exception handling. If you try to use both in the same executable, exception handlers will not work... which can be pretty disastrous. This error is telling you that the gnustep-base library was built using one form of exception handling, but that the gnustep-make package you are using is building code to use the other form of exception handling ... with the consequence that exception handling would be broken in the program you are building. So, somehow your gnustep-base and gnustep-make package are incompatible, and you need to replace one of them with a version configured to match the other."
>
> So we have standard and native.
>
> I understand that standard is default for gcc. Fine.
>
> The issue is when wanting to use libobjc2 and/or clang.
>
> gnustep-make if used with clang enables native exceptions (most probably becausde it is clang's default)
>
> I think that if I use --with-library-combo=ng-gnu-gnu on gnustep-base I enable automatically also native exceptions
>
> How can I build e.g. with clang and standard exceptions? do I need to pass specific CFLAGS perhaps or do we have ebtter options? I didn't find any.
>
> For example, would like to compile code with clang but standard exceptions, so that I can rule out gcc issues with libobjc2.

Generally you can use 'configure --help' to find out this sort of thing.
In this case, it tells me

--disable-native-objc-exceptions
   Disable native Objective-C exception support (@try / @catch /
   @finally / @synchronized).  If unspecified, Objective-C exception
   support is enabled if the compiler can compile Objective-C code
   containing @try / @catch / @finally / @synchronized.  Please note
   that native exceptions also require support in the Objective-C
   runtime; GNUstep-base will check for that support and may still
   disable native exceptions if such support is not available.
   Use this option if you do not want to use the native Objective-C
   exception support provided by newer compilers.

So the default is for gnustep-make to use native exceptions, but you can override it using --disable-native-objc-exceptions, and you may need to be aware that, if the compiler/runtime gnustep-base sees at configure time does not support native exceptions, then the base configure process may override the setting from when you configured make.  I don't think there should ever be a problem if you configure gnustep-make to use traditional setjmp based exceptions though.

NB. make sure you have a clean instuall when changing this stuff ... if you have some libraries/code built one way and some libraries/code built the other way then you will get problems.


_______________________________________________
Gnustep-dev mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/gnustep-dev
Reply | Threaded
Open this post in threaded view
|

Re: Runtime / exceptions model configuration options

Riccardo Mottola-5
Hi Richard,

Richard Frith-Macdonald wrote:
> So the default is for gnustep-make to use native exceptions, but you can override it using --disable-native-objc-exceptions, and you may need to be aware that, if the compiler/runtime gnustep-base sees at configure time does not support native exceptions, then the base configure process may override the setting from when you configured make.  I don't think there should ever be a problem if you configure gnustep-make to use traditional setjmp based exceptions though.
>
> NB. make sure you have a clean instuall when changing this stuff ... if you have some libraries/code built one way and some libraries/code built the other way then you will get problems.

(I do know I need to recompile everything when switching)

sorry I missed that option :( but actually it doesn't help: I already
had "make" going standard while base native. I hoped forcing would help
though and I tried.

I configured and installed make with this:

./configure --prefix=/ --with-layout=gnustep
--disable-native-objc-exceptions


then I configure base and I explictely see during configure:

checking for non-fragile-abi support... yes
checking for objc_setUncaughtExceptionHandler() in runtime... no
checking for objc_set_unexpected() in runtime... no
checking for _objc_unexpected_exception in runtime... yes
checking whether to enable native Objective-C exceptions... no
checking for objc_sync_enter... (cached) yes
checking for thread-safe +initialize in runtime... yes


yet then build gives the previously copied mismatch error

../../Headers/Foundation/NSException.h:48:2: error: "gnustep-base is
configured
       to use 'traditional' exceptions, but you are building for 'native'
       exceptions."


but how?? maybe there is some trick missing... or configure doesn't
"force" clang

I got around with this:

./configure OBJCFLAGS=-fno-objc-exceptions

but this is inconvenient if I have to add it to every thing I need to
configure/compile. Do you think we can do this automatic with gnustep
make? or maybe we already have some wizardy but it isn ot working?


Riccardo



_______________________________________________
Gnustep-dev mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/gnustep-dev