OpenCL compilation issue - c

I am new to Opencl Programming. I have written a matrix multiplication program while compiling it is giving me error
My include files are:
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
#include <CL/cl.h>
#include <stdbool.h>
But I got an error as:
/usr/bin/ld: /tmp/ccxNPkyU.o: in function `main':
gmm.c:(.text+0x2d3): undefined reference to `clGetPlatformIDs'
/usr/bin/ld: gmm.c:(.text+0x2ef): undefined reference to `clGetPlatformIDs'
/usr/bin/ld: gmm.c:(.text+0x322): undefined reference to `clGetDeviceIDs'
/usr/bin/ld: gmm.c:(.text+0x376): undefined reference to `clCreateContext'
/usr/bin/ld: gmm.c:(.text+0x527): undefined reference to `clCreateCommandQueue'
/usr/bin/ld: gmm.c:(.text+0x5ab): undefined reference to `clCreateProgramWithSource'
/usr/bin/ld: gmm.c:(.text+0x5fc): undefined reference to `clBuildProgram'
/usr/bin/ld: gmm.c:(.text+0x64c): undefined reference to `clGetProgramBuildInfo'
/usr/bin/ld: gmm.c:(.text+0x682): undefined reference to `clCreateKernel'
/usr/bin/ld: gmm.c:(.text+0x6dc): undefined reference to `clCreateBuffer'
/usr/bin/ld: gmm.c:(.text+0x70c): undefined reference to `clCreateBuffer'
/usr/bin/ld: gmm.c:(.text+0x73c): undefined reference to `clCreateBuffer'
/usr/bin/ld: gmm.c:(.text+0x76e): undefined reference to `clCreateBuffer'
/usr/bin/ld: gmm.c:(.text+0x7a0): undefined reference to `clCreateBuffer'
/usr/bin/ld: /tmp/ccxNPkyU.o:gmm.c:(.text+0x7d2): more undefined references to `clCreateBuffer' follow
/usr/bin/ld: /tmp/ccxNPkyU.o: in function `main':
gmm.c:(.text+0x84c): undefined reference to `clSetKernelArg'
/usr/bin/ld: gmm.c:(.text+0x875): undefined reference to `clSetKernelArg'
/usr/bin/ld: gmm.c:(.text+0x89e): undefined reference to `clSetKernelArg'
/usr/bin/ld: gmm.c:(.text+0x8c7): undefined reference to `clSetKernelArg'
/usr/bin/ld: gmm.c:(.text+0x8f8): undefined reference to `clSetKernelArg'
/usr/bin/ld: /tmp/ccxNPkyU.o:gmm.c:(.text+0x929): more undefined references to `clSetKernelArg' follow
/usr/bin/ld: /tmp/ccxNPkyU.o: in function `main':
gmm.c:(.text+0xa58): undefined reference to `clEnqueueReadBuffer'
/usr/bin/ld: gmm.c:(.text+0xa9f): undefined reference to `clEnqueueReadBuffer'
/usr/bin/ld: gmm.c:(.text+0xae6): undefined reference to `clEnqueueReadBuffer'
/usr/bin/ld: gmm.c:(.text+0xb04): undefined reference to `clWaitForEvents'
/usr/bin/ld: gmm.c:(.text+0xb13): undefined reference to `clFinish'
/usr/bin/ld: gmm.c:(.text+0xb3c): undefined reference to `clGetEventProfilingInfo'
/usr/bin/ld: gmm.c:(.text+0xb65): undefined reference to `clGetEventProfilingInfo'
/usr/bin/ld: gmm.c:(.text+0xc9f): undefined reference to `clReleaseMemObject'
/usr/bin/ld: gmm.c:(.text+0xcae): undefined reference to `clReleaseMemObject'
/usr/bin/ld: gmm.c:(.text+0xcbd): undefined reference to `clReleaseMemObject'
/usr/bin/ld: gmm.c:(.text+0xccc): undefined reference to `clReleaseMemObject'
/usr/bin/ld: gmm.c:(.text+0xcdb): undefined reference to `clReleaseMemObject'
/usr/bin/ld: /tmp/ccxNPkyU.o:gmm.c:(.text+0xcea): more undefined references to `clReleaseMemObject' follow
collect2: error: ld returned 1 exit status
I am compiling program by this statement:gcc -o gmmc gmm.c. Can anyone help me

Link your program with the OpenCL library:
gcc -O2 -Wall -o gmmc gmmc.c -lOpenCL
If this doesn't find the library, you need to pass the path to it:
gcc -O2 -Wall -o gmmc gmmc.c -L/insert/path/here -lOpenCL
where /insert/path/here is the directory that contains libOpenCL.so. You can search a directory for it, e.g.
find /usr/lib -name libOpenCL.so

Related

Why so many undefined references coming [duplicate]

This question already has answers here:
Undefined reference to sqrt (or other mathematical functions)
(5 answers)
Closed 5 months ago.
I am trying to call a C function (statslib statistical library) from vala file. My main.vala file is as follows:
extern double sum(double[] doublelist, int len);
public static void main(string[] args){
double[] numlist = {1.1,2.2,3.3,4.4,5.5};
var total = sum(numlist, numlist.length);
stdout.printf("The sum is %f \n", total);
However, on trying to compile with C file, I get following error:
$ valac main.vala statlib.c
/usr/bin/ld: /tmp/ccjchX8B.o: in function `g_mean':
statlib.c:(.text+0x35a): undefined reference to `log'
/usr/bin/ld: statlib.c:(.text+0x399): undefined reference to `exp'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `agm':
statlib.c:(.text+0x6db): undefined reference to `sqrt'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `s_stdev':
statlib.c:(.text+0xb8a): undefined reference to `sqrt'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `p_stdev':
statlib.c:(.text+0xbc5): undefined reference to `sqrt'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `central_moment':
statlib.c:(.text+0xd47): undefined reference to `pow'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `std_err_mean':
statlib.c:(.text+0xdbd): undefined reference to `sqrt'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `rms':
statlib.c:(.text+0xe6a): undefined reference to `sqrt'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `percentile':
statlib.c:(.text+0xfa7): undefined reference to `floor'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `skewness1':
statlib.c:(.text+0x12bc): undefined reference to `pow'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `skewness2':
statlib.c:(.text+0x1379): undefined reference to `pow'
/usr/bin/ld: statlib.c:(.text+0x13c9): undefined reference to `pow'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `kurtosis1':
statlib.c:(.text+0x152b): undefined reference to `pow'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `kurtosis2':
statlib.c:(.text+0x1656): undefined reference to `pow'
/usr/bin/ld: /tmp/ccjchX8B.o:statlib.c:(.text+0x16a6): more undefined references to `pow' follow
/usr/bin/ld: /tmp/ccjchX8B.o: in function `corr_coeff':
statlib.c:(.text+0x18fe): undefined reference to `sqrt'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `stdev_points':
statlib.c:(.text+0x1c82): undefined reference to `sqrt'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `stderr_reg_coeff':
statlib.c:(.text+0x1d8b): undefined reference to `sqrt'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `fisher':
statlib.c:(.text+0x1f38): undefined reference to `log'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `binom_prob':
statlib.c:(.text+0x20ba): undefined reference to `pow'
/usr/bin/ld: statlib.c:(.text+0x20ed): undefined reference to `pow'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `stdx_lg':
statlib.c:(.text+0x2178): undefined reference to `sqrt'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `norm_pdf':
statlib.c:(.text+0x221e): undefined reference to `exp'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `std_ncurve_area':
statlib.c:(.text+0x22ff): undefined reference to `exp'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `anderson_darling_norm':
statlib.c:(.text+0x278e): undefined reference to `log'
/usr/bin/ld: statlib.c:(.text+0x27f7): undefined reference to `log'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `rndz':
statlib.c:(.text+0x2979): undefined reference to `sqrt'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `log_norm_pdf':
statlib.c:(.text+0x29fc): undefined reference to `log'
/usr/bin/ld: statlib.c:(.text+0x2a1e): undefined reference to `log'
/usr/bin/ld: statlib.c:(.text+0x2a6e): undefined reference to `exp'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `gamma':
statlib.c:(.text+0x2b49): undefined reference to `pow'
/usr/bin/ld: statlib.c:(.text+0x2be1): undefined reference to `pow'
/usr/bin/ld: statlib.c:(.text+0x2c16): undefined reference to `exp'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `log_gamma':
statlib.c:(.text+0x2d0e): undefined reference to `log'
/usr/bin/ld: statlib.c:(.text+0x2d2d): undefined reference to `log'
/usr/bin/ld: statlib.c:(.text+0x2d64): undefined reference to `log'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `std_betapdf':
statlib.c:(.text+0x2e51): undefined reference to `pow'
/usr/bin/ld: statlib.c:(.text+0x2e8f): undefined reference to `pow'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `betapdf':
statlib.c:(.text+0x2faa): undefined reference to `pow'
/usr/bin/ld: statlib.c:(.text+0x2ff3): undefined reference to `pow'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `beta_curve_area':
statlib.c:(.text+0x311d): undefined reference to `pow'
/usr/bin/ld: /tmp/ccjchX8B.o:statlib.c:(.text+0x3166): more undefined references to `pow' follow
/usr/bin/ld: /tmp/ccjchX8B.o: in function `tdist':
statlib.c:(.text+0x324d): undefined reference to `sqrt'
/usr/bin/ld: statlib.c:(.text+0x32ed): undefined reference to `pow'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `t_test2':
statlib.c:(.text+0x348e): undefined reference to `sqrt'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `t_test1':
statlib.c:(.text+0x3512): undefined reference to `sqrt'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `confidence_95':
statlib.c:(.text+0x3600): undefined reference to `sqrt'
/usr/bin/ld: statlib.c:(.text+0x363e): undefined reference to `sqrt'
/usr/bin/ld: /tmp/ccjchX8B.o: in function `confidence_99':
statlib.c:(.text+0x3704): undefined reference to `sqrt'
/usr/bin/ld: /tmp/ccjchX8B.o:statlib.c:(.text+0x3742): more undefined references to `sqrt' follow
/usr/bin/ld: /tmp/ccjchX8B.o: in function `root':
statlib.c:(.text+0x37fc): undefined reference to `log'
/usr/bin/ld: statlib.c:(.text+0x3822): undefined reference to `exp'
collect2: error: ld returned 1 exit status
error: cc exited with status 256
Compilation failed: 1 error(s), 0 warning(s)
If I remove all functions (except sum) from statlib.c file, the command works perfectly and creates an executable file.
How can I avoid getting above errors without changing statlib.c file?
You need to tell the compiler that you want to link math library
Add -lm to your command line
https://godbolt.org/z/dPn9b7rrs

