Subject: Re: problem using gcc-core for compile qemu
From: Brian Inglis <[email-masked]>
To: "[email-masked]" <[email-masked]>
Date: Fri, 8 Jan 2021 15:33:33 -0700
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>

On 2021-01-08 13:54, juan carlos rebate rodriguez via Cygwin wrote:
> El vie, 08-01-2021 a las 08:42 +0000, Arthur Norman escribió:
>>> I can't use virtualbox because what I need is to emulate the aarch64 
>>> architecture, I don't want to use binaries compiled by others, one of
>>> the reasons is that those binaries don't include sd-card emulation 
>>> support...
>> This is perhaps an off-topic response as regards compiling things on 
>> cygwin, but some while back I found a range of sets of instructions for 
>> setting up aarch64 emulation in qemu. When I had any issues running on 
>> Windows I just used virtualbox to give myself an x86_64 Linux world and 
>> installed qemu there. And after a while I could buy a Raspberry pi with a 
>> 64-bit cpu and use that, so these days working with aarch64 (and an SD 
>> card) works best for me on an rpi4 not via emulation. But to find people 
>> who have worked on adapting and setting up qemu to support aarch64 with an 
>> SD card you might find it useful to follow the footsteps of those who were 
>> working towards rpi 64-bit support?
>> And I like and use cygwin for most of what I do, but when something I want 
>> to do is better supported by Linux then setting up an Ubuntu via virtualbox
>> uses some disc space but does not add much overhead on my main W10 machine
>> and lets me build, test and debug there because following a path that is
>> already well trodden is often easiest!

> I think I expressed myself incorrectly or I am not able to be
> understood, no matter what package I choose. gcc-core does not compile
> using the cygwin dll, the one that compiles for that library is cygwin-
> gcc.

Packages gcc-core/g++ are the Cygwin native compilers for the architecture you 
are running the compiler on and uses the Cygwin native DLL.
Packages cygwin32/64-gcc-core/g++ are the Cygwin cross-compilers for the 
architecture you are not running the compiler on and uses the Cygwin DLL for the 
other architecture.
Packages mingw64-i686/x86_64-gcc-core/g++ are the Cygwin cross-compilers for 
each of the Windows architecture runtimes and use only 
mingw64-i686/x86_64-lib... libraries and Windows native DLLs including msvcrt.dll.

> now I will try to explain my case better,
> 1 when I use the gcc-core package if it is able to detect the whole
> set, the only thing that happens is that the script does not recognize
> cygwin nt as a valid operating system.
> 2 when I use the mingw64-x86_64-gcc package it is not able to compile
> without add-ons.

Most complex packages have dependencies on (many) libraries: Cygwin supports 402 
mingw64 development library packages for each architecture, which are used to 
build its own Windows native utilities such as setup-x86/_64, cygcheck, 
cygwin-console-helper, ldh, strace, and the cygwin1.dll itself, which do not 
depend on any Cygwin DLLs e.g.

$ cygcheck `cygpath -m /setup`
C:\...\setup-x86_64.exe
   C:\Windows\system32\ADVAPI32.dll
     C:\Windows\system32\msvcrt.dll
       C:\Windows\system32\ntdll.dll
       C:\Windows\system32\KERNELBASE.dll
     C:\Windows\system32\SECHOST.dll
       C:\Windows\system32\RPCRT4.dll
     C:\Windows\system32\KERNEL32.dll
   C:\Windows\system32\COMCTL32.dll
     C:\Windows\system32\GDI32.dll
       C:\Windows\system32\win32u.dll
     C:\Windows\system32\USER32.dll
   C:\Windows\system32\ole32.dll
     C:\Windows\system32\combase.dll
       C:\Windows\system32\bcryptPrimitives.dll
   C:\Windows\system32\PSAPI.DLL
   C:\Windows\system32\SHELL32.dll
   C:\Windows\system32\SHLWAPI.dll
   C:\Windows\system32\WININET.dll
   C:\Windows\system32\WS2_32.dll
$ cygcheck cygcheck
Found: C:\...\cygwin64\bin\cygcheck.exe
C:\...\cygwin64\bin\cygcheck.exe
   C:\Windows\system32\ADVAPI32.dll
     C:\Windows\system32\msvcrt.dll
       C:\Windows\system32\ntdll.dll
       C:\Windows\system32\KERNELBASE.dll
     C:\Windows\system32\SECHOST.dll
       C:\Windows\system32\RPCRT4.dll
     C:\Windows\system32\KERNEL32.dll
   C:\Windows\system32\PSAPI.DLL
   C:\Windows\system32\USER32.dll
     C:\Windows\system32\win32u.dll
     C:\Windows\system32\GDI32.dll
   C:\Windows\system32\WININET.dll

> for example when I compile with gcc-core if it is able to detect the
> libcaca-devel library, this is the library that qemu asks me for sd-
> card support,

I don't think that is the required library for that function:

$ cygcheck -p libcaca-devel
Found 3 matches for libcaca-devel
libcaca-devel-0.99beta19-?: Color ASCII art library (C development) (installed 
binaries and support files)
...

SD card support requires a hardware device driver and typically a filesystem 
driver in the OS e.g. for FAT, NTFS, CD/DVD, or as utilities for foreign 
filesystems e.g. /usr/sbin/mke2fs, resize2fs, tune2fs, dumpe2fs, e2freefrag, 
e2image, e2fsck, etc. in packages e2fsprogs and e2fsimage.

Cygwin lib...-devel packages are for Cygwin native development with the Cygwin 
native libraries, toolchain, and utilities.

> However, when I use the package mingw64-x86_64-gcc it is not able to
> find it in the system because it is not in its set, for this it is
> mandatory to use the gcc-core package (not cygwin-gcc), I do not want
> to use linux, I want to keep him as far away from my team as possible,
> just because I work for him doesn't mean I want him

You have to install all the required and dependent library packages for that 
cross-compiler architecture e.g. mingw64-<arch>-libcaca-0.99beta19-1 library 
packages:

$ cygcheck -p mingw64-.*libcaca
Found 4 matches for mingw64-.*libcaca
mingw64-i686-libcaca-0.99.beta19-1-src - mingw64-i686-libcaca-src: Color ASCII 
art library for Win32 toolchain (source)
mingw64-i686-libcaca-0.99.beta19-1 - mingw64-i686-libcaca: Color ASCII art 
library for Win32 toolchain (installed binaries and support files)
mingw64-x86_64-libcaca-0.99.beta19-1-src - mingw64-x86_64-libcaca-src: Color 
ASCII art library for Win64 toolchain (source)
mingw64-x86_64-libcaca-0.99.beta19-1 - mingw64-x86_64-libcaca: Color ASCII art 
library for Win64 toolchain (installed binaries and support files)

to allow your package to build.

If required or dependent library packages are not already available in Cygwin, 
you will have to build them using the cross-compiler toolchain and install them 
for use by your package build.

The Cygwin package build utility cygport can help you more easily build Cygwin 
packages, including mingw64 using cross-compiler toolchains, given a URL for the 
upstream source package, and a list of Cygwin required or dependent library, 
toolchain, and utility packages needed (it checks they are all available before 
building).

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]
--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple