FFmpeg screencasting

Hi! It's the first time I'm using FreeBSD, I'm a Linux user since 2005.
I'd like to have FFmpeg with screencast capability and other options, so I decided to create a Jail (zfs) with Poudriere.
The problem is that some packages (cmake, protobuf, xcb first of all) fail on build.
Is it possible to resolve?
Am I using the best solution for building a personal FFmpeg?

Thanks a lot :)
 
Why go through all this trouble just to build one port though? Poudriere is a nice tool, but might be a little bit heavy (overkill?) for simply building a few ports for regular use. Not to mention the issue of adding a lot of extra overhead (such as jails) which might not even be needed, or could even hinder things.
  • cd /usr/ports/multimedia/ffmpeg
  • make config-recursive
  • make install clean |& tee build.log && rm build.log
    • I'm assuming root usage here which normally uses csh. If you use sh or another bourne -alike shell you may need # make install clean 2>&1 | tee build.log && rm build.log instead.
After that you should be well on your way.
 
Or, why build your own package when packages are already available. If the answer is that you want something newer, then you could switch from the quarterly packages to those built from the head of the ports tree. If the answer is that the default options are not what you want (and there is no flavor using different options), then you are stuck building your own package(s). Generally I would advise against building on a live system. There will be fewer surprises with poudriere, because it uses a clean environment. In other words, poudriere approaches something closer to reproducible package builds. But, if this is a one-off package build, then you are probably safe.

In any case, more detail (such as the build logs) will be necessary for us to try to help.
 
Why go through all this trouble just to build one port though? Poudriere is a nice tool, but might be a little bit heavy (overkill?) for simply building a few ports for regular use. Not to mention the issue of adding a lot of extra overhead (such as jails) which might not even be needed, or could even hinder things.
  • cd /usr/ports/multimedia/ffmpeg
  • make config-recursive
  • make install clean |& tee build.log && rm build.log
    • I'm assuming root usage here which normally uses csh. If you use sh or another bourne -alike shell you may need # make install clean 2>&1 | tee build.log && rm build.log instead.
After that you should be well on your way.

Tryingyour method.

Code:
CMake 3.10.2, Copyright 2000-2017 Kitware, Inc. and Contributors
CMake 3.10.2, Copyright 2000-2017 Kitware, Inc. and Contributors
C compiler on this system is: cc -O2 -pipe  -fstack-protector -isystem /usr/local/include -fno-strict-aliasing
C compiler on this system is: cc -O2 -pipe  -fstack-protector -isystem /usr/local/include -fno-strict-aliasing
C++ compiler on this system is: c++ -O2 -pipe -fstack-protector -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include
C++ compiler on this system is: c++ -O2 -pipe -fstack-protector -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include
Makefile processor on this system is: make
Makefile processor on this system is: make
c++ has setenv
c++ has setenv
c++ has unsetenv
c++ has unsetenv
c++ does not have environ in stdlib.h
c++ does not have environ in stdlib.h
c++ has stl wstring
c++ has stl wstring
c++ does not have <ext/stdio_filebuf.h>
c++ does not have <ext/stdio_filebuf.h>
---------------------------------------------
---------------------------------------------
`cmake' is up to date.
`cmake' is up to date.
loading initial cache file /usr/ports/devel/cmake/work/cmake-3.10.2/Bootstrap.cmk/InitialCacheFlags.cmake
loading initial cache file /usr/ports/devel/cmake/work/cmake-3.10.2/Bootstrap.cmk/InitialCacheFlags.cmake
-- Using system-installed BZIP2
-- Using system-installed CURL
-- Using system-installed EXPAT
-- Using system-installed FORM
-- Using system-installed JSONCPP
-- Using system-installed LIBARCHIVE
-- Using system-installed LIBLZMA
-- Using system-installed BZIP2
-- Using system-installed CURL
-- Using system-installed EXPAT
-- Using system-installed FORM
-- Using system-installed JSONCPP
-- Using system-installed LIBARCHIVE
-- Using system-installed LIBLZMA
-- Using system-installed LIBRHASH
-- Using system-installed LIBRHASH
-- Using system-installed LIBUV
-- Using system-installed ZLIB
-- Using system-installed LIBUV
-- Using system-installed ZLIB
-- Could NOT find LibUV: Found unsuitable version "", but required is at least "1.0.0" (found /usr/local/lib/libuv.so)
-- Could NOT find LibUV: Found unsuitable version "", but required is at least "1.0.0" (found /usr/local/lib/libuv.so)
CMake Error at CMakeLists.txt:531 (message):
  CMAKE_USE_SYSTEM_LIBUV is ON but a libuv is not found!
  Call Stack (most recent call first):
  CMakeLists.txt:662 (CMAKE_BUILD_UTILITIES)


