Cross compile static libnuma for arm - makefile

I'm trying to cross compile libnuma for arm arch. In process of compiling i am facing below issue while generating libnuma.so file.
arm-linux-gnueabi-gcc -static -Wl,-soname=libnuma.so.1 -Wl,--version-script,versions.ldscript -Wl,-init,numa_init -o libnuma.so.1 libnuma.o syscall.o distance.o
/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/lib/../lib/crt1.o: In function _start':
(.text+0x34): undefined reference tomain'
collect2: error: ld returned 1 exit status
make: *** [libnuma.so.1] Error 1
Can anyone please tell me how to overcome out of this issue inorder to generate static library?

Related

How to rebuild libiberty.a with -fPIC flag

I've getting the following linking error while compiling mlpack:
[ 37%] Linking CXX shared library ../../lib/libmlpack.so
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../lib/libiberty.a(cplus-dem.o): warning: relocation against `libiberty_demanglers' in read-only section `.text'
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../lib/libiberty.a(cp-demangle.o): relocation R_X86_64_PC32 against symbol `cplus_demangle_builtin_types' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[2]: *** [src/mlpack/CMakeFiles/mlpack.dir/build.make:1040: lib/libmlpack.so.3.4] Error 1
make[1]: *** [CMakeFiles/Makefile2:2106: src/mlpack/CMakeFiles/mlpack.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
It seems I need to recompile libiberty.a library with -fPIC flag. How do I do that?
I found this bug report on the issue. In my case I was able to fix things by downgrading a few packages (as described in the report):
binutils 2.36.1-3
gcc 11.1.0-3
gcc-libs 11.1.0-3
gcc fortran-11.1.0-3
Ultimately this should be resolved when binutils gets updated.

g++ compiling error: /bin/ld: Invalid BFD target 'maxdata:0x80000000'

We are migrating some very simple C++ programs from AIX Server to Linux. The code is compiling fine on AIX server.
I tried to compile the C++ code in the Linux server. But the command line below failed:
g++ map2key.cpp -o map2key -nodefaultlibs -lstdc++ -lm -lgcc_s -lc -Xlinker -bmaxdata:0x8000000
With the error message:
/bin/ld: invalid BFD target `maxdata:0x80000000'
collect2: error: ld returned 1 exit status
The C++ program should be compiled and executable file should be generated
If you can help, I would very much appreciate it.

Library not found for -lSystem in GNU fortran

I am using GNU fortran compiler and I am compiling the code using command prompt in MacOS. I am getting an error which says that the
ld: library not found for -lSystem
collect2: error: ld returned 1 exit status
I have tried reinstalling the xcode and it did not work
gfortran -o executable try.o
Should be getting an executable file

Error: recompile with -fpic when try to install Armadillo

I was trying to install Armadillo in my Ubuntu 14.04.
I run cmake . command in the terminal at the folder where the Armadillo files are located and then run make command. I got the following errors.
/usr/bin/ld: /usr/local/lib/libsuperlu.a(util.c.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object;
recompile with -fPIC
/usr/local/lib/libsuperlu.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [libarmadillo.so.7.800.1] Error 1
make[1]: *** [CMakeFiles/armadillo.dir/all] Error 2
make: *** [all] Error 2
How can I rectify this?
The library at /usr/local/lib/libsuperlu.a on your system was most likely not built with -fPIC and you are presumably trying to build a shared library that uses code from libsuperlu.a. If this is your situation, then the compiler is telling you that the code in libsuperlu.a is not relocatable, but your shared library needs it to be. You will need to build your own libsuperlu.a and ensure that all of its object files are compiled with the -fPIC flag, since the libsuperlu.a you currently have installed in /usr/local/lib won't work for you.

qt3d library Cross compilation linking error

I want to crosscompile qt3d library example hardware AM3355 starter kit but I get following error
[linux-devkit]:~/Documents/qt3d/examples/quick3d/monkeygod> qmake-qt4
[linux-devkit]:~/Documents/qt3d/examples/quick3d/monkeygod> make
arm-linux-gnueabihf-g++
--sysroot=/home/deep/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/armv7ahf-vfp-neon-3.2-oe-linux-gnueabi
-Wl,-rpath-link,/home/deep/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/armv7ahf-vfp-neon-3.2-oe-linux-gnueabi/usr/lib
-o ../../../bin/monkeygod main.o -L/home/deep/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/armv7ahf-vfp-neon-3.2-oe-linux-gnueabi/usr/lib
-lQt3DE -lQt3DQuickE -lQtDeclarativeE -lQtScriptE -lQtSvgE -lQtSqlE -lQtXmlPatternsE -lQtOpenGLE -lQtGuiE -lQtNetworkE -lQtCoreE -lEGL -lGLESv2 -lGLES_CM -lIMGegl -lsrv_um -lpthread /home/deep/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin/../lib/gcc/arm-linux-gnueabihf/4.7.3/../../../../arm-linux-gnueabihf/bin/ld:
cannot find -lQt3DE
/home/deep/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin/../lib/gcc/arm-linux-gnueabihf/4.7.3/../../../../arm-linux-gnueabihf/bin/ld:
cannot find -lQt3DQuickE collect2: error: ld returned 1 exit status
make: *** [../../../bin/monkeygod] Error 1
can any one please help me out of this?

Resources