objdump is missing from windows10 pro (msys2 installed) - mingw-w64

I have installed msys2 using chocolatey.
I have tried msys2-installer module from chocolatey too.
But I can not find objdump on my system. Should I install something more ?

MSYS2 supports three different compiler toolchains, all with their own objdump utility. I'm not sure which one you want to use, but you can just install them all by running:
sudo pacman -S binutils mingw-w64-x86_64-binutils mingw-w64-i686-binutils

Related

On el8/el9/newer, how do you get newer versions of software like python3, gcc, java, etc?

For example on el7:
to develop an nvidia CUDA application you need a newer gcc than the default gcc version 4.8.x and to get the newer version you would use a software repo called "Software Collections" (SCL)
the base python3 is 3.6 and you need newer python modules and so you install python3.8 from SCL
Starting on el8, and el9: the SCL is deprecated and so there is a different method for installing and configuring newer versions of gcc and python3.
On el8/el9/newer, how do you get newer versions of software like python3, gcc, java, etc?
in a nutshell, here are some examples for how to install and configure
for python3 to get python3.9: dnf install -y python39 && alternatives --set python3 $(command -v python3.9)
for gcc to get gcc-12: dnf install gcc-toolset-12 && source scl_source enable gcc-toolset-12
for java to get java-17: dnf install java-17 && bin_java_filename=$(rpm -qa|grep java-17|xargs rpm -ql|grep "bin\/java$"|head -1) && alternatives --set java ${bin_java_filename}
tested on rocky8, rocky9
which repo has the newer software versions?
the old method using "SCL" was deprecated
the new method is to use a repo called "appstream"
here is a post written by the distro maintainers explaining the change https://developers.redhat.com/blog/2018/11/15/rhel8-introducing-appstreams
the repo is enabled by default
how to: install newer software versions?
for python3: dnf install python39
for gcc: dnf install gcc-toolset-12
how to: change the system default?
for python3: alternatives --set python3 $(command -v python3.9)
for gcc:
edit your user .bashrc or .bash_profile or create a new file under /etc/profile.d/ with the following: source scl_source enable gcc-toolset-12
i thought scl_source would go away in el8, el9 but apparently not
for more info on scl_source go to this link https://unix.stackexchange.com/a/195219/5510 or Permanently enable RHEL scl
p.s. what is the difference between alternatives and update-alternatives?
the original tool is called update-alternatives and is from Debian linux distro
in EnterpriseLinux, Redhat rewrote the tool and called it alternatives and when you install alternatives the package also installs a symlink with name update-alternatives on your env var PATH to help you find the tool
the two are similar but not the same because their source code is different

How can I install MinGW-w64 and MSYS2?

