Cross-compiler: linker failed during make all-gcc on macosx - c

I am following this wiki.osdev tutorial on making a cross-compiler. I am on MACOSX. Everything up to the point of make all-gcc in the build-gcc directory works. The error I get is:
Undefined symbols for architecture arm64: "_host_hooks", referenced from: c_common_no_more_pch() in c-pch.o toplev::main(int, char**) in libbackend.a(toplev.o) gt_pch_save(__sFILE*) in libbackend.a(ggc-common.o) gt_pch_restore(__sFILE*) in libbackend.a(ggc-common.o) ld: symbol(s) not found for architecture arm64
I can't find other people getting this error, any help is appreciated. And I don't know if it's related to my OS i'm using.

Related

Symbol(s) not found for architecture x86_64 while compiling a C file

I tried to run a c file using Mac Terminal. So I put the following command in the Terminal.
gcc main.c
And the following message was shown.
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Prior to this, I also tried to build a C project in Eclipse, but this also showed an error. It says there is one error which is symbol(s) not found for architecture x86_64.
your program is missing the entry point (main function), you have to add this function to your code source.
int main(void){
printf("Hello World");
}

Gstreamer first steps - "Undefined symbols..." error

Probably a noob question but I can't find an answer to this. I've downloaded and installed Gstreamer for Mac from http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-init.html
I copied the code for example 4.1, to initialize GStreamer, from
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-init.html into a file called eg41.c
and used the terminal command gcc eg41.c -I/Library/Frameworks/GStreamer.framework/Headers
. The output was:
Undefined symbols for architecture x86_64:
"_gst_init", referenced from: _main in eg41-9814a5.o
"_gst_version", referenced from: _main in eg41-9814a5.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any ideas?

Reachability Errors

Undefined symbols for architecture i386:
"_OBJC_CLASS_$_Reachability", referenced from:
objc-class-ref in FirstViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've looked over FirstViewController, reachability.h and reachability.m - It's clearly defined! And I've even added SystemConfiguration.Framework, as well as Reachability.m is in the compile list.
Any ideas? I'm losing my mind!
Pic attached.
http://i.imgur.com/uw4Zb.png
Try to remove references to Reachability.h and Reachability.m files from your xCode project. - Make sure it disappears from Compile Sources.
Search you project's folder to make sure you don't have duplicates for Reachability.h and Reachability.m files in it
Command+Shift+K to clean the project;
Add Reachability.h and Reachability.m back to the xCode project;
Hope this will help.

problems with apples vDSP examples

I'm having problems with apples examples for vDSP. I tried all of them but i need the convolution sample in the end.
I can't even get it through the linker:
Undefined symbols for architecture i386:
"_conv", referenced from:
_ConvTiming in main.o
ld: symbol(s) not found for architecture i386
Is the error message (no matter what architecture i build for or).
You need to include the Accelerate framework in the build.

Apple Mach-O Link (Id) Error

My code is identical to this question I asked earlier so there's no point in duplicating it here
This is the error I am getting:
Undefined symbols for architecture x86_64:
"_stdscr", referenced from:
_screen_init in screen.o
"_werase", referenced from:
_screen_init in screen.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've had this error in the past and I feel like it has something to do with a duplicate function name or something, but I have no idea how to debug this.
EDIT:
After adding the libncurses.dylib file to my project, the errors discussed above have disappeared, but a new error has emerged when I call screen_init(); in my main.cpp:
// main.cpp
#include "screen.h"
int main(){
screen_init();
}
// new error
Undefined symbols for architecture x86_64:
"screen_init()", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Pretty much the same error except now in my main. Is there another library I am missing? These errors are very mysterious and not very helpful.
I guess you need to add the library to your link phase, if you are going with XCode you should add it in project details:
choose project details
choose build phases tab
open link binary with libraries part
click the plus symbol
add libncurses.dylib to your project.

Categories

Resources