How to list supported USE flags for virtual package before installation? - gentoo

How to check what USE flags are supported for a virtual package pointing to my package, before installing it?

Try equery uses <package-name>

Virtual packages are somewhat unique in that most of them do not have USE flags. A handful do, and for those equery uses <package> will show their USE flags (i.e. equery uses virtual/pypy).
For the typical virtual package with no USE flags, the USE flags depend on which package is used to satisfy the virtual, for example virtual/commonlisp:
% equery use virtual/commonlisp
!!! No USE flags found for virtual/commonlisp-0
In this case, you would need to look at what packages could satisfy the virtual, to do this you can use equery depgraph:
% equery depgraph commonlisp
* Searching for commonlisp ...
* dependency graph for virtual/commonlisp-0
`-- virtual/commonlisp-0 amd64
`-- dev-lisp/sbcl-1.3.12 (dev-lisp/sbcl) ~amd64
`-- dev-lisp/clisp-2.49-r100 (dev-lisp/clisp) ~amd64
`-- dev-lisp/clozurecl-1.11-r1 (dev-lisp/clozurecl) ~amd64
`-- dev-lisp/cmucl-21a (dev-lisp/cmucl) [missing keyword]
`-- dev-lisp/ecls-16.1.3 (dev-lisp/ecls) ~amd64
[ virtual/commonlisp-0 stats: packages (6), max depth (1) ]
If you try to emerge a virtual, it will select the first in the list, for example:
% emerge -pv 'virtual/cdrtools' && equery depgraph 'virtual/cdrtools'
These are the packages that would be merged, in order:
Calculating dependencies... done!
[ebuild N ] app-cdr/cdrtools-3.02_alpha06-r1::gentoo USE="acl caps filecaps nls unicode" 2,069 KiB
[ebuild N ] virtual/cdrtools-0::gentoo 0 KiB
Total: 2 packages (2 new), Size of downloads: 2,069 KiB
* Searching for cdrtools in virtual ...
* dependency graph for virtual/cdrtools-0
`-- virtual/cdrtools-0 amd64
`-- app-cdr/cdrtools-3.02_alpha06-r1 (app-cdr/cdrtools) ~amd64
`-- app-cdr/cdrkit-1.1.11-r2 (app-cdr/cdrkit) amd64
[ virtual/cdrtools-0 stats: packages (3), max depth (1) ]
In my current portage tree, I only see 59 of 452 virtuals with USE flags. To arrive at this conclusion I counted how many ebuilds in /usr/portage/virtual did not have IUSE="" with grep -r 'IUSE' /usr/portage/virtual | grep 'ebuild' | egrep -v 'IUSE=""' | wc -l, then I counted how many ebuilds specified IUSE at all: grep -r 'IUSE' /usr/portage/virtual | grep 'ebuild' | wc -l.

eix -A virtual -s wine
or
equery uses virtual/wine

Related

Print a list of all available Debian source packages

For Debian(-like) distributions, the following command prints a list of all binary packages available through /etc/apt/sources.list and /etc/apt/sources.list.d/*:
$ apt-cache search .
How can I obtain a similar list of all available source packages? I know that I can find the source package name of a binary package with:
$ apt-get source -s <binary-package-name> | sed -ne 's/^Fetch source //p'
So I certainly could generate the list of all available source packages with something like:
#!/bin/bash
(
LANG=C
IFS=$'\n'
for i in $(apt-cache search .); do
apt-get source -s ${i%% *} | sed -ne 's/^Fetch source //p'
done
) | sort -u
But this is really slow.

cmake installation of x265 for ffmpeg on Cygwin - executable location different from other codecs

TL;DR (with expected vs. real)
For a Cygwin build of ffmpeg, I'm installing x265, and it seems to me that the executable ends up in the wrong place. I'll show some basic directory structure, then I'll show the tree outputs for expected and real, both before and after the cmake installation. For directories where I think this is important, I'll show the outputs before and after the cmake installation.
My question has two parts. I used the following cmake and make commands,
# pwd => $HOME/programs/ffmpeg/ffmpeg_sources/x265/build/linux
PATH="$HOME/programs/ffmpeg/bin:$PATH" \
cmake -G "Unix Makefiles" \
-DCMAKE_INSTALL_PREFIX="$HOME/programs/ffmpeg/ffmpeg_build" \
-DENABLE_SHARED=OFF \
-DCMAKE_EXE_LINKER_FLAGS="-static"
../../source
PATH="$HOME/programs/ffmpeg/bin:$PATH" make -j $(nproc)
make install
The result is below, with my real vs. expected, and there is a more detailed, more explicit, and hopefully more clear file with the info at pastebin.com/86wHrtxR. Now, for my two-part question:
How can I change my cmake command so that my x265.exe file ends up in $HOME/programs/ffmpeg/bin with the proper linking, rather than $HOME/programs/ffmpeg/ffmpeg_build/bin?
Would the build/linker/whatever figure things out for the ffmpeg build?
I want to know the answer to question number 1 regardless of the answer to question number 2. I haven't used cmake with the -DVAR=var flags before, and I'd like to take this opportunity to learn.
For the result:
Things surrounded by double curly brackets are {{ expected }}.
Things surrounded by double angle brackets are << real >>, i.e. they exist after the installation is done.
If real matches expected, and the file/directory is new, I've surrounded it by double parentheses, i.e. double round brackets. (( match ))
If something is not new (and thus has the same before and after) I haven't marked it.
me#MACHINE ~/programs/ffmpeg
$ tree --charset=ascii bin
bin
|-- lame.exe
|-- mp3rtp.exe
|-- mp3x.exe
`-- x264.exe
{{ `-- x265.exe }} ## Expected, not Exists
me#MACHINE ~/programs/ffmpeg
$ tree --charset=ascii \
ffmpeg_build
ffmpeg_build
<< |-- bin >> ## Not expected, Exists
<< | `-- x265.exe >> ## Not expected, Exists
|-- include
| |-- fdk-aac
| | |-- aacdecoder_lib.h
| | |-- aacenc_lib.h
| | `-- ... <more .h files>
| |-- lame
| | `-- lame.h
| |-- x264.h
| `-- x264_config.h
(( | |-- x265.h )) ## Expected and Exists
(( | `-- x265_config.h )) ## Expected and Exists
|-- lib
| |-- libfdk-aac.a
| |-- libfdk-aac.la
| |-- libmp3lame.a
| |-- libmp3lame.la
(( | |-- libx265.a )) ## Expected and Exists
| `-- pkgconfig
| |-- fdk-aac.pc
| `-- x264.pc
(( | `-- x265.pc )) ## Expected and Exists
`-- share
|-- doc
| ... <only lame>
`-- man
... <only lame>
Other, possibly useful information about the build directory structure.
me#MACHINE ~/programs/ffmpeg
$ tree --charset=ascii -L 1 .
.
|-- bin
|-- ffmpeg_build
`-- ffmpeg_sources
3 directories, 0 files
For this next, ffmpeg_sources dir, I'm showing the after (which is both expected and real/exists) surrounded by double parentheses, i.e. double round brackets, (( <after> )).
me#MACHINE ~/programs/ffmpeg
$ tree --charset=ascii -L 1 ffmpeg_sources
ffmpeg_sources
|-- fdk-aac.zip
|-- lame-svn
|-- mstorsjo-fdk-aac-e7d8591
|-- x264-snapshot-20191217-2245
|-- x264-snapshot-20191217-2245.tar.bz2
`-- x264-snapshot-20191218-README.txt
(( `-- x265 ))
3 directories, 3 files
(( 4 directories, 3 files ))
NOW, FOR SOME MORE DETAIL
What I'm Doing
I am working on a Cygwin build (vs. a Windows/mingw build) of ffmpeg. I am following an older guide by koohiimaster (archived). That guide says,
[W]e are not cross-compiling for windows; we are compiling for Cygwin.
This 2014 guide doesn't have all of the codecs I want - I want as complete a build as possible - so I've also been referring to this ffmpeg-for-Ubuntu guide (archived), which I hope is kept up-to-date. It's referred to by koohiimaster.
Also, as a way of checking that I'm getting all the codecs I want, I've been looking at this FFmpeg for Windows guide from SuperUser
I'll give the basics of my steps below. More details, as well as all the output is at pastebin.com/suL1nU6Z.
A look at directory structure for the build
me#MACHINE ~/programs/ffmpeg
$ cd $HOME/programs/ffmpeg
me#MACHINE ~/programs/ffmpeg
$ tree --charset=ascii -d -L 1
.
|-- bin
|-- ffmpeg_build
`-- ffmpeg_sources
3 directories
Getting the source. Note that I had to apt-cyg install mercurial, though (with my Cygwin setup GUI/EXE in my Cygwin root directory, i.e. C:\cygwin64\setup-x86_64.exe), I could also have done /setup-x86_64.exe install -q -P mercurial.
cd ffmpeg_sources
hg clone https://bitbucket.org/multicoreware/x265
Running the cmake and make commands
cd x265/build/linux
PATH="$HOME/programs/ffmpeg/bin:$PATH" \
cmake -G "Unix Makefiles" \
-DCMAKE_INSTALL_PREFIX="$HOME/programs/ffmpeg/ffmpeg_build" \
-DENABLE_SHARED=OFF \
-DCMAKE_EXE_LINKER_FLAGS="-static" \
../../source
PATH="$HOME/programs/ffmpeg/bin:$PATH" make -j $(nproc)
make install
It was the last part (actually the very last line) of the make install output that worried me. Here is the whole output - it's not very long.
make[1]: Entering directory '/home/me/programs/ffmpeg/ffmpeg_sources/x265/build/linux'
make[2]: Entering directory '/home/me/programs/ffmpeg/ffmpeg_sources/x265/build/linux'
make[2]: Leaving directory '/home/me/programs/ffmpeg/ffmpeg_sources/x265/build/linux'
[ 20%] Built target encoder
make[2]: Entering directory '/home/me/programs/ffmpeg/ffmpeg_sources/x265/build/linux'
make[2]: Leaving directory '/home/me/programs/ffmpeg/ffmpeg_sources/x265/build/linux'
[ 83%] Built target common
make[2]: Entering directory '/home/me/programs/ffmpeg/ffmpeg_sources/x265/build/linux'
make[2]: Leaving directory '/home/me/programs/ffmpeg/ffmpeg_sources/x265/build/linux'
[ 84%] Built target x265-static
make[2]: Entering directory '/home/me/programs/ffmpeg/ffmpeg_sources/x265/build/linux'
make[2]: Leaving directory '/home/me/programs/ffmpeg/ffmpeg_sources/x265/build/linux'
[100%] Built target cli
make[1]: Leaving directory '/home/me/programs/ffmpeg/ffmpeg_sources/x265/build/linux'
Install the project...
-- Install configuration: "Release"
-- Installing: /home/me/programs/ffmpeg/ffmpeg_build/lib/libx265.a
-- Installing: /home/me/programs/ffmpeg/ffmpeg_build/include/x265.h
-- Installing: /home/me/programs/ffmpeg/ffmpeg_build/include/x265_config.h
-- Installing: /home/me/programs/ffmpeg/ffmpeg_build/lib/pkgconfig/x265.pc
-- Installing: /home/me/programs/ffmpeg/ffmpeg_build/bin/x265.exe
As discussed in the TL;DR section, I expected to see x265.exe at
home/me/programs/ffmpeg/bin/x265.exe
rather than the path given on the last line of output,
/home/me/programs/ffmpeg/ffmpeg_build/bin/x265.exe
This worries me especially because the first part of the ffmpeg install command that my instructions inform me to run is
PATH="$HOME/programs/ffmpeg/bin:$PATH" \
PKG_CONFIG_PATH="$HOME/programs/ffmpeg/ffmpeg_build/lib/pkgconfig" \
./configure \
--prefix="$HOME/programs/ffmpeg/ffmpeg_build" \
--extra-cflags="-I$HOME/programs/ffmpeg/ffmpeg_build/include" \
--extra-ldflags="-L$HOME/programs/ffmpeg/ffmpeg_build/lib" \
--bindir="$HOME/programs/ffmpeg/bin" \
... and on it goes ...
It would seem to me that the .configure script for ffmpeg won't find the x265 executable, since it's not in the bindir.
I'll repeat my two-part question from before:
How can I change my cmake command so that my x265.exe file ends up in $HOME/programs/ffmpeg/bin with the proper linking, rather than $HOME/programs/ffmpeg/ffmpeg_build/bin?
What I'm looking for here is something akin to the --bindir flag from make's ./confiure.
Would the build/linker/whatever figure things out for the ffmpeg build?
I want to know the answer to question number 1 regardless of the answer to question number 2. I haven't used cmake with the -DVAR=var flags before, and I'd like to take this opportunity to learn.
Where I've Looked & What I've Tried
I first started with the man page and the --help for cmake. That was scary. I was hoping that I'd find something useful around the CMAKE_INSTALL_PREFIX stuff, but I wasn't sure what to make of it.
I tried greping through cmake --help-full (with 50 lines before and after whatever I was searching for), but got tripped up by the complexity. I've only used basic cmake stuff, before, and I got more than a little lost.
Even with the --help, I don't know if I need to look at the help-manual, the help-command, the help-module, the help-policy, the help-variable, or something else.
It seemed to me, in reading, that a "binary directory" is the top of the "build", whereas I thought it would be the dir named bin ... I couldn't tell what things were meant to be used by the person creating the package rather than by me, who am trying to make/build the package from the command line.
I looked through what seemed to be a cmake wiki's Useful Variables page (archived), as well as at this thread at cmake.org (archived), which, along with this SO source and this and this and this and this SO sources, seemed to suggest using the CMAKE_RUNTIME_OUTPUT_DIRECTORY variable (since the EXECUTABLE_OUTPUT-DIRECTORY variable has been superseded by it). By the way, I couldn't tell which things should be used by the creator of the package vs. the consumer of the package - the consumer being me. I tried with
PATH="$HOME/programs/ffmpeg/bin:$PATH" \
cmake -G "Unix Makefiles" \
-DCMAKE_INSTALL_PREFIX="$HOME/programs/ffmpeg/ffmpeg_build" \
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY="$HOME/programs/ffmpeg/bin" \
-DENABLE_SHARED=OFF \
-DCMAKE_EXE_LINKER_FLAGS="-static"
../../source
PATH="$HOME/
and have thought about fifty-or-so other -DVAR variables, but with any I have tried, I still get the same result. I still get the executable in what seems to be the wrong place.
System Details
$ date && date +'%s'
Tue, May 5, 2020 11:14:40 AM
1588698880
$ uname -a
CYGWIN_NT-10.0 MACHINE 3.1.4(0.340/5/3) 2020-02-19 08:49 x86_64 Cygwin
$ cmake --version
cmake version 3.14.5
CMake suite maintained and supported by Kitware (kitware.com/cmake).
$ bash --version | head -n 1
GNU bash, version 4.4.12(3)-release (x86_64-unknown-cygwin)
$ gcc --version | head -n 1
gcc (GCC) 9.3.0
$ g++ --version | head -n 1
g++ (GCC) 9.3.0
$ make --version | head -n 2
GNU Make 4.3
Built for x86_64-pc-cygwin
To have x286.exe file in $HOME/programs/ffmpeg/bin
--prefix="$HOME/programs/ffmpeg" \
--extra-cflags="-I$HOME/programs/ffmpeg/include" \
--extra-ldflags="-L$HOME/programs/ffmpeg/lib" \
For cmake :
-DCMAKE_INSTALL_PREFIX="$HOME/programs/ffmpeg"
VERY close with #Philippe
The answer by #Philippe got me pointed in the right direction. My comment on that answer, with some changes shows how close it got me.
That's helpful - with
-DCMAKE_INSTALL_PREFIX="$HOME/programs/ffmpeg"
I went all the way through the make install. Doing so, I ended up quite close. The last part of the make install output was
-- Installing: /home/me/programs/ffmpeg/lib/libx265.a
-- Installing: /home/me/programs/ffmpeg/include/x265.h
-- Installing: /home/me/programs/ffmpeg/include/x265_config.h
-- Installing: /home/me/programs/ffmpeg/lib/pkgconfig/x265.pc
-- Installing: /home/me/programs/ffmpeg/bin/x265.exe
The x265.exe is where I want it, but now the other five files (libx265.a, x265.h, x265_config.h, and x265.pc) are not where it seems that the pattern of other installs would like them, e.g., I would like /home/me/programs/ffmpeg/ffmpeg_build/lib/libx265.a - it seems the eventual ffmpeg build wants them there.
The last paragraph describes the desired output from the original question. To put it another way, just for clarity's sake, I want those last lines of output to be
-- Installing: /home/me/programs/ffmpeg/ffmpeg_build/lib/libx265.a
-- Installing: /home/me/programs/ffmpeg/ffmpeg_build/include/x265.h
-- Installing: /home/me/programs/ffmpeg/ffmpeg_build/include/x265_config.h
-- Installing: /home/me/programs/ffmpeg/ffmpeg_build/lib/pkgconfig/x265.pc
-- Installing: /home/me/programs/ffmpeg/bin/x265.exe
Answer to Match the 'Desired Output'
The combination of ideas in the answer from #Philippe got me to where I needed to be. First, a few little changes needed to be made to CMakeLists.txt. The file as cloned is already set up to allow the location of the "*.exe" files (inside whichever bin directory be desired) to be changed from the command-line. The same is true for the library (lib) files. Rather than hard-code the location for the header (include) files, I make this change.
me#MACHINE ~/programs/ffmpeg/ffmpeg_sources/x265/source
$ cp CMakeLists.txt CMakeLists.txt.$(date +'%s').bak
me#MACHINE ~/programs/ffmpeg/ffmpeg_sources/x265/source
$ cat -n CMakeLists.txt.1588732600.bak | head -n 386 | tail -16 ### BEFORE
371
372 # Build options
373 set(LIB_INSTALL_DIR lib CACHE STRING "Install location of libraries")
374 set(BIN_INSTALL_DIR bin CACHE STRING "Install location of executables")
375 set(EXTRA_LIB "" CACHE STRING "Extra libraries to link against")
376 set(EXTRA_LINK_FLAGS "" CACHE STRING "Extra link flags")
377 if(EXTRA_LINK_FLAGS)
378 list(APPEND LINKER_OPTIONS ${EXTRA_LINK_FLAGS})
379 endif()
380 if(EXTRA_LIB)
381 option(LINKED_8BIT "8bit libx265 is being linked with this library" OFF)
382 option(LINKED_10BIT "10bit libx265 is being linked with this library" OFF)
383 option(LINKED_12BIT "12bit libx265 is being linked with this library" OFF)
384 endif(EXTRA_LIB)
385 mark_as_advanced(EXTRA_LIB EXTRA_LINK_FLAGS)
386
me#MACHINE ~/programs/ffmpeg/ffmpeg_sources/x265/source
$ vim CMakeLists.txt ### Making the change
me#MACHINE ~/programs/ffmpeg/ffmpeg_sources/x265/source
$ cat -n CMakeLists.txt | head -n 389 | tail -19 ### AFTER
371
372 # Build options
373 set(LIB_INSTALL_DIR lib CACHE STRING "Install location of libraries")
374 set(BIN_INSTALL_DIR bin CACHE STRING "Install location of executables")
375 # Start DWB insert 2020-05-05
376 set(INCLUDE_INSTALL_DIR include CACHE STRING "Install location of headers")
377 # End DWB insert 2020-05-05
378 set(EXTRA_LIB "" CACHE STRING "Extra libraries to link against")
379 set(EXTRA_LINK_FLAGS "" CACHE STRING "Extra link flags")
380 if(EXTRA_LINK_FLAGS)
381 list(APPEND LINKER_OPTIONS ${EXTRA_LINK_FLAGS})
382 endif()
383 if(EXTRA_LIB)
384 option(LINKED_8BIT "8bit libx265 is being linked with this library" OFF)
385 option(LINKED_10BIT "10bit libx265 is being linked with this library" OFF)
386 option(LINKED_12BIT "12bit libx265 is being linked with this library" OFF)
387 endif(EXTRA_LIB)
388 mark_as_advanced(EXTRA_LIB EXTRA_LINK_FLAGS)
389
Seen via diff
me#MACHINE ~/programs/ffmpeg/ffmpeg_sources/x265/source
$ diff CMakeLists.txt CMakeLists.txt.1588732600.bak
375,377d374
< # Start DWB insert 2020-05-05
< set(INCLUDE_INSTALL_DIR include CACHE STRING "Install location of headers")
< # End DWB insert 2020-05-05
599,604c596,597
Next change:
me#MACHINE ~/programs/ffmpeg/ffmpeg_sources/x265/source
$ cat -n CMakeLists.txt.1588732600.bak | head -n 602 | tail -9 ### BEFORE
594
595 if(SVTHEVC_FOUND)
596 install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbApi.h" DESTINATION include)
597 install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbErrorCodes.h" DESTINATION include)
598 install(FILES "${SVT_HEVC_LIBRARY}" DESTINATION ${LIB_INSTALL_DIR})
599 endif()
600
601 install(FILES x265.h "${PROJECT_BINARY_DIR}/x265_config.h" DESTINATION include)
602 if((WIN32 AND ENABLE_CLI) OR (WIN32 AND ENABLE_SHARED))
me#MACHINE ~/programs/ffmpeg/ffmpeg_sources/x265/source
$ vim CMakeLists.txt ### Making the change
me#MACHINE ~/programs/ffmpeg/ffmpeg_sources/x265/source
$ cat -n CMakeLists.txt | head -n 611 | tail -15 ### AFTER
597
598 if(SVTHEVC_FOUND)
599 # DWB change 2020-05-05, original is next (cmt) line, new is the line after
600 #install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbApi.h" DESTINATION include)
601 install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbApi.h" DESTINATION ${INCLUDE_INSTALL_DIR})
602 # DWB change 2020-05-05, original is next (cmt) line, new is the line after
603 #install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbErrorCodes.h" DESTINATION include)
604 install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbErrorCodes.h" DESTINATION ${INCLUDE_INSTALL_DIR})
605 install(FILES "${SVT_HEVC_LIBRARY}" DESTINATION ${LIB_INSTALL_DIR})
606 endif()
607
608 # DWB change 2020-05-05, original is next (comment) line, new is the line after
609 #install(FILES x265.h "${PROJECT_BINARY_DIR}/x265_config.h" DESTINATION include)
610 install(FILES x265.h "${PROJECT_BINARY_DIR}/x265_config.h" DESTINATION ${INCLUDE_INSTALL_DIR})
611 if((WIN32 AND ENABLE_CLI) OR (WIN32 AND ENABLE_SHARED))
Or, again as seen via diff (with both changes having been made),
me#MACHINE ~/programs/ffmpeg/ffmpeg_sources/x265/source
$ diff CMakeLists.txt CMakeLists.txt.1588732600.bak
375,377d374
< # Start DWB insert 2020-05-05
< set(INCLUDE_INSTALL_DIR include CACHE STRING "Install location of headers")
< # End DWB insert 2020-05-05
599,604c596,597
< # DWB change 2020-05-05, original is next (cmt) line, new is the line after
< #install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbApi.h" DESTINATION include)
< install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbApi.h" DESTINATION ${INCLUDE_INSTALL_DIR})
< # DWB change 2020-05-05, original is next (cmt) line, new is the line after
< #install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbErrorCodes.h" DESTINATION include)
< install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbErrorCodes.h" DESTINATION ${INCLUDE_INSTALL_DIR})
---
> install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbApi.h" DESTINATION include)
> install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbErrorCodes.h" DESTINATION include)
608,610c601
< # DWB change 2020-05-05, original is next (comment) line, new is the line after
< #install(FILES x265.h "${PROJECT_BINARY_DIR}/x265_config.h" DESTINATION include)
< install(FILES x265.h "${PROJECT_BINARY_DIR}/x265_config.h" DESTINATION ${INCLUDE_INSTALL_DIR})
---
> install(FILES x265.h "${PROJECT_BINARY_DIR}/x265_config.h" DESTINATION include)
The `cmake` Command and the `make` Commands
Let's get into the correct build directory and run cmake
cd $HOME/programs/ffmpeg/ffmpeg_sources/x265/build/linux
PATH="$HOME/programs/ffmpeg/bin:$PATH" \
cmake -G "Unix Makefiles" \
-DCMAKE_INSTALL_PREFIX="$HOME/programs/ffmpeg" \
-DBIN_INSTALL_DIR="bin" \
-DLIB_INSTALL_DIR="ffmpeg_build/lib" \
-DINCLUDE_INSTALL_DIR="ffmpeg_build/include" \
-DENABLE_SHARED=OFF \
-DCMAKE_EXE_LINKER_FLAGS="-static" \
../../source
This gives some deprecation warnings that we don't need to worry about. Now, for the make parts.
PATH="$HOME/programs/ffmpeg/bin:$PATH" make -j $(nproc)
make install
which led to the desired result. The last few lines of the make install output were
-- Installing: /home/13852/programs/ffmpeg/ffmpeg_build/lib/libx265.a
-- Installing: /home/13852/programs/ffmpeg/ffmpeg_build/include/x265.h
-- Installing: /home/13852/programs/ffmpeg/ffmpeg_build/include/x265_config.h
-- Installing: /home/13852/programs/ffmpeg/ffmpeg_build/lib/pkgconfig/x265.pc
-- Installing: /home/13852/programs/ffmpeg/bin/x265.exe

Golang compile for all platforms in Windows 7 (32 bit)

I'm using windows 7 [32 bit] operating system.
I'm build example go program.
I want to compile this program for all platforms from my windows 7 [32 bit] OS.
I want to compile my program for all Linux [32/64] / Mac OSX [32/64] / Windows[32/64].
Is it possible are not from my single OS ?
Update Go 1.5: see "Cross compilation just got a whole lot better in Go 1.5"
For successful cross compilation you would need
compilers for the target platform, if they differed from your host platform, ie you’re on darwin/amd64 (6g) and you want to compile for linux/arm (5g).
a standard library for the target platform, which included some files generated at the point your Go distribution was built.
With the plan to translate the Go compiler into Go coming to fruition in the 1.5 release the first issue is now resolved.
package main
import "fmt"
import "runtime"
func main() {
fmt.Printf("Hello %s/%s\n", runtime.GOOS, runtime.GOARCH)
}
build for darwin/386
% env GOOS=darwin GOARCH=386 go build hello.go
# scp to darwin host
$ ./hello
Hello darwin/386
Or build for linux/arm
% env GOOS=linux GOARCH=arm GOARM=7 go build hello.go
# scp to linux host
$ ./hello
Hello linux/arm
Original answer (Go 1.4 and before)
You can try a tool like gox
Gox is a simple, no-frills tool for Go cross compilation that behaves a lot like standard go build.
Gox will parallelize builds for multiple platforms.
Gox will also build the cross-compilation toolchain for you.
Before you use Gox, you must build the cross-compilation toolchain. Gox can do this for you. This only has to be done once (or whenever you update Go):
$ gox -build-toolchain
You will also find many cross-platform development tips at "Developing for Multiple Platforms With Go".
Passionate Developer points out below to issue 19, left by the OP Nakka Chandra, even though issue 10 reported making gox run successfully on Windows.
On Windows run the following commands:
C:\Users\user\go\src\myapp> set GOOS=linux
C:\Users\user\go\src\myapp> set GOARCH=amd64
C:\Users\user\go\src\myapp> go build
It worked for me.
Notice, if you get the error:
cmd/go: unsupported GOOS/GOARCH pair linux/amd64
This is because you have a space at the end of the variable.
Example, wrong use is: set GOOS=linux<space>), instead it should be: set GOOS=linux.
This is the full table list (taken from here) for all the other systems:
GOOS - Target Operating System| GOARCH - Target Platform
-------------------------------|--------------------------
| android | arm |
| darwin | 386 |
| darwin | amd64 |
| darwin | arm |
| darwin | arm64 |
| dragonfly | amd64 |
| freebsd | 386 |
| freebsd | amd64 |
| freebsd | arm |
| linux | 386 |
| linux | amd64 |
| linux | arm |
| linux | arm64 |
| linux | ppc64 |
| linux | ppc64le |
| linux | mips |
| linux | mipsle |
| linux | mips64 |
| linux | mips64le |
| netbsd | 386 |
| netbsd | amd64 |
| netbsd | arm |
| openbsd | 386 |
| openbsd | amd64 |
| openbsd | arm |
| plan9 | 386 |
| plan9 | amd64 |
| solaris | amd64 |
| windows | 386 |
| windows | amd64 |
----------------------------------------------------------
You can find the full list of supported GOOS/GOARCH platforms supported by your go by running go tool dist list.
For Go 1.18.1, this shows the following pairs, after filtering based on the target OSes you said you are interested in:
$ go tool dist list | grep -e linux -e darwin -e windows
darwin/amd64
darwin/arm64
linux/386
linux/amd64
linux/arm
linux/arm64
linux/mips
linux/mips64
linux/mips64le
linux/mipsle
linux/ppc64
linux/ppc64le
linux/riscv64
linux/s390x
windows/386
windows/amd64
windows/arm
windows/arm64
If you want to compile your code for all of these, you can do this with the bash/sh script below:
bin_name='example' # Change the binary name as desired
go tool dist list | grep -e linux -e darwin -e windows | while read -r pair; do
# Extract the GOOS and GOARCH from the pair
GOOS="${pair%/*}"
GOARCH="${pair#*/}"
suffix=''
# If GOOS is windows, set suffix to .exe
[ "$GOOS" = 'windows' ] && suffix='.exe'
# Replace <args> with appropriate arguments as needed
GOOS="$GOOS" GOARCH="$GOARCH" \
go build -o "${bin_name}-${GOOS}-${GOARCH}${suffix}" <args>
done
This script will produce an executable for each OS/architecture pair, and append the OS and architecture at the end of the name. It will also append .exe if the OS is Windows.

Active Processes running except the current process

If i write ps -ef, then it returns all the processes running currently. If i type ps -ef | grep xxx, then it returns all the processes running with substring xxx. but ps -ef | grep xxx is also a current process, so it returns grep xxx in the list too.
I just want to eliminate grep xxx from the list.
Can anyone help me with this.
Thanks
Try doing this :
pgrep -fl xxx
Another solution
ps -ef | grep '[x]xx'
this is a simple regex trick to avoid repetition
pgrep is packaged in procps, on Debian :
$ LANG=C apt-cache show procps
Package: procps
Priority: important
Section: admin
Installed-Size: 760
Maintainer: Craig Small <csmall#debian.org>
Replaces: bsdutils (<< 2.9x-1), watch
Provides: watch
Depends: libc6 (>= 2.3.4), libncurses5 (>= 5.7+20100313), libncursesw5 (>= 5.7+20100313), lsb-base (>= 3.0-10), initscripts
Recommends: psmisc
Conflicts: libproc-dev (<< 1:1.2.6-2), pgrep (<< 3.3-5), procps-nonfree, w-bassman (<< 1.0-3), watch
Size: 249178
Description: /proc file system utilities
This package provides command line and full screen utilities for browsing
procfs, a "pseudo" file system dynamically generated by the kernel to
provide information about the status of entries in its process table
(such as whether the process is running, stopped, or a "zombie").
.
It contains free, kill, pkill, pgrep, pmap, ps, pwdx, skill, slabtop,
snice, sysctl, tload, top, uptime, vmstat, w, and watch.
Homepage: http://procps.sf.net/
Tag: admin::monitoring, interface::commandline, interface::text-mode, role::program, scope::utility, uitoolkit::ncurses, use::monitor, works-with::software:running
Instead of saying
ps -ef | grep xxx
say
ps -ef | grep [x]xx
and you wouldn't see grep xxx in the output. (Essentially put the first character of the desired word as a character class [].)

tree command on osx bash

I'm following a screen cast on a ruby gem called pry. At 8:10, the .tree command is used, which I believe is a Unix command.
It does not appear to be working on my system:
[24] pry(main)> .tree
\Error: there was a problem executing system command: tree
and I have traced the issue to here, in which pry references a shell command:
Pry::CommandSet.new do
command(/\.(.*)/, "All text following a '.' is forwarded to the shell.", :listing => ".<shell command>") do |cmd|
if cmd =~ /^cd\s+(.+)/i
dest = $1
begin
Dir.chdir File.expand_path(dest)
rescue Errno::ENOENT
output.puts "No such directory: #{dest}"
end
else
if !system(cmd)
output.puts "Error: there was a problem executing system command: #{cmd}"
end
end
end
from the context of bash I tried using the command tree with no luck:
projects/sms(apps2)$ tree
-bash: tree: command not found
~/projects/sms(apps2)$ .tree
-bash: .tree: command not found
This looks incredibly useful, how can I get this command?
Using homebrew:
brew install tree
Using macports:
sudo port install tree
Using the source:
Follow these directions. (Caveat; you should use the flags/etc. that make sense.)
<rant>All systems should come with tree; I use it a lot. And we can post directory structures as text, not pics.</rant>
For a simple approach you can also add the following alias to your ~/.bashrc or ~/.zshrc file:
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"
This results in the following:
$ tree
.
|____.git
| |____config
| |____objects
| | |____pack
| | |____info
| |____HEAD
| |____info
| | |____exclude
| |____description
| |____hooks
| | |____commit-msg.sample
| | |____pre-rebase.sample
| | |____pre-commit.sample
| | |____applypatch-msg.sample
| | |____pre-receive.sample
| | |____prepare-commit-msg.sample
| | |____post-update.sample
| | |____pre-applypatch.sample
| | |____pre-push.sample
| | |____update.sample
| |____refs
| | |____heads
| | |____tags
Found this solution here:
http://osxdaily.com/2016/09/09/view-folder-tree-terminal-mac-os-tree-equivalent/
Use brew install tree command on the terminal if you're using Homebrew on your Mac.
Not exactly the same, but gives you a list of all directories and files in those directories using:
find .
You can also specify list directories only
find -type d
or if you want to see files only
find -type f
you can also specify depth
find -type d -maxdepth 2
Add this to your shell startup file(~/.bashrc or ~/.zshrc):
tree() {
find $1 -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
}
After restarting your shell, you can use the tree command like so:
% tree Downloads
Downloads
|____ideaIU-2020.1.3-no-jbr.tar.gz
|____Firicico.ttf

Resources