I'm trying to compile COSEG, a program from the RepeatMasker developers (link: http://www.repeatmasker.org/COSEGDownload.html) on Xubuntu.
After unpacking the distribution I enter the directory and try to run make in my terminal but I get many "undefined reference to" errors:
massimiliano#compaq2:~/Programs/coseg$ make
cc -O4 -lm version.o coseg.o -o coseg
coseg.o: In function `compute_siegel_tri_pvalue.part.0':
coseg.c:(.text+0xa1): undefined reference to `log'
coseg.c:(.text+0xae): undefined reference to `exp'
coseg.c:(.text+0x47b): undefined reference to `log'
coseg.c:(.text+0x4c2): undefined reference to `exp'
coseg.c:(.text+0x4d7): undefined reference to `log'
coseg.c:(.text+0x683): undefined reference to `log'
coseg.c:(.text+0x6d7): undefined reference to `exp'
coseg.c:(.text+0x6e4): undefined reference to `log'
coseg.c:(.text+0x70f): undefined reference to `sqrt'
coseg.c:(.text+0x72d): undefined reference to `sqrt'
coseg.c:(.text+0x757): undefined reference to `sqrt'
coseg.o: In function `compute_siegel_pvalue.part.1':
coseg.c:(.text+0x7da): undefined reference to `log'
coseg.c:(.text+0x7e7): undefined reference to `exp'
coseg.c:(.text+0x97f): undefined reference to `exp'
coseg.c:(.text+0x98c): undefined reference to `log'
coseg.c:(.text+0x9ff): undefined reference to `log'
coseg.c:(.text+0xad7): undefined reference to `exp'
coseg.c:(.text+0xae4): undefined reference to `log'
coseg.c:(.text+0xb4d): undefined reference to `log'
coseg.c:(.text+0xbe7): undefined reference to `sqrt'
coseg.c:(.text+0xc05): undefined reference to `sqrt'
coseg.o: In function `compute_pvalue.part.2':
coseg.c:(.text+0xd3b): undefined reference to `log'
coseg.c:(.text+0xd4c): undefined reference to `log'
coseg.c:(.text+0xe24): undefined reference to `exp'
coseg.c:(.text+0xe86): undefined reference to `log'
coseg.c:(.text+0xe97): undefined reference to `log'
coseg.o: In function `compute_tri_pvalue.part.3':
coseg.c:(.text+0x10e4): undefined reference to `exp'
coseg.o: In function `inverseNormalCDF':
coseg.c:(.text+0x141e): undefined reference to `log'
coseg.c:(.text+0x150f): undefined reference to `sqrt'
coseg.o: In function `allocate_memory':
coseg.c:(.text+0x15de): undefined reference to `log'
coseg.c:(.text+0x166c): undefined reference to `log'
coseg.c:(.text+0x16cc): undefined reference to `log'
coseg.o: In function `compute_tri_pvalue':
coseg.c:(.text+0x303a): undefined reference to `log'
coseg.c:(.text+0x3047): undefined reference to `exp'
coseg.o: In function `compute_pvalue':
coseg.c:(.text+0x31e6): undefined reference to `log'
coseg.c:(.text+0x31f3): undefined reference to `exp'
coseg.o: In function `compute_score':
coseg.c:(.text+0x32cd): undefined reference to `log'
coseg.c:(.text+0x32da): undefined reference to `exp'
coseg.o: In function `compute_tri_score':
coseg.c:(.text+0x3386): undefined reference to `log'
coseg.c:(.text+0x3393): undefined reference to `exp'
coseg.o: In function `compute_tri_bestmut':
coseg.c:(.text+0x628c): undefined reference to `log'
coseg.c:(.text+0x629b): undefined reference to `exp'
coseg.o: In function `split_pvaluelocal':
coseg.c:(.text+0x6e55): undefined reference to `log'
coseg.c:(.text+0x734d): undefined reference to `log'
coseg.c:(.text+0x735a): undefined reference to `exp'
coseg.o: In function `compute_bestmut':
coseg.c:(.text+0x7ff3): undefined reference to `log'
coseg.c:(.text+0x8000): undefined reference to `exp'
coseg.o: In function `union_tri_pvalue':
coseg.c:(.text+0x91fd): undefined reference to `log'
coseg.c:(.text+0x920a): undefined reference to `exp'
coseg.c:(.text+0x934e): undefined reference to `log'
coseg.c:(.text+0x935b): undefined reference to `exp'
coseg.o: In function `union_pvalue':
coseg.c:(.text+0x9e1c): undefined reference to `log'
coseg.c:(.text+0x9e29): undefined reference to `exp'
coseg.o: In function `build_MST':
coseg.c:(.text+0xb232): undefined reference to `exp'
coseg.o: In function `compute_sigma':
coseg.c:(.text+0xb7d4): undefined reference to `log'
coseg.c:(.text+0xb7e1): undefined reference to `exp'
coseg.o: In function `compute_bestmut1':
coseg.c:(.text+0xbb27): undefined reference to `log'
coseg.c:(.text+0xbb34): undefined reference to `exp'
coseg.o: In function `build_new_subfamily2':
coseg.c:(.text+0xd265): undefined reference to `exp'
coseg.c:(.text+0xd2a6): undefined reference to `log'
coseg.c:(.text+0xd4ad): undefined reference to `exp'
coseg.c:(.text+0xd4ee): undefined reference to `log'
coseg.o: In function `sigmage_to_logpvalue':
coseg.c:(.text+0xd8a8): undefined reference to `exp'
coseg.c:(.text+0xd8ec): undefined reference to `log'
coseg.o: In function `build_new_singlemut_subfamily':
coseg.c:(.text+0xdb4d): undefined reference to `exp'
coseg.c:(.text+0xdb8e): undefined reference to `log'
coseg.c:(.text+0xdd7d): undefined reference to `exp'
coseg.c:(.text+0xddbe): undefined reference to `log'
coseg.o: In function `build_singlemut_MST':
coseg.c:(.text+0xe608): undefined reference to `log'
coseg.c:(.text+0xe615): undefined reference to `exp'
coseg.c:(.text+0xe8ce): undefined reference to `log'
coseg.c:(.text+0xe8db): undefined reference to `exp'
coseg.o: In function `build_MST2':
coseg.c:(.text+0xf38f): undefined reference to `exp'
coseg.c:(.text+0xf5d0): undefined reference to `exp'
coseg.c:(.text+0xf7c9): undefined reference to `exp'
coseg.c:(.text+0xf814): undefined reference to `log'
coseg.c:(.text+0xf85f): undefined reference to `exp'
coseg.c:(.text+0xfb3c): undefined reference to `exp'
coseg.c:(.text+0xfb97): undefined reference to `log'
coseg.c:(.text+0xfbf6): undefined reference to `exp'
coseg.c:(.text+0xfcd8): undefined reference to `sqrt'
coseg.c:(.text+0xfd51): undefined reference to `sqrt'
coseg.o: In function `print_subfamilies':
coseg.c:(.text+0xffe0): undefined reference to `exp'
coseg.c:(.text+0x10024): undefined reference to `log'
collect2: ld returned 1 exit status
make: *** [coseg] Error 1
Searching the internet I have found that probably it is a 'linking' problem and I have to add/modify some lines of code in the makefile but this kind of stuffs are very new to me and I am not a programmer, so I feel a bit confused.
Do you have some tips or suggestions to help me to solve this problem, please?
Thank you very much for your time!
Massimiliano.
Update:
Trying to compile the previous version of the program, gives me an additional warning:
echo "char const* Version = \"0.2.1\";" > version.c
cc -O4 -lm -c -o version.o version.c
cc -O4 -lm -c -o coseg.o coseg.c
coseg.c: In function ‘inverseNormalCDF’:
coseg.c:973:5: warning: format ‘%lf’ expects a matching ‘double’ argument [-Wformat]
Update - Makefile:
This is the Makefile unpacked with the distribution:
##
## Makefile for coseg project
##
VERSION=0.2.2
INSTALLDIR=/usr/local/coseg-${VERSION}
## Basic
CC = cc -O4 -lm
## A nice memory leak checker:
#CC = bgcc -O4 -fbounds-checking -lm
all: coseg
version.c: Makefile
echo "char const* Version = \"$(VERSION)\";" > version.c
coseg: version.o coseg.o
${CC} version.o coseg.o -o coseg
beautify:
indent -bap -cdb -bl -bli0 -npcs -nut -lp coseg.c
install: coseg
-mkdir ${INSTALLDIR}
cp coseg ${INSTALLDIR}
cp README ${INSTALLDIR}
cp preprocessAlignments.pl ${INSTALLDIR}
cp postprocess.pl ${INSTALLDIR}
cp runcoseg.pl ${INSTALLDIR}
cp extractSubSeqs.pl ${INSTALLDIR}
cp refineConsSeqs.pl ${INSTALLDIR}
cp ALU.cons ${INSTALLDIR}
cp ALU.ins ${INSTALLDIR}
cp ALU.seqs ${INSTALLDIR}
cp LINE1 ${INSTALLDIR}
dist:
-mkdir dist
-mkdir dist/coseg
cp ALU.cons dist/coseg
cp ALU.ins dist/coseg
cp ALU.seqs dist/coseg
cp LINE1 dist/coseg
cp Makefile dist/coseg
cp README dist/coseg
cp coseg.c dist/coseg
cp coseg.h dist/coseg
cp postprocess.pl dist/coseg
cp preprocessAlignments.pl dist/coseg
cp runcoseg.pl dist/coseg
cp extractSubSeqs.pl dist/coseg
cp refineConsSeqs.pl dist/coseg
(cd dist; tar zcvf coseg-$(VERSION).tar.gz coseg)
clean:
-rm *.o
-rm coseg
-rm version.c
-rm ALU.seqs.subfamilies.seq
-rm ALU.seqs.assign
-rm ALU.seqs.log
-rm ALU.seqs.subfamilies
-rm ALU.seqs.tree.viz
ALU.seqs.subfamilies.seq: coseg
./runcoseg.pl -d -filePrefix ALU
t/kothi.seqs.subfamilies.seq: coseg
./runcoseg.pl -u1 -t -m 5 -filePrefix t/kothi
test: ALU.seqs.subfamilies.seq t/kothi.seqs.subfamilies.seq
diff ALU.seqs.subfamilies.seq t
diff t/kothi.seqs.subfamilies.seq t/kothi-baseline
Some linkers (including yours) need to have the libraries specified after the object files (or other libraries), which use symbols from it. This can even lead to the necessity to specify libraries multiply if cyclic dependencies are involved.
In your case coseg.o uses symbols from libm, so you would have to specify -lm after coseg.o in your command: cc -O4 version.o coseg.o -lm -o coseg
I suggest you change your Makefile to:
##
## Makefile for coseg project
##
VERSION=0.2.2
INSTALLDIR=/usr/local/coseg-${VERSION}
## Basic
CC = cc
CFLAGS = -O4
LDFLAGS = -lm
## A nice memory leak checker:
#CC = bgcc -O4 -fbounds-checking -lm
all: coseg
version.c: Makefile
echo "char const* Version = \"$(VERSION)\";" > version.c
coseg: version.o coseg.o
${CC} version.o coseg.o ${LDFLAGS} -o coseg
... rest of makefile ...
That should fix your problem.
Related
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
I'm trying to compile the following program in Main.c:
#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>
int main()
{
glfwInit();
return 0;
}
I compile it with:
gcc -m64 -c -g -I"libs/vulkan/include" -I"libs/GLFW/include" -std=c11 -MMD -MP -MF "bin/main.o.d" -o bin/main.o src/Main.c
and link it with:
gcc -m64 -o bin/vulkanfirsttest.exe bin/main.o -L"libs/vulkan/lib" -L"libs/GLFW/lib" -L"C:/msys64/mingw64/lib" -lvulkan-1 -lglfw3 -lgdiplus
It compiles successfully but when I try to link it, it spits out the following errors:
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_monitor.c.obj):(.text+0x8e): undefined reference to `__imp_CreateDCW'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_monitor.c.obj):(.text+0xc8): undefined reference to `__imp_GetDeviceCaps'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_monitor.c.obj):(.text+0x123): undefined reference to `__imp_DeleteDC'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_monitor.c.obj):(.text+0x263): undefined reference to `__imp_GetDeviceCaps'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_monitor.c.obj):(.text+0x88b): undefined reference to `__imp_GetDeviceCaps'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_monitor.c.obj):(.text+0x9db): undefined reference to `__imp_GetDeviceCaps'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_monitor.c.obj):(.text+0xdaa): undefined reference to `__imp_CreateDCW'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_monitor.c.obj):(.text+0xdb9): undefined reference to `__imp_GetDeviceGammaRamp'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_monitor.c.obj):(.text+0xdc2): undefined reference to `__imp_DeleteDC'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_monitor.c.obj):(.text+0xf37): undefined reference to `__imp_CreateDCW'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_monitor.c.obj):(.text+0xf46): undefined reference to `__imp_SetDeviceGammaRamp'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_monitor.c.obj):(.text+0xf4f): undefined reference to `__imp_DeleteDC'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_window.c.obj):(.text+0x21a): undefined reference to `__imp_CreateDIBSection'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_window.c.obj):(.text+0x253): undefined reference to `__imp_CreateBitmap'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_window.c.obj):(.text+0x304): undefined reference to `__imp_DeleteObject'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_window.c.obj):(.text+0x397): undefined reference to `__imp_DeleteObject'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_window.c.obj):(.text+0x432): undefined reference to `__imp_CreateRectRgn'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_window.c.obj):(.text+0x4ab): undefined reference to `__imp_DeleteObject'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(wgl_context.c.obj):(.text+0x16a): undefined reference to `__imp_SwapBuffers'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(wgl_context.c.obj):(.text+0x42d): undefined reference to `__imp_ChoosePixelFormat'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(wgl_context.c.obj):(.text+0x43b): undefined reference to `__imp_SetPixelFormat'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(wgl_context.c.obj):(.text+0xc97): undefined reference to `__imp_DescribePixelFormat'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(wgl_context.c.obj):(.text+0xe81): undefined reference to `__imp_DescribePixelFormat'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(wgl_context.c.obj):(.text+0xe9b): undefined reference to `__imp_SetPixelFormat'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(wgl_context.c.obj):(.text+0x1498): undefined reference to `__imp_DescribePixelFormat'
I found a post that had a similar problem, and the answer was to also link gdi32, but there isn't a gdi32 package in mysys2. There is gdiplus (mingw64/mingw-w64-x86_64-libgdiplus 5.6.1-1), but as you can see that doesn't help.
When I compile my makefile, I encounter this problem:
gcc parser.tab.o -o parser.tab
/usr/lib/../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
parser.tab.o: In function `yyparse':
parser.tab.c:(.text+0x2c3): undefined reference to `yylex'
parser.tab.c:(.text+0x3f5): undefined reference to `execute'
parser.tab.c:(.text+0x82b): undefined reference to `yyerror'
parser.tab.c:(.text+0x947): undefined reference to `yyerror'
collect2: ld returned 1 exit status
make: *** [parser.tab] Error 1
Here is my make file:
CC = gcc
CFLAGS = -lreadline
PROGS = d8sh parser.tab executor lexer
all: $(PROGS)
clean:
rm -f *.o $(PROGS) *.tmp
d8sh: d8sh.o
d8sh.o: executor.h lexer.h
executor.o: command.h
lexer.o: parser.tab.h
parser.tab.o: command.h
Only d8sh.c has a main function. Can anyone figure out what the problem is?
I'm trying to build xulrunner version 2.0 (sources downloaded from mozilla ftp site) but I keep getting some undefined references when trying to create libxul.so. I tried version 10.0 but same results.
I'm building on Archlinux, but I also get the same error on Ubuntu from the VM I downloaded from mozilla site.
Prior to build xulrunner, some modifications were required in order to build:
https://hg.mozilla.org/mozilla-central/rev/effb4811409b
https://hg.mozilla.org/mozilla-central/rev/87a5ed480992
needed to create an empty /usr/include/curl/types.h file
file security/coreconf/Linux3.16.mk does not exist : copy Linux2.6.mk to Linux3.16.mk
The .mozconfig I'm using:
mk_add_options AUTOCONF=autoconf-2.13
mk_add_options PYTHON=/usr/bin/python2
mk_add_options MOZ_CO_PROJECT=xulrunner
mk_add_options MOZ_OBJDIR=#topsrcdir#/obj-xulrunner
ac_add_options --enable-application=xulrunner
ac_add_options --disable-javaxpcom
After about 30 minutes, I get these errors when trying to build libxul.so:
...
rm -f libxul.so
c++ -fno-rtti -fno-exceptions -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-invalid-offsetof -Wno-variadic-macros -Werror=return-type -pedantic -Wno-long-long -fno-strict-aliasing -fshort-wchar -pthread -pipe -DNDEBUG -DTRIMMED -Os -freorder-blocks -fomit-frame-pointer -fPIC -shared -Wl,-z,defs -Wl,-h,libxul.so -o libxul.so nsStaticXULComponents.o nsUnicharUtils.o nsBidiUtils.o nsRDFResource.o -lpthread -Wl,-rpath-link,/disk2/mozilla/buildtmp/obj-xulrunner/dist/bin -Wl,-rpath-link,/usr/local/lib -Wl,--whole-archive ../../embedding/browser/gtk/src/libgtkembedmoz.a ../../toolkit/xre/libxulapp_s.a ../../staticlib/components/libnecko.a ../../staticlib/components/libuconv.a ../../staticlib/components/libi18n.a ../../staticlib/components/libchardet.a ../../staticlib/components/libjar50.a ../../staticlib/components/libstartupcache.a ../../staticlib/components/libpref.a ../../staticlib/components/libhtmlpars.a ../../staticlib/components/libimglib2.a ../../staticlib/components/libgklayout.a ../../staticlib/components/libdocshell.a ../../staticlib/components/libembedcomponents.a ../../staticlib/components/libwebbrwsr.a ../../staticlib/components/libnsappshell.a ../../staticlib/components/libtxmgr.a ../../staticlib/components/libcommandlines.a ../../staticlib/components/libtoolkitcomps.a ../../staticlib/components/libpipboot.a ../../staticlib/components/libpipnss.a ../../staticlib/components/libappcomps.a ../../staticlib/components/libjetpack_s.a ../../staticlib/components/libjsctypes.a ../../staticlib/components/libjsperf.a ../../staticlib/components/libgkplugin.a ../../staticlib/components/libunixproxy.a ../../staticlib/components/libjsd.a ../../staticlib/components/libautoconfig.a ../../staticlib/components/libauth.a ../../staticlib/components/libcookie.a ../../staticlib/components/libpermissions.a ../../staticlib/components/libuniversalchardet.a ../../staticlib/components/libcomposer.a ../../staticlib/components/librdf.a ../../staticlib/components/libwindowds.a ../../staticlib/components/libfileview.a ../../staticlib/components/libstoragecomps.a ../../staticlib/components/libplaces.a ../../staticlib/components/libtkautocomplete.a ../../staticlib/components/libsatchel.a ../../staticlib/components/libpippki.a ../../staticlib/components/libwidget_gtk2.a ../../staticlib/components/libsystem-pref.a ../../staticlib/components/libimgicon.a ../../staticlib/components/libgkgfxthebes.a ../../staticlib/components/libaccessibility.a ../../staticlib/components/libremoteservice.a ../../staticlib/components/libspellchecker.a ../../staticlib/components/libzipwriter.a ../../staticlib/components/libservices-crypto.a ../../staticlib/libjsipc_s.a ../../staticlib/libdomipc_s.a ../../staticlib/libdomplugins_s.a ../../staticlib/libmozipc_s.a ../../staticlib/libmozipdlgen_s.a ../../staticlib/libipcshell_s.a ../../staticlib/libgfxipc_s.a ../../staticlib/libxpcom_core.a ../../staticlib/libucvutil_s.a ../../staticlib/libgkgfx.a ../../staticlib/libchromium_s.a ../../staticlib/libmozreg_s.a ../../staticlib/libmorkreader_s.a ../../staticlib/libgtkxtbin.a ../../staticlib/libthebes.a ../../staticlib/libycbcr.a ../../staticlib/libangle.a -Wl,--no-whole-archive -L../../dist/lib -lmozsqlite3 -L../../dist/bin -L../../dist/lib -L../../jpeg -lmozjpeg -L../../modules/libimg/png -lmozpng -L../../gfx/qcms -lmozqcms -L/disk2/mozilla/buildtmp/obj-xulrunner/dist/bin -ljs_static -L../../dist/bin -L../../dist/lib -lcrmf -lsmime3 -lssl3 -lnss3 -lnssutil3 -L../../gfx/cairo/cairo/src -lmozcairo -L../../gfx/cairo/libpixman/src -lmozlibpixman -lXrender -lfreetype -lfontconfig ../../gfx/harfbuzz/src/libmozharfbuzz.a ../../gfx/ots/src/libmozots.a -L../../modules/zlib/src -lmozz -lasound -lrt -L../../dist/bin -L../../dist/lib -L/disk2/mozilla/buildtmp/obj-xulrunner/dist/lib -lplds4 -lplc4 -lnspr4 -lpthread -ldl -L../../dist/lib -lmozalloc -ldbus-1 -ldbus-glib-1 -ldbus-1 -lgobject-2.0 -lglib-2.0 -lX11 -lXext -lpangoft2-1.0 -lfontconfig -lfreetype -lpangocairo-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lcairo -lgtk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lfontconfig -lfreetype -lgdk-x11-2.0 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0 -lXt -lgthread-2.0 -lfreetype -lz -lbz2 -lpng16 -lharfbuzz -ldl -lrt
../../staticlib/libthebes.a(gfxPangoFonts.o): In function `gfxDownloadedFcFontEntry::~gfxDownloadedFcFontEntry()':
gfxPangoFonts.cpp:(.text+0x1a63): undefined reference to `FT_Done_Face'
../../staticlib/libthebes.a(gfxPangoFonts.o): In function `gfxPangoFontGroup::NewFontEntry(gfxProxyFontEntry const&, unsigned char const*, unsigned int)':
gfxPangoFonts.cpp:(.text+0x3a61): undefined reference to `FT_New_Memory_Face'
../../staticlib/libthebes.a(gfxFT2Utils.o): In function `gfxFT2LockedFace::GetGlyph(unsigned int)':
gfxFT2Utils.cpp:(.text+0x6b): undefined reference to `FT_Select_Charmap'
../../staticlib/libthebes.a(gfxFT2Utils.o): In function `gfxFT2LockedFace::GetMetrics(gfxFont::Metrics*, unsigned int*)':
gfxFT2Utils.cpp:(.text+0x216): undefined reference to `FT_Get_Sfnt_Table'
gfxFT2Utils.cpp:(.text+0x450): undefined reference to `FT_Get_Sfnt_Table'
../../staticlib/libthebes.a(gfxFT2Utils.o): In function `gfxFT2LockedFace::FindCharVariantFunction()':
gfxFT2Utils.cpp:(.text+0x78e): undefined reference to `FT_Library_Version'
../../staticlib/libthebes.a(gfxFT2Utils.o): In function `gfxFT2LockedFace::GetUVSGlyph(unsigned int, unsigned int)':
gfxFT2Utils.cpp:(.text+0x84c): undefined reference to `FT_Select_Charmap'
../../staticlib/libthebes.a(gfxFT2Utils.o): In function `gfxFT2LockedFace::GetFontTable(unsigned int, FallibleTArray<unsigned char>&)':
gfxFT2Utils.cpp:(.text+0x8ba): undefined reference to `FT_Load_Sfnt_Table'
gfxFT2Utils.cpp:(.text+0x951): undefined reference to `FT_Load_Sfnt_Table'
../../gfx/cairo/cairo/src/libmozcairo.a(cairo-ft-font.o): In function `_cairo_ft_unscaled_font_map_lock':
cairo-ft-font.c:(.text+0x7c): undefined reference to `FT_Init_FreeType'
../../gfx/cairo/cairo/src/libmozcairo.a(cairo-ft-font.o): In function `_cairo_ft_unscaled_font_set_scale':
cairo-ft-font.c:(.text+0x347): undefined reference to `FT_Set_Transform'
cairo-ft-font.c:(.text+0x3af): undefined reference to `FT_Set_Char_Size'
cairo-ft-font.c:(.text+0x445): undefined reference to `FT_Set_Char_Size'
cairo-ft-font.c:(.text+0x462): undefined reference to `FT_Set_Pixel_Sizes'
../../gfx/cairo/cairo/src/libmozcairo.a(cairo-ft-font.o): In function `_cairo_ft_scaled_glyph_vertical_layout_bearing_fix':
cairo-ft-font.c:(.text+0xa25): undefined reference to `FT_Vector_Transform'
cairo-ft-font.c:(.text+0xa3a): undefined reference to `FT_Outline_Translate'
../../gfx/cairo/cairo/src/libmozcairo.a(cairo-ft-font.o): In function `_cairo_ft_unscaled_font_map_pluck_entry':
cairo-ft-font.c:(.text+0x11e9): undefined reference to `FT_Done_Face'
../../gfx/cairo/cairo/src/libmozcairo.a(cairo-ft-font.o): In function `_cairo_ft_unscaled_font_destroy':
cairo-ft-font.c:(.text+0x16ba): undefined reference to `FT_Done_Face'
../../gfx/cairo/cairo/src/libmozcairo.a(cairo-ft-font.o): In function `_cairo_ft_unscaled_font_lock_face':
cairo-ft-font.c:(.text+0x1aee): undefined reference to `FT_New_Face'
cairo-ft-font.c:(.text+0x1b11): undefined reference to `FT_Done_Face'
../../gfx/cairo/cairo/src/libmozcairo.a(cairo-ft-font.o): In function `_cairo_ft_index_to_ucs4':
cairo-ft-font.c:(.text+0x1b8c): undefined reference to `FT_Get_First_Char'
cairo-ft-font.c:(.text+0x1baf): undefined reference to `FT_Get_Next_Char'
../../gfx/cairo/cairo/src/libmozcairo.a(cairo-ft-font.o): In function `_cairo_ft_scaled_glyph_init':
cairo-ft-font.c:(.text+0x1ce6): undefined reference to `FT_Load_Glyph'
cairo-ft-font.c:(.text+0x1e9a): undefined reference to `FT_Outline_Transform'
cairo-ft-font.c:(.text+0x1eac): undefined reference to `FT_Outline_Decompose'
cairo-ft-font.c:(.text+0x2012): undefined reference to `FT_Render_Glyph'
cairo-ft-font.c:(.text+0x20ac): undefined reference to `FT_Load_Glyph'
cairo-ft-font.c:(.text+0x2114): undefined reference to `FT_GlyphSlot_Embolden'
cairo-ft-font.c:(.text+0x21f3): undefined reference to `FT_Outline_Get_CBox'
cairo-ft-font.c:(.text+0x291e): undefined reference to `FT_Outline_Transform'
cairo-ft-font.c:(.text+0x29b1): undefined reference to `FT_Outline_Translate'
cairo-ft-font.c:(.text+0x29d3): undefined reference to `FT_Outline_Get_Bitmap'
cairo-ft-font.c:(.text+0x2be4): undefined reference to `FT_GlyphSlot_Embolden'
../../gfx/cairo/cairo/src/libmozcairo.a(cairo-ft-font.o): In function `_cairo_ft_load_truetype_table':
cairo-ft-font.c:(.text+0x2d70): undefined reference to `FT_Load_Sfnt_Table'
../../gfx/cairo/cairo/src/libmozcairo.a(cairo-ft-font.o): In function `_cairo_ft_font_reset_static_data':
cairo-ft-font.c:(.text+0x358f): undefined reference to `FT_Done_FreeType'
../../gfx/cairo/cairo/src/libmozcairo.a(cairo-type1-subset.o): In function `cairo_type1_font_subset_get_glyph_names_and_widths':
cairo-type1-subset.c:(.text+0x379): undefined reference to `FT_Load_Glyph'
cairo-type1-subset.c:(.text+0x3b1): undefined reference to `FT_Get_Glyph_Name'
../../gfx/cairo/cairo/src/libmozcairo.a(cairo-type1-subset.o): In function `_cairo_type1_subset_init':
cairo-type1-subset.c:(.text+0xa8e): undefined reference to `FT_Get_PS_Font_Info'
../../gfx/cairo/cairo/src/libmozcairo.a(cairo-type1-subset.o): In function `_cairo_type1_scaled_font_is_type1':
cairo-type1-subset.c:(.text+0x1924): undefined reference to `FT_Get_PS_Font_Info'
/usr/bin/ld: libxul.so: hidden symbol `FT_Outline_Get_Bitmap' isn't defined
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
/disk2/mozilla/sources/10.0/mozilla-2.0/config/rules.mk:1291: recipe for target 'libxul.so' failed
make[4]: *** [libxul.so] Error 1
make[4]: Leaving directory '/disk2/mozilla/buildtmp/obj-xulrunner/toolkit/library'
/disk2/mozilla/sources/10.0/mozilla-2.0/config/rules.mk:783: recipe for target 'libs_tier_platform' failed
make[3]: *** [libs_tier_platform] Error 2
make[3]: Leaving directory '/disk2/mozilla/buildtmp/obj-xulrunner'
/disk2/mozilla/sources/10.0/mozilla-2.0/config/rules.mk:793: recipe for target 'tier_platform' failed
make[2]: *** [tier_platform] Error 2
make[2]: Leaving directory '/disk2/mozilla/buildtmp/obj-xulrunner'
/disk2/mozilla/sources/10.0/mozilla-2.0/config/rules.mk:746: recipe for target 'default' failed
make[1]: *** [default] Error 2
make[1]: Leaving directory '/disk2/mozilla/buildtmp/obj-xulrunner'
client.mk:345: recipe for target 'build' failed
make: *** [build] Error 2
The command line used to create libxul.so does contains the '-lfreetype', and when I look for FT_Done_Face function into libfreetype.so, it is present :
[dev400t#arch mozilla-2.0]$ nm --dynamic /usr/lib/libfreetype.so | grep FT_Done_Face
000000000001b300 T FT_Done_Face
I did add the "-Wl,-t" option to the command line to make sure libfreetype.so could be found: it is found.
What am I missing?
Your freetype2 version is >= 2.5.1. It contains this change http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=fae382076409db198dfbff36ac4cbb97b05b30a1, which is backwards-incompatible as far as Firefox is concerned.
You need to backport the fix from this bug to your source tree: https://bugzilla.mozilla.org/show_bug.cgi?id=944454 or downgrade your libfreetype2.
Firefox sources as of version 26 and later (including 24 ESR) already contain the fix.
I want to use standard c function in one of my function
void print(const char* format,...) {
char buffer[256];
va_list args;
va_start (args, format);
vsnprintf (buffer,256,format, args);
va_end (args);
sendString(buffer);
}
Error coming is
arm-none-eabi-ld -o check.elf -T /home/sanju/Arm/check/other/ROM.ld Serial.o irq.o lowlevel.o main.o startup.o \
-L/usr/arm-none-eabi/lib -lc -lg -lm
/usr/arm-none-eabi/lib/libc.a(lib_a-svfprintf.o): In function `_svfprintf_r':
vfprintf.c:(.text+0x688): undefined reference to `__aeabi_dcmplt'
vfprintf.c:(.text+0xdfc): undefined reference to `__aeabi_dcmpeq'
vfprintf.c:(.text+0x10b4): undefined reference to `__aeabi_dcmpeq'
vfprintf.c:(.text+0x168c): undefined reference to `__aeabi_uldivmod'
vfprintf.c:(.text+0x16a8): undefined reference to `__aeabi_uldivmod'
vfprintf.c:(.text+0x1a48): undefined reference to `__aeabi_dcmpeq'
vfprintf.c:(.text+0x1eac): undefined reference to `__aeabi_dcmpeq'
/usr/arm-none-eabi/lib/libc.a(lib_a-dtoa.o): In function `quorem':
dtoa.c:(.text+0x3c): undefined reference to `__aeabi_uidiv'
/usr/arm-none-eabi/lib/libc.a(lib_a-dtoa.o): In function `_dtoa_r':
dtoa.c:(.text+0x274): undefined reference to `__aeabi_dcmpeq'
dtoa.c:(.text+0x360): undefined reference to `__aeabi_ui2d'
dtoa.c:(.text+0x37c): undefined reference to `__aeabi_dsub'
dtoa.c:(.text+0x388): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0x394): undefined reference to `__aeabi_dadd'
dtoa.c:(.text+0x3a4): undefined reference to `__aeabi_i2d'
dtoa.c:(.text+0x3b0): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0x3c4): undefined reference to `__aeabi_dadd'
dtoa.c:(.text+0x3d0): undefined reference to `__aeabi_d2iz'
dtoa.c:(.text+0x3e8): undefined reference to `__aeabi_dcmplt'
dtoa.c:(.text+0x418): undefined reference to `__aeabi_dcmpgt'
dtoa.c:(.text+0x5a8): undefined reference to `__aeabi_ddiv'
dtoa.c:(.text+0x5ac): undefined reference to `__aeabi_d2iz'
dtoa.c:(.text+0x5b4): undefined reference to `__aeabi_i2d'
dtoa.c:(.text+0x5c0): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0x5d4): undefined reference to `__aeabi_dsub'
dtoa.c:(.text+0x608): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0x61c): undefined reference to `__aeabi_dcmpeq'
dtoa.c:(.text+0x650): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0x664): undefined reference to `__aeabi_dcmpeq'
dtoa.c:(.text+0x684): undefined reference to `__aeabi_ddiv'
dtoa.c:(.text+0x688): undefined reference to `__aeabi_d2iz'
dtoa.c:(.text+0x690): undefined reference to `__aeabi_i2d'
dtoa.c:(.text+0x69c): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0x6b0): undefined reference to `__aeabi_dsub'
dtoa.c:(.text+0x6fc): undefined reference to `__aeabi_dadd'
dtoa.c:(.text+0x718): undefined reference to `__aeabi_dcmplt'
dtoa.c:(.text+0x73c): undefined reference to `__aeabi_dcmpeq'
dtoa.c:(.text+0xa94): undefined reference to `__aeabi_i2d'
dtoa.c:(.text+0xaa0): undefined reference to `__aeabi_dcmpeq'
dtoa.c:(.text+0xbf8): undefined reference to `__aeabi_ddiv'
dtoa.c:(.text+0xc2c): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0xc58): undefined reference to `__aeabi_ddiv'
dtoa.c:(.text+0xc80): undefined reference to `__aeabi_dcmplt'
dtoa.c:(.text+0xc90): undefined reference to `__aeabi_i2d'
dtoa.c:(.text+0xc9c): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0xca8): undefined reference to `__aeabi_dadd'
dtoa.c:(.text+0xce8): undefined reference to `__aeabi_ddiv'
dtoa.c:(.text+0xcf4): undefined reference to `__aeabi_dsub'
dtoa.c:(.text+0xd08): undefined reference to `__aeabi_d2iz'
dtoa.c:(.text+0xd10): undefined reference to `__aeabi_i2d'
dtoa.c:(.text+0xd24): undefined reference to `__aeabi_dsub'
dtoa.c:(.text+0xd54): undefined reference to `__aeabi_dcmpgt'
dtoa.c:(.text+0xd78): undefined reference to `__aeabi_dsub'
dtoa.c:(.text+0xd8c): undefined reference to `__aeabi_dcmpgt'
dtoa.c:(.text+0xdd0): undefined reference to `__aeabi_dsub'
dtoa.c:(.text+0xddc): undefined reference to `__aeabi_dcmplt'
dtoa.c:(.text+0xe00): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0xe1c): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0xe28): undefined reference to `__aeabi_d2iz'
dtoa.c:(.text+0xe30): undefined reference to `__aeabi_i2d'
dtoa.c:(.text+0xe44): undefined reference to `__aeabi_dsub'
dtoa.c:(.text+0xe64): undefined reference to `__aeabi_dcmplt'
dtoa.c:(.text+0xef0): undefined reference to `__aeabi_i2d'
dtoa.c:(.text+0xefc): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0xf08): undefined reference to `__aeabi_dadd'
dtoa.c:(.text+0xf24): undefined reference to `__aeabi_dsub'
dtoa.c:(.text+0xf38): undefined reference to `__aeabi_dcmpgt'
dtoa.c:(.text+0xf54): undefined reference to `__aeabi_dcmplt'
dtoa.c:(.text+0x10c0): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0x10e8): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0x1130): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0x1144): undefined reference to `__aeabi_d2iz'
dtoa.c:(.text+0x114c): undefined reference to `__aeabi_i2d'
dtoa.c:(.text+0x1160): undefined reference to `__aeabi_dsub'
dtoa.c:(.text+0x119c): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0x11a8): undefined reference to `__aeabi_d2iz'
dtoa.c:(.text+0x11b0): undefined reference to `__aeabi_i2d'
dtoa.c:(.text+0x11c8): undefined reference to `__aeabi_dsub'
dtoa.c:(.text+0x1200): undefined reference to `__aeabi_dadd'
dtoa.c:(.text+0x120c): undefined reference to `__aeabi_dcmplt'
dtoa.c:(.text+0x12cc): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0x12d8): undefined reference to `__aeabi_dcmpge'
dtoa.c:(.text+0x158c): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0x159c): undefined reference to `__aeabi_i2d'
dtoa.c:(.text+0x15b0): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0x15bc): undefined reference to `__aeabi_dadd'
dtoa.c:(.text+0x15ec): undefined reference to `__aeabi_dsub'
dtoa.c:(.text+0x15f8): undefined reference to `__aeabi_dcmpgt'
/usr/arm-none-eabi/lib/libc.a(lib_a-mprec.o): In function `__ratio':
mprec.c:(.text+0xbc0): undefined reference to `__aeabi_ddiv'
/usr/arm-none-eabi/lib/libc.a(lib_a-mprec.o): In function `_mprec_log10':
mprec.c:(.text+0xbf0): undefined reference to `__aeabi_dmul'
/usr/arm-none-eabi/lib/libc.a(lib_a-svfiprintf.o): In function `_svfiprintf_r':
vfprintf.c:(.text+0xf30): undefined reference to `__aeabi_uldivmod'
vfprintf.c:(.text+0xf4c): undefined reference to `__aeabi_uldivmod'
make: *** [all] Error 1
*** Failure: Exit code 2 ***
My makefile is this
TOOLCHAIN=arm-none-eabi-
ARM_CPU=arm7tdmi
VPATH= /home/sanju/Arm/check/src /home/sanju/Arm/check/other /home/sanju/Arm/check/include
INCLUDE= /home/sanju/Arm/check/include
CCFLAGS= -mcpu=$(ARM_CPU) -mthumb-interwork -ffunction-sections -Os -Wall
ASFLAGS= -mcpu=$(ARM_CPU) -mthumb-interwork -mfpu=softfpa -Wall
all: Serial.o irq.o lowlevel.o main.o startup.o
$(TOOLCHAIN)ld -o check.elf -T /home/sanju/Arm/check/other/ROM.ld Serial.o irq.o
lowlevel.o main.o startup.o \
-L/usr/arm-none-eabi/lib -lc -lg -lm
$(TOOLCHAIN)objcopy -O ihex check.elf check.hex
$(TOOLCHAIN)objcopy -O binary check.elf check.bin
Serial.o : Serial.c Serial.h
$(TOOLCHAIN)gcc $(CCFLAGS) -I$(INCLUDE) -c $<
irq.o : irq.c irq.h lpc214x.h
$(TOOLCHAIN)gcc $(CCFLAGS) -I$(INCLUDE) -c $<
lowlevel.o : lowlevel.c lowlevel.h
$(TOOLCHAIN)gcc $(CCFLAGS) -I$(INCLUDE) -c $<
main.o : main.c lpc214x.h timer0.h Asm.h lowlevel.h type.h Serial.h
$(TOOLCHAIN)gcc $(CCFLAGS) -I$(INCLUDE) -c $<
startup.o : startup.S
$(TOOLCHAIN)as $(ASFLAGS) -o startup.o $<
.PHONY: clean
clean :
rm -rf *.o *.elf *.hex *.o *.bin
In the target all it fails in linking. I have tried the example with arm-elf toolchain there also i am getting some errors.I have googled a lot for it but did not find any solution for it.
Try using gcc as ld frontend.
Change:
$(TOOLCHAIN)ld -o check.elf [...]
into
$(TOOLCHAIN)gcc -o check.elf [...]
GCC knows to add some necessary options when invoking ld.
Do things go any better when adding "-lgcc" to -L?
instead of using ld for linking i used gcc but it was including the supplied crt.o object file so i used -nostartfiles and it worked for me.