I am trying to build some open source library. I need a package management system to easily download the dependencies. At first I am using MinGW and MSYS. But the included packages are limited. Someone told me to use Mingw-w64 and MSYS2.
I downloaded the mingw-w64-install from here. When running, it reports the following error. How can I fix it?
And by the way, from the Mingw-w64 download page, I see a lot of download links. Even Cygwin is listed. How are Cygwin and Mingw-w64 related?
My current understanding is, in the time of MinGW and MSYS, MSYS is just a nice addon to MinGW, while in Mingw-w64 + MSYS2, MSYS2 is stand-alone and Mingw-w64 is just a set of libraries it can work with. Just like Cygwin can download many different packages.
Unfortunately, the MinGW-w64 installer you used sometimes has this issue. I myself am not sure about why this happens (I think it has something to do with Sourceforge URL redirection or whatever that the installer currently can't handle properly enough).
Anyways, if you're already planning on using MSYS2, there's no need for that installer.
Download MSYS2 from this page.
After the install completes, click on the MSYS2 UCRT64 in the Start menu (or C:\msys64\ucrt64.exe).
If done correctly, the terminal prompt will say UCRT64 in magenta letters, not MSYS.
Update MSYS2 using pacman -Syuu. If it closes itself during the update, restart it and repeat the same command to finish the update.
You should routinely update your installation.
Install the toolchain: (i.e. the compiler and some extra tools)
pacman -S mingw-w64-ucrt-x86_64-toolchain
Install any libraries/tools you may need. You can search the repositories by doing
pacman -Ss name_of_something_i_want_to_install
e.g.
pacman -Ss gsl
and install using
pacman -S package_name_of_something_i_want_to_install
e.g.
pacman -S mingw-w64-ucrt-x86_64-gsl
and from then on the GSL library will be automatically found by your compiler!
Make sure any compilers and libraries you install have this package prefix: mingw-w64-ucrt-x86_64-. Only use unprefixed packages for misc command-line utilities (such as grep, sed, make, etc), unless you know what you're doing.
Verify that the compiler is working by doing
gcc --version
If you want to use the toolchains (with installed libraries) outside of the MSYS2 environment, all you need to do is add C:/msys64/ucrt64/bin to your PATH.
MSYS2 provides several compiler flavors, UCRT64 being one of them. It should be a reasonable default.
MSYS has not been updated a long time. MSYS2 is more active, and you can download it from MSYS2. It has both the mingw and cygwin fork package.
To install the MinGW-w64 toolchain (reference):
Open the MSYS2 shell from the start menu
Run pacman -Sy pacman to update the package database
Reopen the shell, and run pacman -Syu to update the package database and core system packages
Reopen the shell, and run pacman -Su to update the rest
Install the compiler:
For a 32-bit target, run pacman -S mingw-w64-i686-toolchain
For a 64-bit target, run pacman -S mingw-w64-x86_64-toolchain
Select which package to install; the default is all
You may also need make. Run pacman -S make
You can now also get the stand-alone personal build of MinGW-w64 from https://winlibs.com/ which doesn't require any installation; just extract and its ready to use. This allow having multiple toolchains on the same system (e.g., one for Windows 32-bit and another for Windows 64-bit).
The most straightforward way, as far as I know, is to use Chocolatey to install MinGW:
choco install mingw
Then check with the command whereis gcc. It is going to be installed in C:\ProgramData\chocolatey\bin.
one more thing, to get make working, just copie (or rename if you wish)
with copy mingw32-make.exe make.exe in C:\ProgramData\chocolatey\bin.

Where to download POSIX pthread?

From where I can download the POSIX pthread library? I want to use pthread for both Windows (using gcc in MingW) and Linux. I found a link in sourceforge.net but it looks it is for Windows. Any help? Thanks!
Default installation of MinGW does not include pthread library. You must install additional packages: mingw32-libpthreadgc-dll, mingw32-libpthreadgc-dev.
Do not forget to install gcc compiler. The example of compile command:
gcc file_name.c -Wall -pthread -o file_name
To install new packages, you should use console command mingw-get or GUI packet manager.
If you’re using Ubuntu, you must execute of following command:
sudo apt-get install libc6 libc6-dev -y
There isn't a specific pthread library. Posix defines the interfaces that each system library must follow. Must modern linux distros will have libpthread installed or you can download it with youre package manage. On windows In is usually better to use the windows api as there is no explicit support for pthreads.

error while loading shared libraries: libncurses.so.5:

I've installed Android Studio and tried to run my first project in it, and I've got following error:
Error Output was: /home/user/android-studio/sdk/platform-tools/adb: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
I've already tried to run
sudo ldconfig
but it doesnt help. I've recently installed libncurses (before using android studio).
What should I do?
If libncurses is not installed then install it and try again.
for 32-bit binaries : sudo apt-get install libncurses5:i386
for 64-bit binaries :
sudo apt-get install libncurses5
Also install the collection of libraries by using this command,
sudo apt-get install ia32-libs
error while loading shared libraries: libncurses.so.5
If you see this, your distro probably has a newer version of libncurse installed. First find out what version of libncurses your distro has:
$ ls -1 /usr/lib/libncurses*
/usr/lib/libncurses.so
/usr/lib/libncurses++.so
/usr/lib/libncurses++w.so
/usr/lib/libncursesw.so
/usr/lib/libncurses++w.so.6
/usr/lib/libncursesw.so.6
/usr/lib/libncurses++w.so.6.0
/usr/lib/libncursesw.so.6.0
In this case, we are dealing with version 6, so we make two symlinks:
$ sudo ln -s /usr/lib/libncursesw.so.6.0 /usr/lib/libncurses.so.5
$ sudo ln -s /usr/lib/libncursesw.so.6.0 /usr/lib/libtinfo.so.5
After this, the program should run normally.
If you are absolutely sure that libncurses, aka ncurses, is installed, as in you've done a successful 'ls' of the library, then perhaps you are running a 64 bit Linux operating system and only have the 64 bit libncurses installed, when the program that is running (adb) is 32 bit.
If so, a 32 bit program can't link to a 64 bit library (and won't locate it anyway), so you might have to install libcurses, or ncurses (32 bit version). Likewise, if you are running a 64 bit adb, perhaps your ncurses is 32 bit (a possible but less likely scenario).
For Redhat Linux 8 try this:
sudo yum install libncurses*
On Arch Linux you can install ncurses5-compat-libs AUR package.
FYI it is mentioned in Arch Wiki android page, just in case if you'll need some other dependencies for Android Studio: https://wiki.archlinux.org/index.php/Android
For Redhat Linux this helped,
sudo yum install ncurses-compat-libs
In Fedora 28 use:
sudo dnf install ncurses-compat-libs
I solved the issue using
ln -s libncursesw.so.5 /lib/x86_64-linux-gnu/libncursesw.so.6
on ubunutu 18.10
On Arch, i fix like this:
sudo ln -s /usr/lib/libncursesw.so.6 /usr/lib/libtinfo.so.6
To install ncurses-compat-libs on Fedora 24 helped me on this issue
(unable to start adb error while loading shared libraries: libncurses.so.5)
Your system likely does not provide the ncurses library at the version android studio uses. My arch linux install only had ncurses 6 but android studio needs version 5.
You could check if your distribution has a compatability package, or use the solution that Rahmat Aligos suggested.
Mixaz's above answer worked for me. However I had issues installing the package because of PGP check failures. Installing it by skipping the signature worked, you could try this :
yaourt --m-arg "--skipchecksums --skippgpcheck" -Sb <your-package>

