Hello everyone,
To explain the problem, I'm on a Dell Optiflex 5270 AIO series, I installed FreeBSD for use without Internet (it's an obligation imposed by my work environment) I still have Internet access on another Windows machine. So I gradually installed my development environment with the aim of compiling objective C.
I'm not a FreeBSD professional, my experience is limited to using Linux, so please excuse me if I don't use it properly for the first time.
Offline, I have two ways of installing packages:
- Via ports
- Via pkg install ‘package_name’.
So little by little I installed Gnome, sublimeText and GNUstep (make, back, base and tried to compile with clang a simple program that displays Hello World!
There's the programme :
Don't pay too much attention to the code itself as I don't yet know the difference between version 1 and 2 of objective C, I just wanted to compile without errors by first importing a GNUstep library
And How i try to compile it :
I've got an error that says :
My clang version :
I'd like to point out that I've tested clang with a C program and it compiles perfectly.
My FreeBSD :
I tried to deinstall install GNUstep but nothing change, maybe I'm completely off the mark but I'm running out of ideas to solve this problem
I also tried with gcc but i've got problem with some ABI fragile :
Thanks for your help
To explain the problem, I'm on a Dell Optiflex 5270 AIO series, I installed FreeBSD for use without Internet (it's an obligation imposed by my work environment) I still have Internet access on another Windows machine. So I gradually installed my development environment with the aim of compiling objective C.
I'm not a FreeBSD professional, my experience is limited to using Linux, so please excuse me if I don't use it properly for the first time.
Offline, I have two ways of installing packages:
- Via ports
- Via pkg install ‘package_name’.
So little by little I installed Gnome, sublimeText and GNUstep (make, back, base and tried to compile with clang a simple program that displays Hello World!
There's the programme :
Code:
#import <Foundation/Foundation.h>
/*
int main(int argc, const char * argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSLog(@"Hello, World!");
[pool drain];
return 0;
}
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSLog(@"Hello, World!");
}
return 0;
}
*/
Don't pay too much attention to the code itself as I don't yet know the difference between version 1 and 2 of objective C, I just wanted to compile without errors by first importing a GNUstep library
And How i try to compile it :
Code:
clang -V -I/usr/local/include/objc \
-I/usr/local/GNUstep/System/Library/Headers \
-L/usr/local/GNUstep/System/Library/Libraries \
-lgnustep-base -fconstant-string-class=NSConstantString \
-o HelloWorld hello.m
I've got an error that says :
Code:
root@dell-pc:/objectiveCproject/helloWorld # clang -v -I/usr/local/include/objc
\
-I/usr/local/GNUstep/System/Library/Headers \
-L/usr/local/GNUstep/System/Library/Libraries \
-lgnustep-base -fconstant-string-class=NSConstantString -fobjc-nonfragile-abi \
-o HelloWorld hello.m
FreeBSD clang version 16.0.6 (https://github.com/llvm/llvm-project.git llvmorg-16.0.6-0-g7cbf1a259152)
Target: x86_64-unknown-freebsd14.0
Thread model: posix
InstalledDir: /usr/bin
"/usr/bin/clang" -cc1 -triple x86_64-unknown-freebsd14.0 -emit-obj -mrelax-all -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name hello.m -mrelocation-model static -mframe-pointer=all -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -v -fcoverage-compilation-dir=/objectiveCproject/helloWorld -resource-dir /usr/lib/clang/16 -I /usr/local/include/objc -I /usr/local/GNUstep/System/Library/Headers -internal-isystem /usr/lib/clang/16/include -internal-externc-isystem /usr/include -fdebug-compilation-dir=/objectiveCproject/helloWorld -fconstant-string-class NSConstantString -ferror-limit 19 -fgnuc-version=4.2.1 -fobjc-runtime=gnustep -fobjc-encode-cxx-class-template-spec -fobjc-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/hello-a20631.o -x objective-c hello.m
clang -cc1 version 16.0.6 based upon LLVM 16.0.6 default target x86_64-unknown-freebsd14.0
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include/objc
/usr/local/GNUstep/System/Library/Headers
/usr/lib/clang/16/include
/usr/include
End of search list.
"/usr/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 --hash-style=both --enable-new-dtags -o HelloWorld /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/local/GNUstep/System/Library/Libraries -L/usr/lib -lgnustep-base /tmp/hello-a20631.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o
ld: error: /usr/local/GNUstep/System/Library/Libraries/libgnustep-base.so is incompatible with /usr/lib/crt1.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
My clang version :
Code:
root@dell-pc:/objectiveCproject/helloWorld # clang --version
FreeBSD clang version 16.0.6 (https://github.com/llvm/llvm-project.git llvmorg-16.0.6-0-g7cbf1a259152)
Target: x86_64-unknown-freebsd14.0
Thread model: posix
InstalledDir: /usr/bin
I'd like to point out that I've tested clang with a C program and it compiles perfectly.
My FreeBSD :
Code:
FreeBSD dell-pc 14.0-RELEASE FreeBSD 14.0-RELEASE #0 releng/14.0-n265380-f9716eee8ab4: Fri Nov 10 05:57:23 UTC 2023 root@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERICamd64
I tried to deinstall install GNUstep but nothing change, maybe I'm completely off the mark but I'm running out of ideas to solve this problem
I also tried with gcc but i've got problem with some ABI fragile :
Code:
/usr/local/GNUstep/System/Library/Headers/GNUstepBase/GSVersionMacros.h:294:6: error: #error "Your gnustep-base was configured for the objc-nonfragile-abi but you are not using it now."
294 | # error "Your gnustep-base was configured for the objc-nonfragile-abi but you are not using it now."
| ^~~~~
In file included from /usr/local/GNUstep/System/Library/Headers/objc/runtime.h:219,
from /usr/local/GNUstep/System/Library/Headers/objc/objc.h:1,
from /usr/local/GNUstep/System/Library/Headers/Foundation/Foundation.h:31:
/usr/local/GNUstep/System/Library/Headers/objc/slot.h:31:1: sorry, unimplemented: '_Atomic' in Objective-C
31 | OBJC_PUBLIC extern _Atomic(uint64_t) objc_method_cache_version;
| ^~~~~~~~~~~
Thanks for your help