-- Configuring incomplete, errors occurred!
See also "/usr/ports/devel/cmake/work/cmake-3.10.2/CMakeFiles/CMak
eOutput.log".
See also "/usr/ports/devel/cmake/work/cmake-3.10.2/CMakeFiles/CMak
eError.log".
-- Configuring incomplete, errors occurred!
See also "/usr/ports/devel/cmake/work/cmake-3.10.2/CMakeFiles/CMak
eOutput.log".
See also "/usr/ports/devel/cmake/work/cmake-3.10.2/CMakeFiles/CMak
eError.log".
---------------------------------------------
Error when bootstrapping CMake:
Problem while running initial CMake
---------------------------------------------
---------------------------------------------
Error when bootstrapping CMake:
Problem while running initial CMake
---------------------------------------------
===>  Script "configure" failed unexpectedly.
===>  Script "configure" failed unexpectedly.
Please report the problem to kde@FreeBSD.org [maintainer] and atta
ch the
"/usr/ports/devel/cmake/work/cmake-3.10.2/config.log" including th
e output
of the failure of your make command. Also, it might be a good idea
 to provide
an overview of all packages installed on your system (e.g. a
/usr/local/sbin/pkg-static info -g -Ea).
Please report the problem to kde@FreeBSD.org [maintainer] and atta
ch the
"/usr/ports/devel/cmake/work/cmake-3.10.2/config.log" including th
e output
of the failure of your make command. Also, it might be a good idea
 to provide
an overview of all packages installed on your system (e.g. a
/usr/local/sbin/pkg-static info -g -Ea).
*** Error code 1

Stop.
make[4]: stopped in /usr/ports/devel/cmake
*** Error code 1
Stop.
make[4]: stopped in /usr/ports/devel/cmake
*** Error code 1

Stop.
make[3]: stopped in /usr/ports/devel/cmake
*** Error code 1

Stop.
make[3]: stopped in /usr/ports/devel/cmake
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/graphics/frei0r
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/graphics/frei0r
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/multimedia/ffmpeg
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/multimedia/ffmpeg
*** Error code 1

Stop.
make: stopped in /usr/ports/multimedia/ffmpeg
*** Error code 1

Stop.
make: stopped in /usr/ports/multimedia/ffmpeg
 
Tryingyour method.
So the problem with this method is caused by building devel/cmake. Question: how did you install everything else on your system? Using binary packages? Because that could explain a thing or two. Not everything though because these specific cmake dependencies don't seem to be something commonly used:
Code:
$ pkg info -rx libuv
libuv-1.22.0:
        cmake-3.12.0_1
It also strikes me as peculiar that this dependency didn't get resolved somehow.

Leading up to: what FreeBSD version are you using exactly?
 
FreeBSD 11.2, all installed with bynary packages.
What's the best method to install automatically ports dependecies?

I've noticed that I had libuv-1.21.0, changed with 1.22.0 and this is the result:
Code:
-- Could NOT find LibUV: Found unsuitable version "", but required is at least "1.0.0" (found /usr/local/lib/libuv.so)
-- Could NOT find LibUV: Found unsuitable version "", but required is at least "1.0.0" (found /usr/local/lib/libuv.so)
CMake Error at CMakeLists.txt:531 (message):
  CMAKE_USE_SYSTEM_LIBUV is ON but a libuv is not found!
Call Stack (most recent call first):
  CMakeLists.txt:662 (CMAKE_BUILD_UTILITIES)


