I have written a program using curlpp and run succesfully on intel machine.
And now I want to compile it using a arm compiler called arm-linux-g++
What I need to do is recompile the library curlpp using the arm compiler. But it is weird that the there are .a , .la file in output ,but .so file is missing!
Here is my step:
1.recompile curl
./configure --host=arm-linux --prefix=/root/curl/build/target/
make
make install
2.recompile curlpp
env CPPFLAGS="-I/root/curl/build/target/include" LDFLAGS="-
L/root/curl/build/target/lib" ./configure --host=arm-linux --prefix=/root/curlpp/build/target --build=i586
make
make install
3. move /root/curlpp/build/target/,root/curl/build/target/ to /root/usr/local/
4. compile my program
arm-linux-g++ -I/root/usr/local/include -L/root/usr/local/lib abc.cpp -lcurlpp -o abc
And compiler complains that lcurlpp can't find (since .so file is
missing)
Please teach me how to compile in using cross-compiler.
Thank you very much.
Related
I am trying to compile the GNU binutils for PowerPc on my x86-64 Pc. I'm not trying to cross compile them (got the cross compiler version from the AUR), I'm trying to compile the on my pc to use them on the other(It has no network etc just an SD-card). Anyways I have downloaded the tar file and tried to run ./configure but I wasn't sure what options to use and couldn't any proper documentation... For example what to I need to set $CC to the powerpc-linux-gnu-gcc compiler or do i need to set this as $CC_FOR_TARGET or both idk. I found out --prefix is the output output folder but idk anything else. Pl help
Cross compiling can be difficult if you are not familiar with the process. I'd recommend Debian and Ubuntu as they have a very good set of cross compilers prepackaged you can get with apt install gcc-powerpc64le-linux-gnu.
Alternatively, you can download cross compilers from: https://toolchains.bootlin.com/
There is information about the config options available by running ./configure --help
The relevant option in this situation is:
--host=HOST cross-compile to build programs to run on HOST [BUILD]
For 32bit ppc:
./configure --host=powerpc-linux-gnu
Hi, All
I am currently installing the openmpi-4.1.1 on ubuntu18.04 from the tar.gz file.
However, when I use the nvcc (CUDA 11.2.2) compiler with -lmpi_cxx, it reports that this linking option does not exist.
is there anything wrong when I am building and installing the openmpi?
I use the following commands when building openmpi with CUDA-aware capability.
./configure --with-cuda
make -j8 install
I try to remove -lmpi_cxx and only keep -lmpi, the compiler reports errors like
undefined reference to `MPI::Comm::Comm()'
Thanks a lot!
I just figure this out by myself.
I need to enable the c++ binding of the MPI when building the openmpi.
Here are the commands
./configure --enable-mpi-cxx --with-cuda
make all install
I have a prepared a minimal Cmake project containing one cpp file which represent the main and one cpp file which represent the shared library, that prints basically hello world.
https://github.com/courteous/wasmELF.git
The target is to compile this miniaml code with emscripten/clang only and produce
1) one WebAssembly (wasm) binary module version 0x1 (MVP)
2) one ELF 64-bit LSB
without clearing the cmake build directory and rebuilding it again.
Currently i can successfully produce them bought by running the commands
emconfigure cmake ../ -DCMAKE_BUILD_TYPE=WASM
make
and
cmake ../ -DCMAKE_BUILD_TYPE=Linux
make
However the problem is that in order to do that i need to compile the first one with Clang the to remove the build and then to do a second compilation with GCC. I would like Emscripten/Clang to produce them bought instead. I do not want to delete the build directory since the compilation times is taking too long. (Well not in this Project but imagine if the project was much larger)
What i see is that emscripten/clang selects always a target "wasm32-unknown-emscripten"
clang++ -target wasm32-unknown-emscripten
and if i understand that correctly the target should change
I do see that the project is producing LLVM IR bitcode since i have send the flag "flto"
i.e.
file TestSharedClass.cpp.o
TestSharedClass.cpp.o: LLVM IR bitcode
and in the CMakeLists.txt
set(CMAKE_CXX_FLAGS "-flto")
x86_64-unknown-linux-gnu is a supported target by emscripten/Clang
~/Projects/emscripten/emsdk/upstream/bin$ ./llc --version
LLVM (http://llvm.org/):
LLVM version 11.0.0git
Optimized build with assertions.
Default target: x86_64-unknown-linux-gnu
Host CPU: haswell
Registered Targets:
wasm32 - WebAssembly 32-bit
wasm64 - WebAssembly 64-bit
x86 - 32-bit X86: Pentium-Pro and above
x86-64 - 64-bit X86: EM64T and AMD64
In cmake i do have
SET(TARGET x86_64-unknown-linux-gnu)
however when i run
emconfigure cmake ../ -DCMAKE_BUILD_TYPE=Linux
make
i get mainTestFile.js and mainTestFile.wasm instead of ELF 64-bitcode.
what i am doing wrong here. How to tell clang to product once ELF and once wasm from the same code run without having to clear the build directory. This should be possible since clang is producing LLVM IR bitcode. Or do i understand that wrong?
https://github.com/emscripten-core/emscripten/issues/10361
OK that seems to not be possible i.e. the reply from the dev on github states that emcc or emmake can not be used with another target other then wasm32-unknown-emscripten.
I am trying to compile GCC from source. After make finishes, I could not find the GCC binary executable. Here is the configure command I used:
../gcc-svn/configure --prefix=/home/user/Documents/mygcc
Here are my questions specifically:
What should I expect make install does?
Is make install going to do more compilation or just moves some files to ~/Documents/mygcc? If it is the latter where the GCC executable resides?
Any other directory in my system also get affected by make install?
Thank you in advance.
I've installed Swift lang for Linux (Ubuntu) and it works fine. For example:
print("Hello World")
To run it:
./swift hi.swift
My question is, is it possible to generate a native executable code for it? How?
Listing the executable files in the Swift directory, it has swiftc. It generates a native executable binary by command:
swiftc hi.swift -o hi
./hi
In addition to swiftc, one can also generate native executables by using the Swift build system, which is described at
https://swift.org/getting-started/#using-the-build-system
Using the build system, one can easily build native executables from multiple source files, while swiftc is a convenient way to build an executable from a single source file.
Please note that you also need to install Clang if you want to create native executables with Swift. Clang is not needed to run the swift command interactively or to run a .swift file. Interestingly, installing GCC (including g++) and creating symlink clang++ to g++ does allow swiftrc to build an executable. This also enables swift build to work. At least it is true for very simple programs. However, this is not a "blessed" way. Apple docs at swift.org say that Clang is needed.