problems with apples vDSP examples - c

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.

Related

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

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.

GNU Archimedes fails to build -- Undefined symbols for architecture, even though they are present

I'm rather unused to C, and completely new to compiling bigger projects, and I'm having problems trying to build GNU Archimedes.
I tried the ./configure and make approach, as well as simply executing gcc -lm archimedes.c -o archimedes in the src/ directory, as the documentation suggests. Both give a similar error message:
Undefined symbols for architecture x86_64:
"_MM2", referenced from:
_ParabMEP2D in ccwORAXj.o
_Hole_MEP2D in ccwORAXj.o
"_creation", referenced from:
_EMC in ccwORAXj.o
"_rnd", referenced from:
_MCdevice_config in ccwORAXj.o
_scat in ccwORAXj.o
_EMC in ccwORAXj.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
MM2, rnd, and creation are functions contained in one of many .h files in src/. Every solution to similar sounding problems had issues linking multiple compiled .c files together, but in this case, there's only one .c file.
If it's relevant, the name of the .o file in the error changes with every try.
I've tried building it under macOS (with both clang and gcc, the latter installed via Homebrew) and Fedora Linux, with similar results.
What am I doing wrong? I hope this is the right place to ask, but I have no idea where else to turn. I'm grateful for suggestions.
Thanks in advance and have a good day!
In the folder /archimedes-2.0.1/src/ go through all header files (.h) and change every "inline" to say "static inline".
This fix was found by Alexander Vogt. His original post is linked to below:
https://lists.gnu.org/archive/html/archimedes-discuss/2017-11/msg00000.html
The problem has to do with compatibility issues between older and newer versions of c compilers.

MATLAB Generated C Code Compilation Error

I have a MATLAB function that has signal processing and machine learning and I wanted to test it on another OS like linux. So I use codegen to generate C code for that function. When I come to run it (predictActivityFromSignalBuffer) on the command line, this is what I get:
MacBook-Pro-2:predictActivityFromSignalBuffer kareem$ gcc predictActivityFromSignalBuffer.c
Undefined symbols for architecture x86_64:
"_featuresFromBuffer", referenced from:
_predictActivityFromSignalBuffer in predictActivityFromSignalBuffer-1a1886.o
"_main", referenced from:
implicit entry/start for main executable
"_mynn", referenced from:
_predictActivityFromSignalBuffer in predictActivityFromSignalBuffer-1a1886.o
"_rtIsNaN", referenced from:
_predictActivityFromSignalBuffer in predictActivityFromSignalBuffer-1a1886.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What is this error telling me exactly? I have no idea how to debug this or where to start/look.
Did you really just call
$ gcc predictActivityFromSignalBuffer.c
without any other dependencies? Usually there come a lot of other files with a code generation that have to be linked.
I do not know what you have done to produce your .c file. I recommend to use the coder wizard by typing
coder
in the Matlab command window. This will guide you through the whole process of code generation and also offers a lot of support and testing possibilities. You can also choose to compile your functions to ready-to-use DLL libraries or executatables. Just have a look at it.

vorbis and vorbisenc libraries not found

I need to retrieve vorbis and vorbisenc libraries to compile a C program. I tried to download vorbis lib sources in http://xiph.org/downloads/ but each time, there are problems for compiling this lib. Do you know where I can download these lib (.h and .so ) ?
I work on MacOSX.
Thanks
EDIT :
Finally, I succeed to install the library by downloading an older version. But now, I encounter another problem in compiling my program with this library :
ld: warning: ignoring file /usr/local/lib/libFLAC.dylib, missing required architecture x86_64 in file /usr/local/lib/libFLAC.dylib (2 slices)
Undefined symbols for architecture x86_64:
"_sf_close", referenced from:
_main in ccucQ4qH.o
"_sf_open", referenced from:
_main in ccucQ4qH.o
"_sf_readf_double", referenced from:
_read_n_samples in ccucQ4qH.o
"_sf_strerror", referenced from:
_main in ccucQ4qH.o
ld: symbol(s) not found for architecture x86_64

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.

Resources