-- Configuring incomplete, errors occurred!
See also "/usr/ports/devel/cmake/work/cmake-3.10.2/CMakeFiles/CMakeOutput.log".
See also "/usr/ports/devel/cmake/work/cmake-3.10.2/CMakeFiles/CMakeError.log".
-- Configuring incomplete, errors occurred!
See also "/usr/ports/devel/cmake/work/cmake-3.10.2/CMakeFiles/CMakeOutput.log".
See also "/usr/ports/devel/cmake/work/cmake-3.10.2/CMakeFiles/CMakeError.log".
---------------------------------------------
Error when bootstrapping CMake:
---------------------------------------------
Error when bootstrapping CMake:
Problem while running initial CMake
---------------------------------------------
Problem while running initial CMake
---------------------------------------------
===>  Script "configure" failed unexpectedly.
===>  Script "configure" failed unexpectedly.
Please report the problem to kde@FreeBSD.org [maintainer] and attach the
"/usr/ports/devel/cmake/work/cmake-3.10.2/config.log" including the output
of the failure of your make command. Also, it might be a good idea to provide
an overview of all packages installed on your system (e.g. a
/usr/local/sbin/pkg-static info -g -Ea).
Please report the problem to kde@FreeBSD.org [maintainer] and attach the
"/usr/ports/devel/cmake/work/cmake-3.10.2/config.log" including the output
of the failure of your make command. Also, it might be a good idea to provide
an overview of all packages installed on your system (e.g. a
/usr/local/sbin/pkg-static info -g -Ea).
*** Error code 1

Stop.
make[4]: stopped in /usr/ports/devel/cmake
*** Error code 1

Stop.
make[4]: stopped in /usr/ports/devel/cmake
*** Error code 1

Stop.
make[3]: stopped in /usr/ports/devel/cmake
*** Error code 1

Stop.
make[3]: stopped in /usr/ports/devel/cmake
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/graphics/frei0r
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/graphics/frei0r
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/multimedia/ffmpeg
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/multimedia/ffmpeg
*** Error code 1

Stop.
make: stopped in /usr/ports/multimedia/ffmpeg
*** Error code 1

Stop.
make: stopped in /usr/ports/multimedia/ffmpeg
 
FreeBSD 11.2, all installed with bynary packages.
Then that is most likely the cause of your problems. Mixing ports & packages is generally speaking a bad idea and can often lead to problems.

So if you insist on building multimedia/ffmpeg then the best option is indeed a clean building environment such as a jail. However, you said that this also gave you problems, can you share any logs of that building process?

What's the best method to install automatically ports dependecies?
Dependencies are normally resolved automatically. However, somethings things can go wrong when you mix binary packages & ports. The main problem is that a port uses the latest version whereas a binary package is usually older.

Now... if you still have that jail around you could always try to use the commands I shared earlier to see if the build process will succeed in there.

Warning though: instead of using make install clean |& tee build.log && rm build.log you'd need to use: make package |& tee build.log && rm build.log. After the package has been build you can then install that on the host and clean up afterwards ( make clean).
Hope this can help.

PS

Also keep jrm@'s comments above in mind... are you sure you need to build ffmpeg to get these features? And if you can do so then definitely share those other build logs, that can help as well.
 
You could first install all the dependencies from packages, then just build multimedia/ffmpeg.
You can use make -C /usr/ports/multimedia/ffmpeg build-depends-list run-depends-list | sort -u to find all the dependencies. After you install multimedia/ffmpeg, you can run pkg autoremove to quickly uninstall all the build dependencies that you no longer need.
 
Trying Poudriere.

I use this command for build:
Code:
doas poudriere bulk -c -j freebsd_11-2x64 -p HEAD -f /usr/local/etc/poudriere.d/port-list

Protobuf failed on build and cmake failded on configure in poudriere, how can I see more logs?

FFmpeg can't record desktop without xcb and the binary package has libxcb disabled:

Code:
ffmpeg version 4.0.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with FreeBSD clang version 4.0.0 (tags/RELEASE_400/final 297347) (based on LL
VM 4.0.0)
  configuration: --prefix=/usr/local --mandir=/usr/local/man --datadir=/usr/local/sha