gcc-arm-linux-gnueabi command not found

I am trying to install the gnu arm toolchain for ubuntu. I first downloaded the tar from CodeSourcery. However when I go into the bin folder, I cannot run any of the binaries. I have tried with ./ and without and putting it in the PATH and it keeps telling me "Command not Found" yet the file is there in the folder right in front of me. Then I tried sudo apt-get install gcc-arm-linux-gnueabi except after it says it has installed successfully, I cannot find it with whereis gcc-arm-linux-gnueabi. Can anyone help?
fixed, using:
sudo apt-get install gcc-arm*
Are you compiling on a 64-bit OS? Try:
sudo apt-get install ia32-libs
I had the same problem when trying to compile the Raspberry Pi kernel. I was cross-compiling on Ubuntu 12.04 64-bit and the toolchain requires ia32-libs to work on on a 64-bit system.
See http://hertaville.com/2012/09/28/development-environment-raspberry-pi-cross-compiler/
CodeSourcery convention is to use prefix arm-none-linux-gnueabi- for all executables, not gcc-arm-linux-gnueabi that you mention. So, standard name for CodeSourcery gcc would be arm-none-linux-gnueabi-gcc.
After you have installed CodeSourcery G++, you need to add CodeSourcery directory into your PATH.
Typically, I prefer to install CodeSourcery into directory like /opt/arm-2010q1 or something like that. If you don't know where you have installed it, you can find it using locate arm-none-linux-gnueabi-gcc, however you may need to force to update your locate db using sudo updatedb before locate will work properly.
After you have identified where your CodeSourcery is installed, add it your PATH by editing ~/.bashrc like this:
PATH=/opt/arm-2010q1/bin:$PATH
Also, it is customary and very convenient to define
CROSS_COMPILE=arm-none-linux-gnueabi-
in your .bashrc, because with CROSS_COMPILE defined, most tools will automatically use proper compiler for ARM compilation without you doing anything.
if you are on 64 bit os then you need to install this additional libraries.
sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0
got the same error when trying to cross compile the raspberry pi kernel on ubunto 14.04.03 64bit under VM. the solution was found here:
-Install packages used for cross compiling on the Ubuntu box.
sudo apt-get install gcc-arm-linux-gnueabi make git-core ncurses-dev
-Download the toolchain
cd ~
git clone https://github.com/raspberrypi/tools
-Add the toolchain to your path
PATH=$PATH:~/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian:~/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin
notice the x64 version in the path command
I was also facing the same issue and resolved it after installing the following dependency:
sudo apt-get install lib32z1-dev
If you are on a 64bit build of ubuntu or debian (see e.g. 'cat /proc/version') you should simply use the 64bit cross compilers, if you cloned
git clone https://github.com/raspberrypi/tools
then the 64bit tools are in
tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64
use that directory for the gcc-toolchain.
A useful tutorial for compiling that I followed is available here Building and compiling Raspberry PI Kernel (use the -x64 path from above as ${CCPREFIX})
You have installed a toolchain which was compiled for i686 on a box which is running an x86_64 userland.
Use an i686 VM.
Its a bit counter-intuitive. The toolchain is called gcc-arm-linux-gnueabi. To invoke the tools execute the following: arm-linux-gnueabi-xxx
where xxx is gcc or ar or ld, etc
try the following command:
which gcc-arm-linux-gnueabi
Its very likely the command is installed in /usr/bin.
I had to cross compile C code in Ubuntu for ARM. This worked for me:
$ sudo apt install gcc-arm-none-eabi
Later, tested it on the qemu emulator
#Install qemu
sudo apt-get install qemu qemu-user-static qemu-system-arm
#Cross compile "helloworld.c"
$ arm-none-eabi-gcc --specs=rdimon.specs -Wl,--start-group -lgcc -lc -lm -lrdimon -Wl,--end-group helloworld.c -o helloworld
#Run
qemu-arm-static helloworld

Resources