[Top][All Lists]

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

Can't compile with libobjc2

From: Albert Palacios
Subject: Can't compile with libobjc2
Date: Tue, 7 Feb 2023 19:48:36 +0000


Maybe someone can help me. 

I managed to install libobjc2 on Ubuntu 22.04 with: 

sudo apt install cmake
git clone
cd libobjc2
git submodule init && git submodule update
mkdir Build && cd Build
make -j8
sudo -E make install
sudo ldconfig

And I am trying to compile and run a very simple application:

#include <stdio.h>
int main() {
@autoreleasepool {
printf("Hola món\n");
return 0;

But when I call:

clang main.m -fobjc-runtime=gnustep-2.0 -o main && ./main

I get the next error:

/usr/bin/ld: /tmp/main-f8c82f.o: in function `main':
main.m:(.text+0x18): undefined reference to `objc_autoreleasePoolPush'
/usr/bin/ld: main.m:(.text+0x30): undefined reference to `objc_autoreleasePoolPop'
/usr/bin/ld: /tmp/main-f8c82f.o: in function `.objcv2_load_function':
main.m:(.text..objcv2_load_function[.objcv2_load_function]+0xc): undefined reference to `__objc_load'
clang: error: linker command failed with exit code 1 (use -v to see invocation)



reply via email to

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