gcc undefined reference to header of multiple files

I have a sample code temp.c:
#include "win.h"
win.h is in /home/me/Documents/Code/libs/TUI/win.h and has all the declared functions
which functions are defined in some files in /home/me/Documents/Code/libs/TUI/win/[lots of files].c which every file starts with
#include "../win.h"
//functions
So while using gcc -I /home/me/Documents/Code/libs/TUI /home/me/Documents/Code/temp.c -o /home/me/Documents/Code/temp, gcc returns every function used in temp.c declared in win.h as undefined
Exact output:
gcc -g -I/home/me/Documents/Code/libs/TUI /home/me/Documents/Code/temp.c -o /home/pk/Documents/Code/temp
/usr/bin/ld: /tmp/cc4berEn.o: in function `main':
/home/me/Documents/Code/temp.c:8: undefined reference to `innit'
/usr/bin/ld: /home/me/Documents/Code/temp.c:11: undefined reference to `newTable'
/usr/bin/ld: /home/me/Documents/Code/temp.c:13: undefined reference to `tableSetHeaders'
/usr/bin/ld: /home/me/Documents/Code/temp.c:35: undefined reference to `tableAppendRow'
/usr/bin/ld: /home/me/Documents/Code/temp.c:45: undefined reference to `printTable'
collect2: error: ld returned 1 exit status
notes
Using -I /home/me/Documents/Code/libs/TUI/win.h returns fatal error: win.h: No such file or directory 3 | #include "win.h"
/home/me/Documents/Code/libs/TUI is a folder
Writing every source file's name is not an option
Already tried this
-g for debug

Failed to link with TensorFlow Lite C API static library? undefined reference to tflite::DefaultErrorReporter()