re/ffmpeg --pkgconfigdir=/usr/local/libdata/pkgconfig --enable-shared --enable-pic --
enable-gpl --enable-postproc --enable-avfilter --enable-avresample --enable-pthreads
--cc=cc --disable-alsa --disable-libopencore-amrnb --disable-libopencore-amrwb --disa
ble-libass --disable-libbs2b --disable-libcaca --disable-libcdio --disable-libcelt --
disable-chromaprint --disable-libcodec2 --disable-libdc1394 --disable-debug --enable-
htmlpages --disable-libdrm --disable-libfdk-aac --disable-libflite --enable-fontconfi
g --enable-libfreetype --enable-frei0r --disable-libfribidi --disable-libgme --disabl
e-libgsm --enable-iconv --disable-libilbc --disable-libjack --disable-libkvazaar --di
sable-ladspa --disable-libmp3lame --disable-libbluray --disable-librsvg --disable-lib
xml2 --disable-lv2 --enable-mmx --disable-libmodplug --disable-libmysofa --disable-op
enal --disable-opencl --enable-libopencv --disable-opengl --disable-libopenh264 --dis
able-libopenjpeg --enable-optimizations --enable-libopus --disable-libpulse --enable-
runtime-cpudetect --disable-librubberband --disable-sdl2 --disable-libsmbclient --dis
able-libsnappy --disable-sndio --disable-libsoxr --disable-libspeex --enable-sse --di
sable-libssh --disable-libtesseract --enable-libtheora --disable-libtwolame --enable-
libv4l2 --enable-vaapi --enable-vdpau --disable-libvidstab --enable-libvorbis --disab
le-libvo-amrwbenc --enable-libvpx --disable-libwavpack --disable-libwebp --enable-lib
x264 --enable-libx265 --disable-libxcb --enable-libxvid --disable-outdev=xv --disable
-libzimg --disable-libzmq --disable-libzvbi --disable-gcrypt --enable-gmp --disable-l
ibrtmp --enable-gnutls --disable-openssl --enable-version3 --disable-nonfree --disabl
e-libaom --disable-libsrt
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
Unknown input format: 'x11grab'
 
The logs are stored under something like /poudriere/data/logs/bulk/freebsd_11-2x64/. It depends on what you set as BASEFS in poudriere.conf. You can also set up a nice web interface to view the logs. Here is ours.
 
Guys, I've made a fresh install of FreeBSD and I've built FFmpeg without issues using standard building.
Do you think I should try again poudriere?

EDIT
FFmpeg succesful build also with Poudriere after fresh install!
Is it normal that now I have only "/usr/ports/distfiles/" and not all single ports inside "/usr/ports/" ?
 
Is it normal that now I have only "/usr/ports/distfiles/" and not all single ports inside "/usr/ports/" ?
How do you expect us to answer that without telling us exactly what you did?

If you installed the Ports collection and it suddenly disappeared then no, that would be pretty strange. But if you didn't... then it's probably another program still using that location to download the original source archives.
 
How do you expect us to answer that without telling us exactly what you did?

If you installed the Ports collection and it suddenly disappeared then no, that would be pretty strange. But if you didn't... then it's probably another program still using that location to download the original source archives.

Sorry.
Ports were installed when I have reinstalled FreeBSD.

After
I've created Poudriere ports tree with this command:
Code:
poudriere ports -c -p HEAD
 
Normally, you should have the ports collection installed in /usr/ports if you choose to install the ports collection at installation time... Are you really sure you choose to install the ports collection during the installation ?

Anyway, here is what you can do to install the ports collection now your FreeBSD system has already been installed:
rm -rf /usr/ports && svnlite checkout https://svn.freebsd.org/ports/head /usr/ports
or, as explained in the FreeBSD handbook:
pkg install --yes subversion && rm -rf /usr/ports && svn checkout https://svn.freebsd.org/ports/head /usr/ports

Reference: https://www.freebsd.org/doc/handbook/ports-using.html. Please note that svnlite is available by default in the FreeBSD base system while svn is provided by the port devel/subversion which must be installed before using svn, as stated in the handbook.

You may then update your ports collection with:
svnlite update /usr/ports
or
svn update /usr/ports
respectively.

Personally, I would not use Pouriere at first. I would rather do, similarly to ShelLuser and jrm@ (as root):
cd /usr/ports/multimedia/ffmpeg
LIST=$(make build-depends-list run-depends-list | sort -u | sed 's/\/usr\/ports\///')
When making a single port, you may end up making all the build dependencies and run dependencies which is often time-consuming. The previous hint is to make the list of dependencies and install these dependencies through the package management system to avoid having to build them:
pkg install --yes $LIST
Then, you configure the port to select your options (select the option "XCB" for x11 grabbing), you possibly deinstall it (it could have been installed earlier through the package management system) and you reinstall it:
make config deinstall reinstall

During a global upgrade ( pkg upgrade), the port multimedia/ffmpeg may be upgraded and the options may be reset to default. You may then have to repeat the previous procedure to rebuild multimedia/ffmpeg with your specific options. From what I understand, this is why you may want to use Poudriere, in a second time.
 
Well, then I don't have a direct explanation, perhaps poudriere(8) can shed some light on this. I don't use it myself, but I'm aware that the port command allows you to set up a new port tree.

Because it can use separate port trees I could well imagine that it therefor overrides the default, but that's an assumption on my part.
 
Back
Top