how to compile nats in windows using mingw32? - cygwin

Requirement
need to generate libnats_static.a using Mingw32-gcc as we are using Mingw32-gcc while linking.
steps followed
set environment variables to use MinGW32 compilers.
a.set CC=C:/MinGW/bin/mingw32-gcc
b.set CXX=c:/MinGW/bin/mingw32-g++
cmake .. -DNATS_BUILD_WITH_TLS=OFF -DNATS_BUILD_STREAMING=OFF -G "MinGW Makefiles"
make -j20
cmake successfully created Makefiles
compilation failed for make command
strong text

Related

Aseprite ninja build error "cannot find -lSKIA_OPENGL_LIBRARY-NOTFOUND"

While trying to build Aseprite on Debian 10 (amd64) virtualbox VM, after building Skia, the ninja aseprite command returns the error:
/usr/bin/ld: cannot find -lSKIA_OPENGL_LIBRARY-NOTFOUND
[1/1] Linking CXX executable bin/aseprite
FAILED: bin/aseprite
: && /usr/bin/c++ -Wall -Wno-switch -O2 -g -DNDEBUG src/CMakeFiles/aseprite.dir/main/main.cpp.o -o bin/aseprite lib/libapp-lib.a lib/libclip.a -lxcb -lpthread lib/libdio-lib.a lib/libfilters-lib.a lib/libflic-lib.a lib/libtga-lib.a lib/librender-lib.a lib/libdoc-lib.a lib/libfixmath-lib.a lib/libui-lib.a lib/liblaf-os.a lib/liblaf-gfx.a lib/liblaf-ft.a /root/deps/skia/out/Release-x64/libskia.a -lSKIA_OPENGL_LIBRARY-NOTFOUND /usr/lib/x86_64-linux-gnu/libfontconfig.so /usr/lib/x86_64-linux-gnu/libX11.so /usr/lib/x86_64-linux-gnu/libXext.so /usr/lib/x86_64-linux-gnu/libXcursor.so /root/deps/skia/out/Release-x64/libskshaper.a lib/libobs.a lib/libundo.a lib/libcmark.a lib/libjpeg.a lib/libgiflib.a lib/libwebpdemux.a lib/libwebpmux.a lib/libwebp.a -lpthread -lm lib/libfreetype.a lib/libharfbuzz.a lib/libfreetype.a lib/libharfbuzz.a lib/libpng16.a -lm lib/libjson11.a lib/libarchive.a /usr/lib/x86_64-linux-gnu/libcrypto.so /usr/lib/x86_64-linux-gnu/libexpat.so /usr/lib/x86_64-linux-gnu/libssl.so lib/libfmt.a lib/libtinyexpr.a lib/liblauxlib.a lib/liblua.a lib/liblualib.a lib/libupdater-lib.a lib/libcfg-lib.a lib/libver-lib.a lib/libtinyxml.a lib/libnet-lib.a lib/liblaf-base.a lib/libmodpbase64.a /usr/lib/x86_64-linux-gnu/libdl.so lib/libcurl.a lib/libz.a -ldl && :
/usr/bin/ld: cannot find -lSKIA_OPENGL_LIBRARY-NOTFOUND
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
How may I solve this?
It appears that CMake is looking for OpenGL and failing... Aseprite doesn't seem to use OpenGL anyway, so disabling that altogether by clearing the cache variable SKIA_OPENGL_LIBRARY should work:
cd aseprite/build
cmake -DSKIA_OPENGL_LIBRARY="" ..
ninja aseprite
I have tested it on Windows, but I'm not entirely sure if it will work on Linux...
For anyone still looking for an answer to this. I got it to build on Ubuntu 20.04.
Follow the instructions to build skia over at the skia git repository. Make a note of which folder you cloned the repository into, you will need it later. I tried using the pre-built binaries but I must have been doing something wrong and could just never get it work.
When the build is complete you will see a note about 32-byte alignment, and if you check the out\Release-x64 folder you will see a libskia.a file. Now you know that skia was built succesfully.
Install the aseprite linux build dependencies with sudo apt-get install -y g++ cmake ninja-build libx11-dev libxcursor-dev libxi-dev libgl1-mesa-dev libfontconfig1-dev. You will find these instructions at the aseprite git repository.
Follow the instruction further down that page for the linux install but pay attention to the parameters you need to change regarding the location of that libskia.a file mentioned in point 2.
Before you start building (and why you're here) you need to enter #Ben_'s command given above to unlink the dependency to OPENGL (cmake -DSKIA_OPENGL_LIBRARY="" ..)
Now proceed to build aseprite with as the rest of the build instructions given on its repo page with ninja aseprite
Now go to aseprite/build/bin and find the aseprite executable.
You can copy this bin folder to another folder, and run aseprite from there. You can then delete all of the sources you downloaded.
There will be a bunch of errors during the python step, and you'll notice it complains about not being able to find some repositories, I think common.git is one of them. You may safely ignore this warning.
If you want to keep supporting development of the application I do recommend you spend whatever it costs for a license (but it's totally legal to build your own copy like this).

How to cross-compile Rust code for the Raspberry Pi Zero W

I am attempting to cross-compile Rust code on my 64-bit x86 laptop to run on the Raspberry Pi Zero W. I installed the arm-unknown-linux-gnueabihf toolchain using Rustup, but when I run cargo build --target arm-unknown-linux-gnueabihf, I get this error:
Internal error occurred: Failed to find tool. Is arm-linux-gnueabihf-gcc installed?
I tried to install the arm-linux-gnueabihf-gcc package from AUR, but that kept failing because of some sort of GPG key error, so I just decided to make my own cross-compiler using crosstool-ng.
I tried to point Cargo at my newly built cross-compiler using a ~/.cargo/config file:
[target.arm-unknown-linux-gnueabihf]
linker = "/home/ibi/x-tools/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-gcc"
But Cargo seems to be ignoring this and giving me the same error. How do I fix this?
It worked when I set an environment variable:
$ export CC="/home/ibi/x-tools/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-gcc"

How to compile c++ programs in the new c++ driver provided by Datastax in Linux

I am new to Cassandra. I installed c++ driver from Datastax. Can some one please provide me the steps like in which path I have to create the ā€˜.cā€™ file and how I can compile it. I can see some example programs in example folder. Can anyone plz tell me how to compile the example programs.
The cpp-driver uses cmake and depends on libuv. So the first steps would be to ensure you have cmake installed as well as libuv. Depending on your linux distribution it may be as simple as using package manager like apt or yum (i.e. sudo apt-get install cmake libuv-dev)
Building is just a matter of running the following steps in the cpp-driver directory:
cmake .
make
sudo make install
This will install libcassandra.so to somewhere in your lib path. You can then link by providing '-lcassandra' in your parameters to clang or gcc (i.e. clang myfile.c -o myfile -lcassandra)
There is very comprehensive documentation on building from source here.

How do I install dependencies when cross compiling haskell code?

I've successfully created a ghc cross compiler, that allows me to compile haskell code for armv6h (raspberry pi in my case) from my x64 linux machine.
I've successfully run a hello world program on the raspberry.
No I want to build my real app, which has a lot of dependencies on other haskell modules.
When I compile for x64 I simply do
cabal install dependenciy1 depenency2 ...
I know I could make my own programm a cabal-project an automate this step. But that's not the point here.
When I try to use the cross-compiler
arm-unknown-linux-gnueabi-ghc --make myapp.hs
It tells me about modules it could not find. Of course, they are not installed!
I read https://ghc.haskell.org/trac/ghc/wiki/Building/CrossCompiling
and according to that I tried
cabal --with-ghc=arm-unknown-linux-gnueabi-ghc --with-ghc-pkg=arm-unknown-linux-gnueabi-ghc-pkg --with-ld=arm-unknown-linux-gnueabi-ld install random
random is the depenency I'm trying to install here. I get the following error:
Resolving dependencies...
Configuring random-1.0.1.3...
Failed to install random-1.0.1.3
Last 10 lines of the build log ( /home/daniel/.cabal/logs/random-1.0.1.3.log ):
/home/daniel/.cabal/setup-exe-cache/setup-Cabal-1.18.1.3-arm-linux-ghc-7.8.3.20140804: /home/daniel/.cabal/setup-exe-cache/setup-Cabal-1.18.1.3-arm-linux-ghc-7.8.3.20140804: cannot execute binary file
cabal: Error: some packages failed to install:
random-1.0.1.3 failed during the configure step. The exception was:
ExitFailure 126
When I do
file /home/daniel/.cabal/setup-exe-cache/setup-Cabal-1.18.1.3-arm-linux-ghc-7.8.3.20140804
I get
/home/daniel/.cabal/setup-exe-cache/setup-Cabal-1.18.1.3-arm-linux-ghc-7.8.3.20140804: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 3.10.2, not stripped
No wonder it can't execute it. It's compiled for arm.
Am I missing something here?
My goal is to pull in all dependencies, then create a statically linked app that I can deploy on my raspberry.
To understand this error, you need to know how cabal install works internally. In essence, it will perform the following steps:
Download and unpack the source code
Compile Setup.hs (this file is used for customization of the build system, for example, you can implement some hooks to run additional haskell code in the configure phase).
Run setup configure <configure flags> && setup build && setup install
The problem is now that cabal install uses the GHC given by --with-ghc also for step 2, but the executable produced by that step must run on the host system!
A workaround is to do the steps manually, which means you have full control. First, get the source:
$ cabal get random
Downloading random-1.0.1.3...
Unpacking to random-1.0.1.3/
$ cd random-1.0.1.3
Then, compile Setup.hs, using the host ghc:
$ ghc ./Setup.hs -o setup
And finally, configure, build and install. As suggested by #Yuras in a comment, we also add the -x option for running hsc2hs:
$ ./setup configure ----with-ghc=arm-unknown-linux-gnueabi-ghc --with-ghc-pkg=arm-unknown-linux-gnueabi-ghc-pkg --with-ld=arm-unknown-linux-gnueabi-ld --hsc2hs-options=-x
$ ./setup build && ./setup install
There is already a cabal issue about this: https://github.com/haskell/cabal/issues/2085

Cross compile a library --- curlpp

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.

Resources