I've built the TensorFlow Lite static library, the C API version. Cloned the sources and called CMake:
cmake -S ../tensorflow_src/tensorflow/lite/c -DTFLITE_C_BUILD_SHARED_LIBS:BOOL=OFF
cmake --build . -j
This built the libtensorflowlite_c.a. I also linked all other .a sub-dependencies into a single tensorflowdep.a library (this includes absl, clog and all other transient dependencies listed here in the TensorFlow CMake file).
I tried to test the lib using a minimal example:
#include <stdio.h>
#include "tensorflow/lite/c/c_api.h"
int main(void) {
printf("Hello!");
const char *version = TfLiteVersion();
printf("Hello from TensorFlow Lite C API library version = %s\n", version);
return 0;
}
gcc -L"/home/joedoe/out/subprojects/tensorflow" -o "MAIN" ./src/MAIN.o -ltensorflowlite_c -ltensorflowdep
But this fails:
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `TfLiteModelCreate':
c_api.cc:(.text+0x210): undefined reference to `tflite::DefaultErrorReporter()'
/usr/bin/ld: c_api.cc:(.text+0x22f): undefined reference to `tflite::FlatBufferModel::VerifyAndBuildFromBuffer(char const*, unsigned long, tflite::TfLiteVerifier*, tflite::ErrorReporter*)'
/usr/bin/ld: c_api.cc:(.text+0x276): undefined reference to `operator new(unsigned long)'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `TfLiteModelCreateFromFile':
c_api.cc:(.text+0x322): undefined reference to `tflite::DefaultErrorReporter()'
/usr/bin/ld: c_api.cc:(.text+0x33d): undefined reference to `tflite::FlatBufferModel::VerifyAndBuildFromFile(char const*, tflite::TfLiteVerifier*, tflite::ErrorReporter*)'
/usr/bin/ld: c_api.cc:(.text+0x384): undefined reference to `operator new(unsigned long)'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `TfLiteModelDelete':
c_api.cc:(.text+0x433): undefined reference to `operator delete(void*)'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `TfLiteInterpreterOptionsCreate':
c_api.cc:(.text+0x452): undefined reference to `operator new(unsigned long)'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `TfLiteInterpreterOptionsDelete':
c_api.cc:(.text+0x4a7): undefined reference to `operator delete(void*)'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `TfLiteInterpreterCreate':
c_api.cc:(.text+0x560): undefined reference to `tflite::CreateOpResolver()'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `TfLiteInterpreterDelete':
c_api.cc:(.text+0x5fa): undefined reference to `operator delete(void*)'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `TfLiteInterpreterResizeInputTensor':
c_api.cc:(.text+0x75a): undefined reference to `tflite::Interpreter::ResizeInputTensor(int, std::vector<int, std::allocator<int> > const&)'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `TfLiteInterpreterAllocateTensors':
c_api.cc:(.text+0x7ee): undefined reference to `tflite::Interpreter::AllocateTensors()'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `TfLiteInterpreterInvoke':
c_api.cc:(.text+0x824): undefined reference to `tflite::delegates::InterpreterUtils::InvokeWithCPUFallback(tflite::Interpreter*)'
/usr/bin/ld: c_api.cc:(.text+0x83e): undefined reference to `tflite::Interpreter::Invoke()'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `tflite::internal::InterpreterCreateWithOpResolver(TfLiteModel const*, TfLiteInterpreterOptions const*, tflite::MutableOpResolver*)':
c_api.cc:(.text+0xaf5): undefined reference to `operator new(unsigned long)'
/usr/bin/ld: c_api.cc:(.text+0xb5b): undefined reference to `tflite::MutableOpResolver::AddAll(tflite::MutableOpResolver const&)'
/usr/bin/ld: c_api.cc:(.text+0xbf1): undefined reference to `tflite::DefaultErrorReporter()'
/usr/bin/ld: c_api.cc:(.text+0xc2f): undefined reference to `tflite::InterpreterBuilder::InterpreterBuilder(tflite::Model const*, tflite::OpResolver const&, tflite::ErrorReporter*)'
/usr/bin/ld: c_api.cc:(.text+0xc53): undefined reference to `tflite::InterpreterBuilder::operator()(std::unique_ptr<tflite::Interpreter, std::default_delete<tflite::Interpreter> >*)'
/usr/bin/ld: c_api.cc:(.text+0xca7): undefined reference to `tflite::Interpreter::SetNumThreads(int)'
/usr/bin/ld: c_api.cc:(.text+0xcd0): undefined reference to `tflite::NnApiDelegate()'
/usr/bin/ld: c_api.cc:(.text+0xcdb): undefined reference to `tflite::Interpreter::ModifyGraphWithDelegate(TfLiteDelegate*)'
/usr/bin/ld: c_api.cc:(.text+0xd88): undefined reference to `tflite::Interpreter::ModifyGraphWithDelegate(TfLiteDelegate*)'
/usr/bin/ld: c_api.cc:(.text+0xe08): undefined reference to `operator new(unsigned long)'
/usr/bin/ld: c_api.cc:(.text+0xe67): undefined reference to `tflite::InterpreterBuilder::~InterpreterBuilder()'
/usr/bin/ld: c_api.cc:(.text+0xebe): undefined reference to `tflite::InterpreterBuilder::~InterpreterBuilder()'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `(anonymous namespace)::CallbackOpResolver::~CallbackOpResolver()':
c_api.cc:(.text+0xf62): undefined reference to `operator delete(void*)'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `(anonymous namespace)::CallbackErrorReporter::~CallbackErrorReporter()':
c_api.cc:(.text+0xfba): undefined reference to `operator delete(void*)'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o):(.data.rel.ro+0x8): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o):(.data.rel.ro+0x20): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `tflite::ErrorReporter::~ErrorReporter()':
c_api.cc:(.text._ZN6tflite13ErrorReporterD0Ev[_ZN6tflite13ErrorReporterD5Ev]+0x24): undefined reference to `operator delete(void*)'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `tflite::OpResolver::~OpResolver()':
c_api.cc:(.text._ZN6tflite10OpResolverD0Ev[_ZN6tflite10OpResolverD5Ev]+0x24): undefined reference to `operator delete(void*)'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `tflite::MutableOpResolver::MutableOpResolver()':
c_api.cc:(.text._ZN6tflite17MutableOpResolverC2Ev[_ZN6tflite17MutableOpResolverC5Ev]+0x1f): undefined reference to `vtable for tflite::MutableOpResolver'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `std::default_delete<tflite::FlatBufferModel>::operator()(tflite::FlatBufferModel*) const':
c_api.cc:(.text._ZNKSt14default_deleteIN6tflite15FlatBufferModelEEclEPS1_[_ZNKSt14default_deleteIN6tflite15FlatBufferModelEEclEPS1_]+0x22): undefined reference to `tflite::FlatBufferModel::~FlatBufferModel()'
/usr/bin/ld: c_api.cc:(.text._ZNKSt14default_deleteIN6tflite15FlatBufferModelEEclEPS1_[_ZNKSt14default_deleteIN6tflite15FlatBufferModelEEclEPS1_]+0x2a): undefined reference to `operator delete(void*)'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `void std::vector<TfLiteDelegate*, std::allocator<TfLiteDelegate*> >::_M_realloc_insert<TfLiteDelegate* const&>(__gnu_cxx::__normal_iterator<TfLiteDelegate**, std::vector<TfLiteDelegate*, std::allocator<TfLiteDelegate*> > >, TfLiteDelegate* const&)':
c_api.cc:(.text._ZNSt6vectorIP14TfLiteDelegateSaIS1_EE17_M_realloc_insertIJRKS1_EEEvN9__gnu_cxx17__normal_iteratorIPS1_S3_EEDpOT_[_ZNSt6vectorIP14TfLiteDelegateSaIS1_EE17_M_realloc_insertIJRKS1_EEEvN9__gnu_cxx17__normal_iteratorIPS1_S3_EEDpOT_]+0x267): undefined reference to `__cxa_begin_catch'
/usr/bin/ld: c_api.cc:(.text._ZNSt6vectorIP14TfLiteDelegateSaIS1_EE17_M_realloc_insertIJRKS1_EEEvN9__gnu_cxx17__normal_iteratorIPS1_S3_EEDpOT_[_ZNSt6vectorIP14TfLiteDelegateSaIS1_EE17_M_realloc_insertIJRKS1_EEEvN9__gnu_cxx17__normal_iteratorIPS1_S3_EEDpOT_]+0x2d0): undefined reference to `__cxa_rethrow'
/usr/bin/ld: c_api.cc:(.text._ZNSt6vectorIP14TfLiteDelegateSaIS1_EE17_M_realloc_insertIJRKS1_EEEvN9__gnu_cxx17__normal_iteratorIPS1_S3_EEDpOT_[_ZNSt6vectorIP14TfLiteDelegateSaIS1_EE17_M_realloc_insertIJRKS1_EEEvN9__gnu_cxx17__normal_iteratorIPS1_S3_EEDpOT_]+0x2dc): undefined reference to `__cxa_end_catch'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `tflite::MutableOpResolver::~MutableOpResolver()':
c_api.cc:(.text._ZN6tflite17MutableOpResolverD2Ev[_ZN6tflite17MutableOpResolverD5Ev]+0x13): undefined reference to `vtable for tflite::MutableOpResolver'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `tflite::MutableOpResolver::~MutableOpResolver()':
c_api.cc:(.text._ZN6tflite17MutableOpResolverD0Ev[_ZN6tflite17MutableOpResolverD5Ev]+0x24): undefined reference to `operator delete(void*)'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `std::default_delete<tflite::Interpreter>::operator()(tflite::Interpreter*) const':
c_api.cc:(.text._ZNKSt14default_deleteIN6tflite11InterpreterEEclEPS1_[_ZNKSt14default_deleteIN6tflite11InterpreterEEclEPS1_]+0x22): undefined reference to `tflite::Interpreter::~Interpreter()'
/usr/bin/ld: c_api.cc:(.text._ZNKSt14default_deleteIN6tflite11InterpreterEEclEPS1_[_ZNKSt14default_deleteIN6tflite11InterpreterEEclEPS1_]+0x2a): undefined reference to `operator delete(void*)'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `std::vector<TfLiteDelegate*, std::allocator<TfLiteDelegate*> >::_M_check_len(unsigned long, char const*) const':
c_api.cc:(.text._ZNKSt6vectorIP14TfLiteDelegateSaIS1_EE12_M_check_lenEmPKc[_ZNKSt6vectorIP14TfLiteDelegateSaIS1_EE12_M_check_lenEmPKc]+0x5f): undefined reference to `std::__throw_length_error(char const*)'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `std::vector<int, std::allocator<int> >::_S_check_init_len(unsigned long, std::allocator<int> const&)':
c_api.cc:(.text._ZNSt6vectorIiSaIiEE17_S_check_init_lenEmRKS0_[_ZNSt6vectorIiSaIiEE17_S_check_init_lenEmRKS0_]+0x62): undefined reference to `std::__throw_length_error(char const*)'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `__gnu_cxx::new_allocator<int>::deallocate(int*, unsigned long)':
c_api.cc:(.text._ZN9__gnu_cxx13new_allocatorIiE10deallocateEPim[_ZN9__gnu_cxx13new_allocatorIiE10deallocateEPim]+0x20): undefined reference to `operator delete(void*)'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `__gnu_cxx::new_allocator<std::function<std::unique_ptr<TfLiteDelegate, void (*)(TfLiteDelegate*)> (int)> >::deallocate(std::function<std::unique_ptr<TfLiteDelegate, void (*)(TfLiteDelegate*)> (int)>*, unsigned long)':
c_api.cc:(.text._ZN9__gnu_cxx13new_allocatorISt8functionIFSt10unique_ptrI14TfLiteDelegatePFvPS3_EEiEEE10deallocateEPS9_m[_ZN9__gnu_cxx13new_allocatorISt8functionIFSt10unique_ptrI14TfLiteDelegatePFvPS3_EEiEEE10deallocateEPS9_m]+0x20): undefined reference to `operator delete(void*)'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<tflite::FlatBufferModel*>(tflite::FlatBufferModel*)':
c_api.cc:(.text._ZNSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EEC2IPN6tflite15FlatBufferModelEEET_[_ZNSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EEC5IPN6tflite15FlatBufferModelEEET_]+0x26): undefined reference to `operator new(unsigned long)'
/usr/bin/ld: c_api.cc:(.text._ZNSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EEC2IPN6tflite15FlatBufferModelEEET_[_ZNSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EEC5IPN6tflite15FlatBufferModelEEET_]+0x4d): undefined reference to `__cxa_begin_catch'
/usr/bin/ld: c_api.cc:(.text._ZNSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EEC2IPN6tflite15FlatBufferModelEEET_[_ZNSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EEC5IPN6tflite15FlatBufferModelEEET_]+0x5e): undefined reference to `tflite::FlatBufferModel::~FlatBufferModel()'
/usr/bin/ld: c_api.cc:(.text._ZNSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EEC2IPN6tflite15FlatBufferModelEEET_[_ZNSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EEC5IPN6tflite15FlatBufferModelEEET_]+0x66): undefined reference to `operator delete(void*)'
/usr/bin/ld: c_api.cc:(.text._ZNSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EEC2IPN6tflite15FlatBufferModelEEET_[_ZNSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EEC5IPN6tflite15FlatBufferModelEEET_]+0x6b): undefined reference to `__cxa_rethrow'
/usr/bin/ld: c_api.cc:(.text._ZNSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EEC2IPN6tflite15FlatBufferModelEEET_[_ZNSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EEC5IPN6tflite15FlatBufferModelEEET_]+0x77): undefined reference to `__cxa_end_catch'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::~_Sp_counted_base()':
c_api.cc:(.text._ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EED0Ev[_ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EED5Ev]+0x24): undefined reference to `operator delete(void*)'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `__gnu_cxx::new_allocator<tflite::OpResolver const*>::deallocate(tflite::OpResolver const**, unsigned long)':
c_api.cc:(.text._ZN9__gnu_cxx13new_allocatorIPKN6tflite10OpResolverEE10deallocateEPS4_m[_ZN9__gnu_cxx13new_allocatorIPKN6tflite10OpResolverEE10deallocateEPS4_m]+0x20): undefined reference to `operator delete(void*)'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `__gnu_cxx::new_allocator<TfLiteDelegate*>::deallocate(TfLiteDelegate**, unsigned long)':
c_api.cc:(.text._ZN9__gnu_cxx13new_allocatorIP14TfLiteDelegateE10deallocateEPS2_m[_ZN9__gnu_cxx13new_allocatorIP14TfLiteDelegateE10deallocateEPS2_m]+0x20): undefined reference to `operator delete(void*)'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `__gnu_cxx::new_allocator<int>::allocate(unsigned long, void const*)':
c_api.cc:(.text._ZN9__gnu_cxx13new_allocatorIiE8allocateEmPKv[_ZN9__gnu_cxx13new_allocatorIiE8allocateEmPKv]+0x30): undefined reference to `std::__throw_bad_alloc()'
/usr/bin/ld: c_api.cc:(.text._ZN9__gnu_cxx13new_allocatorIiE8allocateEmPKv[_ZN9__gnu_cxx13new_allocatorIiE8allocateEmPKv]+0x40): undefined reference to `operator new(unsigned long)'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `__gnu_cxx::new_allocator<TfLiteDelegate*>::allocate(unsigned long, void const*)':
c_api.cc:(.text._ZN9__gnu_cxx13new_allocatorIP14TfLiteDelegateE8allocateEmPKv[_ZN9__gnu_cxx13new_allocatorIP14TfLiteDelegateE8allocateEmPKv]+0x30): undefined reference to `std::__throw_bad_alloc()'
/usr/bin/ld: c_api.cc:(.text._ZN9__gnu_cxx13new_allocatorIP14TfLiteDelegateE8allocateEmPKv[_ZN9__gnu_cxx13new_allocatorIP14TfLiteDelegateE8allocateEmPKv]+0x40): undefined reference to `operator new(unsigned long)'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `__gnu_cxx::new_allocator<std::__detail::_Hash_node_base*>::deallocate(std::__detail::_Hash_node_base**, unsigned long)':
c_api.cc:(.text._ZN9__gnu_cxx13new_allocatorIPNSt8__detail15_Hash_node_baseEE10deallocateEPS3_m[_ZN9__gnu_cxx13new_allocatorIPNSt8__detail15_Hash_node_baseEE10deallocateEPS3_m]+0x20): undefined reference to `operator delete(void*)'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int>::~pair()':
c_api.cc:(.text._ZNSt4pairINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiED2Ev[_ZNSt4pairINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiED5Ev]+0x18): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `__gnu_cxx::new_allocator<std::__detail::_Hash_node<std::pair<std::pair<tflite::BuiltinOperator, int> const, TfLiteRegistration>, true> >::deallocate(std::__detail::_Hash_node<std::pair<std::pair<tflite::BuiltinOperator, int> const, TfLiteRegistration>, true>*, unsigned long)':
c_api.cc:(.text._ZN9__gnu_cxx13new_allocatorINSt8__detail10_Hash_nodeISt4pairIKS3_IN6tflite15BuiltinOperatorEiE18TfLiteRegistrationELb1EEEE10deallocateEPSA_m[_ZN9__gnu_cxx13new_allocatorINSt8__detail10_Hash_nodeISt4pairIKS3_IN6tflite15BuiltinOperatorEiE18TfLiteRegistrationELb1EEEE10deallocateEPSA_m]+0x20): undefined reference to `operator delete(void*)'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `__gnu_cxx::new_allocator<std::__detail::_Hash_node<std::pair<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int> const, TfLiteRegistration>, true> >::deallocate(std::__detail::_Hash_node<std::pair<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int> const, TfLiteRegistration>, true>*, unsigned long)':
c_api.cc:(.text._ZN9__gnu_cxx13new_allocatorINSt8__detail10_Hash_nodeISt4pairIKS3_INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiE18TfLiteRegistrationELb1EEEE10deallocateEPSE_m[_ZN9__gnu_cxx13new_allocatorINSt8__detail10_Hash_nodeISt4pairIKS3_INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiE18TfLiteRegistrationELb1EEEE10deallocateEPSE_m]+0x20): undefined reference to `operator delete(void*)'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `std::_Sp_counted_ptr<tflite::FlatBufferModel*, (__gnu_cxx::_Lock_policy)2>::~_Sp_counted_ptr()':
c_api.cc:(.text._ZNSt15_Sp_counted_ptrIPN6tflite15FlatBufferModelELN9__gnu_cxx12_Lock_policyE2EED0Ev[_ZNSt15_Sp_counted_ptrIPN6tflite15FlatBufferModelELN9__gnu_cxx12_Lock_policyE2EED5Ev]+0x24): undefined reference to `operator delete(void*)'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o):(.data.rel.ro._ZTVN6tflite10OpResolverE[_ZTVN6tflite10OpResolverE]+0x10): undefined reference to `__cxa_pure_virtual'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o):(.data.rel.ro._ZTVN6tflite10OpResolverE[_ZTVN6tflite10OpResolverE]+0x18): undefined reference to `__cxa_pure_virtual'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o):(.data.rel.ro._ZTVN6tflite13ErrorReporterE[_ZTVN6tflite13ErrorReporterE]+0x20): undefined reference to `__cxa_pure_virtual'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o):(.data.rel.ro._ZTVSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE[_ZTVSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE]+0x20): undefined reference to `__cxa_pure_virtual'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o):(.data.rel.ro._ZTVSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE[_ZTVSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE]+0x30): undefined reference to `__cxa_pure_virtual'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o):(.data.rel.ro._ZTISt15_Sp_counted_ptrIPN6tflite15FlatBufferModelELN9__gnu_cxx12_Lock_policyE2EE[_ZTISt15_Sp_counted_ptrIPN6tflite15FlatBufferModelELN9__gnu_cxx12_Lock_policyE2EE]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o):(.data.rel.ro._ZTIN6tflite10OpResolverE[_ZTIN6tflite10OpResolverE]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o):(.data.rel.ro._ZTIN6tflite13ErrorReporterE[_ZTIN6tflite13ErrorReporterE]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o):(.data.rel.ro._ZTISt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE[_ZTISt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o): in function `std::_Sp_counted_ptr<tflite::FlatBufferModel*, (__gnu_cxx::_Lock_policy)2>::_M_dispose()':
c_api.cc:(.text._ZNSt15_Sp_counted_ptrIPN6tflite15FlatBufferModelELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv[_ZNSt15_Sp_counted_ptrIPN6tflite15FlatBufferModelELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv]+0x22): undefined reference to `tflite::FlatBufferModel::~FlatBufferModel()'
/usr/bin/ld: c_api.cc:(.text._ZNSt15_Sp_counted_ptrIPN6tflite15FlatBufferModelELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv[_ZNSt15_Sp_counted_ptrIPN6tflite15FlatBufferModelELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv]+0x2a): undefined reference to `operator delete(void*)'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o):(.data.rel.ro._ZTISt11_Mutex_baseILN9__gnu_cxx12_Lock_policyE2EE[_ZTISt11_Mutex_baseILN9__gnu_cxx12_Lock_policyE2EE]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
/usr/bin/ld: /home/joedoe/out/subprojects/tensorflow/libtensorflowlite_c.a(c_api.cc.o):(.data.rel.local.DW.ref.__gxx_personality_v0[DW.ref.__gxx_personality_v0]+0x0): undefined reference to `__gxx_personality_v0'
collect2: error: ld returned 1 exit status
make: *** [makefile:45: TF] Error 1
What could be the problem?

Problem while running the example program from CFITSIO Quick Start Guide

I'm trying to work with the CFITSIO library to process FITS images in C. I followed the installation guide from the documentation and I checked that it was successful installed. However when I compile the following code:
#include <string.h>
#include <stdio.h>
#include "fitsio.h"
int main(int argc, char *argv[])
{
fitsfile *fptr;
char card[FLEN_CARD];
int status = 0, nkeys, ii; /* MUST initialize status */
fits_open_file(&fptr, argv[1], READONLY, &status);
fits_get_hdrspace(fptr, &nkeys, NULL, &status);
for (ii = 1; ii <= nkeys; ii++) {
fits_read_record(fptr, ii, card, &status); /* read keyword */
printf("%s\n", card);
}
printf("END\n\n"); /* terminate listing with END */
fits_close_file(fptr, &status);
if (status) /* print any error messages */
fits_report_error(stderr, status);
return(status);
}
I get the following error:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/libcfitsio.a(zcompress.o): in function `uncompress2mem':
/home/tres-2b/Desktop/cfitsio-4.0.0/zcompress.c:97: undefined reference to `inflateInit2_'
/usr/bin/ld: /home/tres-2b/Desktop/cfitsio-4.0.0/zcompress.c:117: undefined reference to `inflate'
/usr/bin/ld: /home/tres-2b/Desktop/cfitsio-4.0.0/zcompress.c:117: undefined reference to `inflate'
/usr/bin/ld: /home/tres-2b/Desktop/cfitsio-4.0.0/zcompress.c:176: undefined reference to `inflateEnd'
/usr/bin/ld: /home/tres-2b/Desktop/cfitsio-4.0.0/zcompress.c:154: undefined reference to `inflateEnd'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/libcfitsio.a(zcompress.o): in function `uncompress2mem_from_mem':
/home/tres-2b/Desktop/cfitsio-4.0.0/zcompress.c:209: undefined reference to `inflateInit2_'
/usr/bin/ld: /home/tres-2b/Desktop/cfitsio-4.0.0/zcompress.c:220: undefined reference to `inflate'
/usr/bin/ld: /home/tres-2b/Desktop/cfitsio-4.0.0/zcompress.c:251: undefined reference to `inflateEnd'
/usr/bin/ld: /home/tres-2b/Desktop/cfitsio-4.0.0/zcompress.c:229: undefined reference to `inflateEnd'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/libcfitsio.a(zcompress.o): in function `uncompress2file':
/home/tres-2b/Desktop/cfitsio-4.0.0/zcompress.c:291: undefined reference to `inflateInit2_'
/usr/bin/ld: /home/tres-2b/Desktop/cfitsio-4.0.0/zcompress.c:312: undefined reference to `inflate'
/usr/bin/ld: /home/tres-2b/Desktop/cfitsio-4.0.0/zcompress.c:356: undefined reference to `inflateEnd'
/usr/bin/ld: /home/tres-2b/Desktop/cfitsio-4.0.0/zcompress.c:346: undefined reference to `inflateEnd'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/libcfitsio.a(zcompress.o): in function `compress2mem_from_mem':
/home/tres-2b/Desktop/cfitsio-4.0.0/zcompress.c:391: undefined reference to `deflateInit2_'
/usr/bin/ld: /home/tres-2b/Desktop/cfitsio-4.0.0/zcompress.c:404: undefined reference to `deflate'
/usr/bin/ld: /home/tres-2b/Desktop/cfitsio-4.0.0/zcompress.c:435: undefined reference to `deflateEnd'
/usr/bin/ld: /home/tres-2b/Desktop/cfitsio-4.0.0/zcompress.c:413: undefined reference to `deflateEnd'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/libcfitsio.a(zcompress.o): in function `compress2file_from_mem':
/home/tres-2b/Desktop/cfitsio-4.0.0/zcompress.c:473: undefined reference to `deflateInit2_'
/usr/bin/ld: /home/tres-2b/Desktop/cfitsio-4.0.0/zcompress.c:486: undefined reference to `deflate'
/usr/bin/ld: /home/tres-2b/Desktop/cfitsio-4.0.0/zcompress.c:526: undefined reference to `deflateEnd'
/usr/bin/ld: /home/tres-2b/Desktop/cfitsio-4.0.0/zcompress.c:514: undefined reference to `deflateEnd'
collect2: error: ld returned 1 exit status
I tried passing the files as an argument on the command terminal and hard forcing a FITS file into the program, but still wasn't able to run the program successfully. I couldn't find a lot of information about this library, so any help would be appreciated.

how to modify glibc dynamic linker to use with an x86 interpreter that doesn't support static binary?

I don't know if I can ask these kind of question here but I do it anyway.
I'm trying to run 32-bit linux binaries in the browser in doing so I compiled box86 to wasm (box86js) and run couples of simple binaries directly in the browser.
now I want a dynamic linker that itself depened on libc SDL2 GL and maybe afew others and when loading a binary that has a dependency on those libraries it resolve the symbols of those libraries with it's own symbols.
in this way I hope I can run more complicated binaries in the browser with performance much better than jslinux and full access to browser API and also I think having a single file that can be run both natively and in the browser is pretty cool.
glibc has too many moving parts and I hope you can help me with it.
I compiled glibc with these command on my x86_64 debian sid system
../glibc-2.31/configure CC="gcc -m32" CXX="g++ -m32" CFLAGS="-O3" CXXFLAGS="-O3" --build=i686-linux-gnu --host=i686-linux-gnu --prefix /opt/glibc
you can see the relevant part for compiling only ld.so here (the main file is rtld.c)
I modfied a few places in rtld.c and tried to compile this but gives me lots of undefined symbols
/*
ofilepath=myld
gcc -m32 -pie -std=gnu11 -fgnu89-inline -O3 -Wall -Wwrite-strings -Wundef -Werror -fmerge-all-constants -frounding-math -fno-stack-protector -Wstrict-prototypes -Wold-style-definition -fmath-errno -fPIC -fno-stack-protector -DSTACK_PROTECTOR_LEVEL=0 -Wa,-mtune=i686 -mno-sse -mno-mmx -mfpmath=387 -fno-tree-loop-distribute-patterns -Wno-uninitialized -Wno-unused -D'SYSCONFDIR="/etc"' -ftls-model=initial-exec -I$sdir/include -I$builddir/elf -I$builddir -I$sdir/sysdeps/unix/sysv/linux/i386/i686 -I$sdir/sysdeps/i386/i686/nptl -I$sdir/sysdeps/unix/sysv/linux/i386 -I$sdir/sysdeps/unix/sysv/linux/x86/include -I$sdir/sysdeps/unix/sysv/linux/x86 -I$sdir/sysdeps/x86/nptl -I$sdir/sysdeps/i386/nptl -I$sdir/sysdeps/unix/sysv/linux/include -I$sdir/sysdeps/unix/sysv/linux -I$sdir/sysdeps/nptl -I$sdir/sysdeps/pthread -I$sdir/sysdeps/gnu -I$sdir/sysdeps/unix/inet -I$sdir/sysdeps/unix/sysv -I$sdir/sysdeps/unix/i386 -I$sdir/sysdeps/unix -I$sdir/sysdeps/posix -I$sdir/sysdeps/i386/i686/fpu/multiarch -I$sdir/sysdeps/i386/i686/fpu -I$sdir/sysdeps/i386/i686/multiarch -I$sdir/sysdeps/i386/i686 -I$sdir/sysdeps/i386/fpu -I$sdir/sysdeps/x86/fpu/include -I$sdir/sysdeps/x86/fpu -I$sdir/sysdeps/i386 -I$sdir/sysdeps/x86 -I$sdir/sysdeps/wordsize-32 -I$sdir/sysdeps/ieee754/float128 -I$sdir/sysdeps/ieee754/ldbl-96/include -I$sdir/sysdeps/ieee754/ldbl-96 -I$sdir/sysdeps/ieee754/dbl-64 -I$sdir/sysdeps/ieee754/flt-32 -I$sdir/sysdeps/ieee754 -I$sdir/sysdeps/generic -I$sdir -I$sdir/libio -I$sdir/elf -D_LIBC_REENTRANT -include $builddir/libc-modules.h -DMODULE_NAME=rtld -include $sdir/include/libc-symbols.h -DPIC -DSHARED -DTOP_NAMESPACE=glibc -o $ofilepath $0 $builddir/elf/rtld.os $builddir/elf/dl-load.os $builddir/elf/dl-lookup.os $builddir/elf/dl-object.os $builddir/elf/dl-reloc.os $builddir/elf/dl-deps.os $builddir/elf/dl-hwcaps.os $builddir/elf/dl-runtime.os $builddir/elf/dl-init.os $builddir/elf/dl-fini.os $builddir/elf/dl-debug.os $builddir/elf/dl-misc.os $builddir/elf/dl-version.os $builddir/elf/dl-profile.os $builddir/elf/dl-tls.os $builddir/elf/dl-origin.os $builddir/elf/dl-scope.os $builddir/elf/dl-execstack.os $builddir/elf/dl-open.os $builddir/elf/dl-close.os $builddir/elf/dl-trampoline.os $builddir/elf/dl-exception.os $builddir/elf/dl-sort-maps.os $builddir/elf/dl-cache.os $builddir/elf/dl-tunables.os $builddir/elf/libc-do-syscall.os $builddir/elf/tlsdesc.os $builddir/elf/dl-tlsdesc.os $builddir/elf/dl-get-cpu-features.os $builddir/elf/dl-sysdep.os $builddir/elf/dl-environ.os $builddir/elf/dl-minimal.os $builddir/elf/dl-error-minimal.os $builddir/elf/dl-conflict.os
exit 1
*/
#include <ldsodefs.h>
static ElfW(Addr) __attribute_used__ _dl_start (void *arg);
ElfW(Addr) _dl_sysdep_start (void **start_argptr, void (*dl_main) (const ElfW(Phdr) *phdr, ElfW(Word) phnum, ElfW(Addr) *user_entry, ElfW(auxv_t) *auxv));
void dl_main(const ElfW(Phdr) *phdr, ElfW(Word) phnum, ElfW(Addr) *user_entry, ElfW(auxv_t) *auxv);
int main(int argc, char** argv)
{
//dl_start();
_dl_sysdep_start((void*) (argv - 1), &dl_main);
}
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-profile.os: warning: relocation against `__GI___fxstat64' in read-only section `.text'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-load.os: in function `is_dst':
dl-load.c:(.text+0x18): undefined reference to `strlen'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-load.os: in function `lose.constprop.0':
dl-load.c:(.text+0x254): undefined reference to `__GI___close_nocancel'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-load.os: in function `open_verify.constprop.1':
dl-load.c:(.text+0x2e3): undefined reference to `__GI___open64_nocancel'
/usr/bin/ld: dl-load.c:(.text+0x2f8): undefined reference to `rtld_errno'
/usr/bin/ld: dl-load.c:(.text+0x323): undefined reference to `__GI___read_nocancel'
/usr/bin/ld: dl-load.c:(.text+0x407): undefined reference to `__GI___close_nocancel'
/usr/bin/ld: dl-load.c:(.text+0x417): undefined reference to `rtld_errno'
/usr/bin/ld: dl-load.c:(.text+0x57d): undefined reference to `__GI___pread64_nocancel'
/usr/bin/ld: dl-load.c:(.text+0x652): undefined reference to `rtld_errno'
/usr/bin/ld: dl-load.c:(.text+0x66e): undefined reference to `strlen'
/usr/bin/ld: dl-load.c:(.text+0x721): undefined reference to `__GI___pread64_nocancel'
/usr/bin/ld: dl-load.c:(.text+0x82c): undefined reference to `rtld_errno'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-load.os: in function `open_verify.constprop.0':
dl-load.c:(.text+0x88b): undefined reference to `__GI___open64_nocancel'
/usr/bin/ld: dl-load.c:(.text+0x8a8): undefined reference to `rtld_errno'
/usr/bin/ld: dl-load.c:(.text+0x8ce): undefined reference to `__GI___read_nocancel'
/usr/bin/ld: dl-load.c:(.text+0xaed): undefined reference to `__GI___pread64_nocancel'
/usr/bin/ld: dl-load.c:(.text+0xc3a): undefined reference to `rtld_errno'
/usr/bin/ld: dl-load.c:(.text+0xcaf): undefined reference to `__GI___close_nocancel'
/usr/bin/ld: dl-load.c:(.text+0xcbf): undefined reference to `rtld_errno'
/usr/bin/ld: dl-load.c:(.text+0xd11): undefined reference to `__GI___pread64_nocancel'
/usr/bin/ld: dl-load.c:(.text+0xe74): undefined reference to `rtld_errno'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-load.os: in function `open_path':
dl-load.c:(.text+0x10b0): undefined reference to `__GI___fxstat64'
/usr/bin/ld: dl-load.c:(.text+0x10cd): undefined reference to `__GI___close_nocancel'
/usr/bin/ld: dl-load.c:(.text+0x10dc): undefined reference to `rtld_errno'
/usr/bin/ld: dl-load.c:(.text+0x113c): undefined reference to `rtld_errno'
/usr/bin/ld: dl-load.c:(.text+0x120a): undefined reference to `__GI___xstat64'
/usr/bin/ld: dl-load.c:(.text+0x149a): undefined reference to `__GI___close_nocancel'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-load.os: in function `add_name_to_object.isra.0':
dl-load.c:(.text+0x15b0): undefined reference to `strcmp'
/usr/bin/ld: dl-load.c:(.text+0x15cd): undefined reference to `strlen'
/usr/bin/ld: dl-load.c:(.text+0x1622): undefined reference to `strlen'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-load.os: in function `_dl_map_object_from_fd':
dl-load.c:(.text+0x1942): undefined reference to `__mmap'
/usr/bin/ld: dl-load.c:(.text+0x1a7f): undefined reference to `__mmap'
/usr/bin/ld: dl-load.c:(.text+0x1cd0): undefined reference to `__GI___fxstat64'
/usr/bin/ld: dl-load.c:(.text+0x1d72): undefined reference to `__GI___close_nocancel'
/usr/bin/ld: dl-load.c:(.text+0x1dca): undefined reference to `__GI___pread64_nocancel'
/usr/bin/ld: dl-load.c:(.text+0x1e7e): undefined reference to `__GI___close_nocancel'
/usr/bin/ld: dl-load.c:(.text+0x1ec1): undefined reference to `__mprotect'
/usr/bin/ld: dl-load.c:(.text+0x21f1): undefined reference to `__GI___close_nocancel'
/usr/bin/ld: dl-load.c:(.text+0x2282): undefined reference to `memmove'
/usr/bin/ld: dl-load.c:(.text+0x240b): undefined reference to `__GI___close_nocancel'
/usr/bin/ld: dl-load.c:(.text+0x244b): undefined reference to `rtld_errno'
/usr/bin/ld: dl-load.c:(.text+0x249a): undefined reference to `__mmap'
/usr/bin/ld: dl-load.c:(.text+0x25bc): undefined reference to `rtld_errno'
/usr/bin/ld: dl-load.c:(.text+0x27db): undefined reference to `__mprotect'
/usr/bin/ld: dl-load.c:(.text+0x2834): undefined reference to `__mprotect'
/usr/bin/ld: dl-load.c:(.text+0x28df): undefined reference to `__mprotect'
/usr/bin/ld: dl-load.c:(.text+0x2902): undefined reference to `__mprotect'
/usr/bin/ld: dl-load.c:(.text+0x298b): undefined reference to `__munmap'
/usr/bin/ld: dl-load.c:(.text+0x2aab): undefined reference to `rtld_errno'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-load.os: in function `_dl_dst_count':
dl-load.c:(.text+0x2b8b): undefined reference to `strchr'
/usr/bin/ld: dl-load.c:(.text+0x2bec): undefined reference to `strchr'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-load.os: in function `expand_dynamic_string_token':
dl-load.c:(.text+0x2d9c): undefined reference to `strchr'
/usr/bin/ld: dl-load.c:(.text+0x2dac): undefined reference to `__strdup'
/usr/bin/ld: dl-load.c:(.text+0x2e1c): undefined reference to `strchr'
/usr/bin/ld: dl-load.c:(.text+0x2e38): undefined reference to `strlen'
/usr/bin/ld: dl-load.c:(.text+0x2e5d): undefined reference to `strlen'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-load.os: in function `fillin_rpath.isra.0':
dl-load.c:(.text+0x2f7c): undefined reference to `strlen'
/usr/bin/ld: dl-load.c:(.text+0x3074): undefined reference to `strlen'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-load.os: in function `decompose_rpath':
dl-load.c:(.text+0x3235): undefined reference to `__strdup'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-load.os: in function `_dl_init_paths':
dl-load.c:(.text+0x3601): undefined reference to `strlen'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-load.os: in function `_dl_map_object':
dl-load.c:(.text+0x37e3): undefined reference to `strcmp'
/usr/bin/ld: dl-load.c:(.text+0x3854): undefined reference to `strchr'
/usr/bin/ld: dl-load.c:(.text+0x3932): undefined reference to `strchr'
/usr/bin/ld: dl-load.c:(.text+0x3952): undefined reference to `__strdup'
/usr/bin/ld: dl-load.c:(.text+0x39c3): undefined reference to `__strdup'
/usr/bin/ld: dl-load.c:(.text+0x3a3e): undefined reference to `strlen'
/usr/bin/ld: dl-load.c:(.text+0x3d7c): undefined reference to `strchr'
/usr/bin/ld: dl-load.c:(.text+0x3ef1): undefined reference to `strcmp'
/usr/bin/ld: dl-load.c:(.text+0x407e): undefined reference to `strlen'
/usr/bin/ld: dl-load.c:(.text+0x40f9): undefined reference to `rtld_errno'
/usr/bin/ld: dl-load.c:(.text+0x41d7): undefined reference to `strcmp'
/usr/bin/ld: dl-load.c:(.text+0x4294): undefined reference to `strlen'
/usr/bin/ld: /tmp/cc7UpnIn.o: in function `main':
myld.c:(.text.startup+0x21): undefined reference to `dl_main'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/rtld.os: in function `handle_preload_list':
rtld.c:(.text+0x199): undefined reference to `strlen'
/usr/bin/ld: rtld.c:(.text+0x1b3): undefined reference to `memchr'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-lookup.os: in function `check_match':
dl-lookup.c:(.text+0x64): undefined reference to `strcmp'
/usr/bin/ld: dl-lookup.c:(.text+0x128): undefined reference to `strcmp'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-lookup.os: in function `do_lookup_x':
dl-lookup.c:(.text+0x55f): undefined reference to `strcmp'
/usr/bin/ld: dl-lookup.c:(.text+0x5eb): undefined reference to `strcmp'
/usr/bin/ld: dl-lookup.c:(.text+0x72c): undefined reference to `strcmp'
/usr/bin/ld: dl-lookup.c:(.text+0xbc5): undefined reference to `__GI__exit'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-object.os: in function `_dl_new_object':
dl-object.c:(.text+0xee): undefined reference to `strlen'
/usr/bin/ld: dl-object.c:(.text+0x268): undefined reference to `strlen'
/usr/bin/ld: dl-object.c:(.text+0x29a): undefined reference to `rtld_errno'
/usr/bin/ld: dl-object.c:(.text+0x2d5): undefined reference to `__getcwd'
/usr/bin/ld: dl-object.c:(.text+0x2ed): undefined reference to `strlen'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-reloc.os: in function `_dl_protect_relro':
dl-reloc.c:(.text+0x2ba): undefined reference to `__mprotect'
/usr/bin/ld: dl-reloc.c:(.text+0x2d5): undefined reference to `rtld_errno'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-reloc.os: in function `_dl_relocate_object':
dl-reloc.c:(.text+0x7d2): undefined reference to `__mprotect'
/usr/bin/ld: dl-reloc.c:(.text+0x1f79): undefined reference to `__mprotect'
/usr/bin/ld: dl-reloc.c:(.text+0x20ef): undefined reference to `__mprotect'
/usr/bin/ld: dl-reloc.c:(.text+0x2180): undefined reference to `__GI__exit'
/usr/bin/ld: dl-reloc.c:(.text+0x27af): undefined reference to `rtld_errno'
/usr/bin/ld: dl-reloc.c:(.text+0x27e0): undefined reference to `__GI__exit'
/usr/bin/ld: dl-reloc.c:(.text+0x2834): undefined reference to `rtld_errno'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-deps.os: in function `_dl_map_object_deps':
dl-deps.c:(.text+0x466): undefined reference to `rtld_errno'
/usr/bin/ld: dl-deps.c:(.text+0x46c): undefined reference to `rtld_errno'
/usr/bin/ld: dl-deps.c:(.text+0x638): undefined reference to `strlen'
/usr/bin/ld: dl-deps.c:(.text+0x669): undefined reference to `strlen'
/usr/bin/ld: dl-deps.c:(.text+0x882): undefined reference to `strlen'
/usr/bin/ld: dl-deps.c:(.text+0x8b1): undefined reference to `strlen'
/usr/bin/ld: dl-deps.c:(.text+0x984): undefined reference to `rtld_errno'
/usr/bin/ld: dl-deps.c:(.text+0xd12): undefined reference to `rtld_errno'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-hwcaps.os: in function `_dl_important_hwcaps':
dl-hwcaps.c:(.text+0x2c0): undefined reference to `strlen'
/usr/bin/ld: dl-hwcaps.c:(.text+0x37a): undefined reference to `strlen'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-misc.os: in function `_dl_debug_vdprintf':
dl-misc.c:(.text+0x2ee): undefined reference to `strlen'
/usr/bin/ld: dl-misc.c:(.text+0x322): undefined reference to `__getpid'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-misc.os: in function `_dl_sysdep_read_whole_file':
dl-misc.c:(.text+0x484): undefined reference to `__GI___open64_nocancel'
/usr/bin/ld: dl-misc.c:(.text+0x4ae): undefined reference to `__GI___fxstat64'
/usr/bin/ld: dl-misc.c:(.text+0x4d1): undefined reference to `__GI___close_nocancel'
/usr/bin/ld: dl-misc.c:(.text+0x4f3): undefined reference to `__mmap'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-misc.os: in function `_dl_name_match_p':
dl-misc.c:(.text+0x592): undefined reference to `strcmp'
/usr/bin/ld: dl-misc.c:(.text+0x5be): undefined reference to `strcmp'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-version.os: in function `_dl_check_map_versions':
dl-version.c:(.text+0x280): undefined reference to `strcmp'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-profile.os: in function `_dl_start_profile':
dl-profile.c:(.text+0x1b7): undefined reference to `strlen'
/usr/bin/ld: dl-profile.c:(.text+0x1cb): undefined reference to `strlen'
/usr/bin/ld: dl-profile.c:(.text+0x22e): undefined reference to `__GI___open64_nocancel'
/usr/bin/ld: dl-profile.c:(.text+0x24e): undefined reference to `__GI___fxstat64'
/usr/bin/ld: dl-profile.c:(.text+0x2cb): undefined reference to `__mmap'
/usr/bin/ld: dl-profile.c:(.text+0x2e6): undefined reference to `__GI___close_nocancel'
/usr/bin/ld: dl-profile.c:(.text+0x394): undefined reference to `__munmap'
/usr/bin/ld: dl-profile.c:(.text+0x3e8): undefined reference to `rtld_errno'
/usr/bin/ld: dl-profile.c:(.text+0x3f7): undefined reference to `__GI___close_nocancel'
/usr/bin/ld: dl-profile.c:(.text+0x43a): undefined reference to `rtld_errno'
/usr/bin/ld: dl-profile.c:(.text+0x44b): undefined reference to `__GI___close_nocancel'
/usr/bin/ld: dl-profile.c:(.text+0x616): undefined reference to `__profil'
/usr/bin/ld: dl-profile.c:(.text+0x67c): undefined reference to `__lseek'
/usr/bin/ld: dl-profile.c:(.text+0x692): undefined reference to `rtld_errno'
/usr/bin/ld: dl-profile.c:(.text+0x6b2): undefined reference to `__GI___write_nocancel'
/usr/bin/ld: dl-profile.c:(.text+0x752): undefined reference to `__munmap'
/usr/bin/ld: dl-profile.c:(.text+0x76e): undefined reference to `__GI__exit'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-tls.os: in function `oom':
dl-tls.c:(.text+0x23): undefined reference to `__GI__exit'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-tls.os: in function `_dl_tls_static_surplus_init':
dl-tls.c:(.text+0x388): undefined reference to `__GI__exit'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-origin.os: in function `_dl_get_origin':
dl-origin.c:(.text+0xa1): undefined reference to `strlen'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-execstack.os: in function `__GI__dl_make_stack_executable':
dl-execstack.c:(.text+0x27): undefined reference to `__mprotect'
/usr/bin/ld: dl-execstack.c:(.text+0x4a): undefined reference to `rtld_errno'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-open.os: in function `__GI__dl_find_dso_for_object':
dl-open.c:(.text+0x3b7): undefined reference to `_dl_addr_inside_object'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-open.os: in function `dl_open_worker':
dl-open.c:(.text+0xae5): undefined reference to `strchr'
/usr/bin/ld: dl-open.c:(.text+0x10e8): undefined reference to `strchr'
/usr/bin/ld: dl-open.c:(.text+0x155e): undefined reference to `__GI__exit'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-close.os: in function `_dl_close_worker.part.0.isra.0':
dl-close.c:(.text+0x11e0): undefined reference to `__GI__exit'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-exception.os: in function `length_mismatch':
dl-exception.c:(.text+0x23): undefined reference to `__GI__exit'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-exception.os: in function `__GI__dl_exception_create':
dl-exception.c:(.text+0x53): undefined reference to `strlen'
/usr/bin/ld: dl-exception.c:(.text+0x65): undefined reference to `strlen'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-exception.os: in function `__GI__dl_exception_create_format':
dl-exception.c:(.text+0x14c): undefined reference to `strlen'
/usr/bin/ld: dl-exception.c:(.text+0x1c3): undefined reference to `strlen'
/usr/bin/ld: dl-exception.c:(.text+0x3d9): undefined reference to `__GI__exit'
/usr/bin/ld: dl-exception.c:(.text+0x3ee): undefined reference to `strlen'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-sort-maps.os: in function `_dl_sort_maps':
dl-sort-maps.c:(.text+0x11b): undefined reference to `memmove'
/usr/bin/ld: dl-sort-maps.c:(.text+0x143): undefined reference to `memmove'
/usr/bin/ld: dl-sort-maps.c:(.text+0x1b0): undefined reference to `memmove'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-cache.os: in function `_dl_load_cache_lookup':
dl-cache.c:(.text+0x18d): undefined reference to `strcmp'
/usr/bin/ld: dl-cache.c:(.text+0x1a5): undefined reference to `strcmp'
/usr/bin/ld: dl-cache.c:(.text+0x3e3): undefined reference to `strlen'
/usr/bin/ld: dl-cache.c:(.text+0x40e): undefined reference to `__strdup'
/usr/bin/ld: dl-cache.c:(.text+0x723): undefined reference to `__munmap'
/usr/bin/ld: dl-cache.c:(.text+0x767): undefined reference to `__munmap'
/usr/bin/ld: dl-cache.c:(.text+0x96d): undefined reference to `__munmap'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-cache.os: in function `_dl_unload_cache':
dl-cache.c:(.text+0xa63): undefined reference to `__munmap'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-tunables.os: in function `__GI___tunables_init':
dl-tunables.c:(.text+0x301): undefined reference to `__sbrk'
/usr/bin/ld: dl-tunables.c:(.text+0x828): undefined reference to `__GI__exit'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/tlsdesc.os: in function `_dl_unmap':
tlsdesc.c:(.text+0x776): undefined reference to `__munmap'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-sysdep.os: in function `_dl_sysdep_start':
dl-sysdep.c:(.text+0x10c6): undefined reference to `_environ'
/usr/bin/ld: dl-sysdep.c:(.text+0x14c1): undefined reference to `__brk'
/usr/bin/ld: dl-sysdep.c:(.text+0x1616): undefined reference to `strlen'
/usr/bin/ld: dl-sysdep.c:(.text+0x1629): undefined reference to `__sbrk'
/usr/bin/ld: dl-sysdep.c:(.text+0x17c2): undefined reference to `__sbrk'
/usr/bin/ld: dl-sysdep.c:(.text+0x17e1): undefined reference to `__libc_check_standard_fds'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-sysdep.os: in function `_dl_discover_osversion':
dl-sysdep.c:(.text+0x1ca9): undefined reference to `__uname'
/usr/bin/ld: dl-sysdep.c:(.text+0x1d65): undefined reference to `__GI___open64_nocancel'
/usr/bin/ld: dl-sysdep.c:(.text+0x1d7e): undefined reference to `__GI___read_nocancel'
/usr/bin/ld: dl-sysdep.c:(.text+0x1d88): undefined reference to `__GI___close_nocancel'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-environ.os: in function `unsetenv':
dl-environ.c:(.text+0x53): undefined reference to `__environ'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-minimal.os: in function `malloc':
dl-minimal.c:(.text+0x83): undefined reference to `__mmap'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-minimal.os: in function `__GI___libc_fatal':
dl-minimal.c:(.text+0x2f7): undefined reference to `__GI__exit'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-minimal.os: in function `__GI___chk_fail':
dl-minimal.c:(.text+0x306): undefined reference to `__GI__exit'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-minimal.os: in function `__GI___assert_fail':
dl-minimal.c:(.text+0x351): undefined reference to `__GI__exit'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-minimal.os: in function `__GI___assert_perror_fail':
dl-minimal.c:(.text+0x455): undefined reference to `__GI__exit'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-error-minimal.os: in function `fatal_error':
dl-error-minimal.c:(.text+0x7d): undefined reference to `__GI__exit'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-error-minimal.os: in function `_dl_signal_exception':
dl-error-minimal.c:(.text+0xf2): undefined reference to `__longjmp'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-error-minimal.os: in function `_dl_signal_error':
dl-error-minimal.c:(.text+0x15a): undefined reference to `__longjmp'
/usr/bin/ld: /home/raoof/playground/myld/build/elf/dl-error-minimal.os: in function `_dl_catch_exception':
dl-error-minimal.c:(.text+0x2ea): undefined reference to `__sigsetjmp'
/usr/bin/ld: /home/raoof/playground/bin/myld: hidden symbol `memmove' isn't defined
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status

Resources