discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Linker error while trying to use arc


From: Ivan Vučica
Subject: Re: Linker error while trying to use arc
Date: Sun, 28 Apr 2019 11:05:03 +0100

(To clarify: -fobjc-runtime=gnustep-2.0 changes which runtime functions and features the compiler expects when compiling, not which runtime the linker links against when linking. If you tell clang to expect GNUstep's libobjc2 version 2.0, you need to link against it as well.)

sent from phone

On Sun, Apr 28, 2019, 11:02 Ivan Vučica <ivan@vucica.net> wrote:
libobjc is likely to be GNU (GCC) runtime.

Did you install libobjc2? If so, try passing -lobjc2 to link against libobjc2.so.

Long-term, you should consider just using gnustep-make for both CLI tools and GUI apps and, if you need to make a one-off build without it, use whatever command it generates. Use "make messages=yes" to see the commands.

sent from phone

On Sun, Apr 28, 2019, 00:18 Kristian X <pwishie@gmail.com> wrote:
I am new to using Objective-C and am trying to compile a simple project on Linux.  I started by making sure that all of the Objective-C 2.0 features were working so I compiled with -fobjc-arc only to get: -fobjc-arc is not supported on platforms using the legacy runtime

I tried to fix this error by changing the runtime with -fobjc-runtime=gnustep-2.0, only to get this instead:

/usr/bin/ld: /tmp/main-78cbee.o: in function `main':
main.m:(.text+0x24): undefined reference to `objc_autoreleasePoolPush'
/usr/bin/ld: main.m:(.text+0x32): undefined reference to `objc_retain'
/usr/bin/ld: main.m:(.text+0x4c): undefined reference to `objc_msgSend'
/usr/bin/ld: main.m:(.text+0x6e): undefined reference to `objc_storeStrong'
/usr/bin/ld: main.m:(.text+0x77): undefined reference to `objc_autoreleasePoolPop'
/usr/bin/ld: /tmp/main-78cbee.o: in function `.objcv2_load_function':

I get the same error when trying to compile with the nonfragile ABI,

This is the full command I used while trying to compile my hello world program:
clang main.m -fobjc-arc -fobjc-nonfragile-abi -lobjc -lgnustep-base -lm


_______________________________________________
Discuss-gnustep mailing list
Discuss-gnustep@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnustep

reply via email to

[Prev in Thread] Current Thread [Next in Thread]