How to get OpenGL man pages on Ubuntu as in "man glRotate"? - opengl

When on MacOSX, "man glRotate" brings up the glRotate manpage.
On ubuntu, with manpages-dev and manpages-posix-dev insatlled, "man glRotate" doesn't bring up the glRotate manpage (though I can build and compile gl apps).
What am I missing? How do I setup this up?

sudo apt-get install opengl-4-man-doc opencl-1.2-man-doc
contains many man pages, e.g.:
man glDrawArrays
but it does not contain man glRotate. I think this is because the deprecated immediate APIs are not included.
apt-file search glRotate shows a few hits, but they don't seem "official".
Tested on Ubuntu 16.04.

Combine the Khronos OpenGL-Refpages repository with the PKGBUILD script from the Arch opengl-man-pages package.
# $Id$
# Maintainer: AndyRTR <andyrtr#archlinux.org>
pkgname=opengl-man-pages
pkgver=20170404
_commit=03552a8094ae3017e0b8b2ad44c602f81c03e848
pkgrel=1
pkgdesc="OpenGL Man Pages"
arch=('any')
url="https://github.com/KhronosGroup/OpenGL-Refpages"
license=('custom')
# OpenGL 4.x (current) API and GLSL pages - libxslt' 'docbook-xsl'
# OpenGL 3.x and older 'w3c-mathml2' 'docbook-mathml'
makedepends=('libxslt' 'docbook-xsl' 'w3c-mathml2' 'docbook-mathml' 'git')
source=(${pkgname}::git+https://github.com/KhronosGroup/OpenGL-Refpages#commit=$_commit
'LICENSE')
sha256sums=('SKIP'
'a7b2f6669d7ead91dcaf5a03620cdf9d37c54d83fd1899b4ef84683c7e6d4024')
# gl2.1 = OpenGL 2.1 (including fixed functionality)
# es3 = OpenGL ES 3.x (will always be the latest ES, currently 3.2)
# gl4 = OpenGL 4.x (current) API and GLSL pages
_mandirs=(gl4 es3 gl2.1)
pkgver() {
date +%Y%m%d
}
build() {
export WD=`pwd`
xmlcatalog --create --noout \
--add public "-//W3C//DTD MathML 2.0//EN" "file:///usr/share/xml/w3c/mathml2/mathml2.dtd" \
--add public "-//W3C//DTD MathML//EN" "file:///usr/share/xml/w3c/mathml2/mathml2.dtd" \
--add system "http://www.w3.org/TR/MathML2/dtd/mathml2.dtd" "file:///usr/share/xml/w3c/mathml2/mathml2.dtd" \
mathml2.cat
export XML_CATALOG_FILES="$WD/mathml2.cat /etc/xml/catalog"
for manpages in ${_mandirs[#]}; do
cd "${srcdir}/${pkgname}/${manpages}"
for file in gl*.xml; do
xsltproc --noout --nonet /usr/share/xml/docbook/xsl-stylesheets-*/manpages/docbook.xsl ${file}
done
done
}
package() {
install -d "${pkgdir}/usr/share/man/man3"
for manpages in ${_mandirs[#]}; do
cd "${srcdir}/${pkgname}/${manpages}"
install -m644 *.3G "${pkgdir}/usr/share/man/man3/"
done
# license
install -D -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
I had to install some extra packages on my Debian Stretch box to build the documentation:
sudo apt-get install xsltproc docbook-xsl docbook-xsl-ns w3-dtd-mathml docbook-mathml

Related

yum + how to identify the installed rpm with lower version

The goal is to compare the list of rpms under folder /tmp/list_of_rpms to installed rpm, and if the package is installed with a lower version then print this rpm.
The approach to check if rpm is installed or not can be easily verified with
rpm -qi gssproxy-0.7.0-30.el7_9.x86_64.rpm
package gssproxy-0.7.0-30.el7_9.x86_64.rpm is not installed
but actually this rpm installed with lower version as
rpm -qa | grep gssproxy
gssproxy-0.7.0-29.el7.x86_64
Can we identify also if rpm is installed with lower version?
The approach to take the installed rpm by rpm -qa | grep gssproxy
and then comparing it to the rpm file /tmp/gssproxy-0.7.0-30.el7_9.x86_64.rpm by regex is very complicated.
There's a dedicated tool called rpmdev-vercmp for comparing RPM versions. It's in the yum-utils package. apparently in a package named rpmdevtools.
Untested, but hopefully sufficient to get you started:
for rpm in /tmp/list_of_rpms/*.rpm; do
base=${rpm#/tmp/list_of_rpms/}
pkg=${base%-*-*}
if installed=$(rpm -q "$base"); then
rpmdev-vercmp "$pkg" "$installed" >/dev/null 2>&1
case $? in 12) echo "$installed is less than $pkg";; esac
fi
done
This doesn't do anything for packages which are not installed at all; perhaps you want to add an else clause and add a notification about those, too?
Some background from https://www.golinuxhub.com/2018/06/how-to-compare-rpm-version-bash-script-python-linux-algorithm/ but the actual code in that has problems. Also, https://unix.stackexchange.com/questions/163702/bash-script-to-verify-that-an-rpm-is-at-least-at-a-given-version

How to Install compiler g++-4.8.5 in ubuntu 20.04

As the title said I can't install that specific version of g++ in my current ubuntu (20.04).
I have been trying the usual things as: sudo apt install g++- (and displaying all posibilities but there where only versions from 8 to 10). Same happend looking for gcc possibilities.
Also tried this: gist.github.com/application2000/73fd6f4bf1be6600a2cf9f56315a2d91 (same problem)
And after looking for a while I gave up in my research and ended up here. Hope someone with more wisdom than me can give my a hand with this.
These steps should work:
sudo dpkg --add-architecture i386
sudo apt update
sudo apt upgrade
sudo apt-get install gcc-multilib libstdc++6:i386
wget https://ftp.gnu.org/gnu/gcc/gcc-4.8.5/gcc-4.8.5.tar.bz2 --no-check-certificate
tar xf gcc-4.8.5.tar.bz2
# cd gcc-4.8.5
# ./contrib/download_prerequisites
# cd ..
sed -i -e 's/__attribute__/\/\/__attribute__/g' gcc-4.8.5/gcc/cp/cfns.h
sed -i 's/struct ucontext/ucontext_t/g' gcc-4.8.5/libgcc/config/i386/linux-unwind.h
mkdir xgcc-4.8.5
pushd xgcc-4.8.5
$PWD/../gcc-4.8.5/configure --enable-languages=c,c++ --prefix=/usr --enable-shared --enable-plugin --program-suffix=-4.8.5
make MAKEINFO="makeinfo --force" -j
sudo make install -j
Note that you have to uncomment the .../download_prerequisites on some platform. For me it worked without on Centos 7 or Ubuntu 20 with the mandatory packages installed:
Ubuntu/Debian:
sudo apt install make wget git gcc g++ lhasa libgmp-dev libmpfr-dev libmpc-dev flex bison gettext texinfo ncurses-dev autoconf rsync
Centos:
sudo yum install wget gcc gcc-c++ python git perl-Pod-Simple gperf patch autoconf automake make makedepend bison flex ncurses-devel gmp-devel mpfr-devel libmpc-devel gettext-devel texinfo
Few seconds later (/giggles) gcc-4.8.5 is installed and available.
Notes:
if you don't have the resources to run make -j omit -j or use -j4 (or a different number which is adequate for your system)
your milage may vary and you may need to install further i386 packages
Since I can't comment I will add to #bebbo solution that on an Ubuntu 20.04 I had to add to his steps patching the following patches:
Add an include to signal.h to libsanitizer/asan/asan_linux.cc
https://patchwork.ozlabs.org/project/gcc/patch/6824253.3U2boEivI2#devpool21/
change a line in libsanitizer/tsan/tsan_platform_linux.cc
as shown. line number may not be the one stated in the patch so search for the line that was changed. There is no need to apply the patch to the other files
https://git.pantherx.org/mirror/guix/commit/0b93d04ac537d6413999349ebe7cdcb1e961700e
Adding to kpeace's answer...
sed -i '/#include <pthread.h>/a #include <signal.h>' path_to_gcc4.8.5src/libsanitizer/asan/asan_linux.cc
sed -i 's/__res_state \\*statp = (__res_state\\*)state\\;/struct __res_state \\*statp = (struct __res_state\\*)state\\;/g' path_to_gcc4.8.5src/libsanitizer/tsan/tsan_platform_linux.cc
Just adding a couple of sed lines to patch them inline.
Also, I've been writing some Ruby scripts to install some software (for fun of course.) I've recently successfully compiled gcc-4.8.5 under LinuxMint 20.1 (Ubuntu 20.04 based, compiler is the system gcc: 9.3.0, installed with sudo apt install build-essential) with this script. Also, I've installed all the packages that Bebbo suggested, including gcc-multilib and libstdc++6:i386 before running this script. Check up InstGcc4 class at the bottom of the code.
install_gcc.rb
They might end up to be 'un-installable' state a few months later. But at least gcc-4.8.5 works now.
ps. I've started to compile this old gcc due to CUDA... My hardware is a decade old GeForce 9600/9400 (yeah 2008 MBP) and CUDA 6.5 was the best option for that machine.
pps. Anyway, strange thing is, I had to give out '-std=gnu++11' for CXXFLAGS to avoid errors.

Running OpenGL + SDL2 on AWS EC2

I'm using AWS EC2 Ubuntu 14.04 to test my OpenGL + SDL2 application. I am using SDL version 2.0.2. Because AWS EC2 is headless, I am using xvfb and use this script in /etc/init.d/xvfb:
XVFB=/usr/bin/Xvfb
XVFBARGS=":99 -ac -screen 0 1024x768x24"
PIDFILE=/tmp/cucumber_xvfb_99.pid
case "$1" in
start)
echo -n "Starting virtual X frame buffer: Xvfb"
/sbin/start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS
echo "."
;;
stop)
echo -n "Stopping virtual X frame buffer: Xvfb"
/sbin/start-stop-daemon --stop --quiet --pidfile $PIDFILE
rm -f $PIDFILE
echo "."
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: /etc/init.d/xvfb {start|stop|restart}"
exit 1
esac
exit 0
These are the linux command before i run the app :
export DISPLAY=:99.0
sh -e /etc/init.d/xvfb start
sleep 3
But I got "Failed to connect to the Mir Server" error from calling SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER)
I am actually doing this because I follow instruction from https://docs.travis-ci.com/user/gui-and-headless-browsers/ and want to do the same in my AWS machine. I tried it also with travis, and The xvfb script is also taken from travis ci setup.
Not sure if this is gonna help but these are the output from glxinfo | grep OpenGL :
OpenGL vendor string: VMware, Inc.
OpenGL renderer string: Gallium 0.4 on llvmpipe (LLVM 3.4, 256 bits)
OpenGL version string: 2.1 Mesa 10.1.3
OpenGL shading language version string: 1.30
OpenGL extensions:
So, I guess essentially my question is : how to setup OpenGL (preferably version 3) + SDL2 in headless Ubuntu 14.04 ?
Thanks in advance
You have two options.
Use a real X11 server. Headless OpenGL is not supported by most OpenGL implementations. This will allow you to use hardware acceleration. You will need to choose an EC2 instance with the right hardware support.
Use OSMesa. This will give you a software-only implementation that does not require X11 or any other window server at all.
It is normal / expected to get Gallium + llvmpipe as the implementation when hardware acceleration is not available. This is fine. If you need a newer version of OpenGL, you will want to install a newer version of Mesa. Mesa 10.1.3 is more than two years old at this point (it's from May 2014). Getting a newer version of Mesa either means using an alternate repo, installing a different version of Ubuntu, or compiling Mesa yourself.
If you compile Mesa yourself, you can configure it for OSMesa ("off-screen Mesa") which means it will have no dependencies on X11. See Off-screen Rendering for more details.
So, It turns out I need to put this into ~/.bashrc :
export DISPLAY=:99.0
sh -e /etc/init.d/xvfb stop
sh -e /etc/init.d/xvfb start
sleep 3
so that the above script will be run everytime I connect to the machine.
But then, I got a different error saying that the SDL_GL_CreateContext failed. Like #dietrich-app said, I need to update my mesa. The oibaf's graphic drivers ppa are no longer working (every google searches seem to suggest to use that) because it does not support ubuntu 14.04 anymore. I tried to compile mesa on my own but compiling dependencies are very time consuming and cumbersome. Finally, after hours of searching, I found this https://wiki.ubuntu.com/Kernel/LTSEnablementStack and copy paste the following command from that link :
sudo apt-get install --install-recommends linux-generic-lts-wily xserver-xorg-core-lts-wily xserver-xorg-lts-wily xserver-xorg-video-all-lts-wily xserver-xorg-input-all-lts-wily libwayland-egl1-mesa-lts-wily
And I got my mesa updated, and can now run OpenGL + SDL2 on AWS EC2 headless
Thank you for all the helpo

How to list current package versions in OPAM?

opam list -a lists all packages currently available at OPAM, but does not display the version number for packages which are not currently installed, as per the opam list --help output:
(...) the output format displays one package per line, and each line contains the name of the package, the installed version or -- if the package is not installed, (...)
How can I list all packages including their version numbers?
Use opam info <packagename>.
I guess opam list does only prints the versions of already installed packages because of the package dependencies. Listing the latest versions of packages, for example, of not-yet-installed packages is not quite useful.
A refined (and quicker) version of anol's answer is to give the whole list of packages to opam show in one pass (asking opam to output both package and version field), and to process the result with sed, as apparently show outputs each field on its own line:
opam show -f package,version $(opam list -a -s) \
| sed -e '/ *package:/N; s/ *package: \([^\n]*\)\n *version: \([^\n]*\)/\1: \2/'
This is not an ideal solution, but using camlspotter's recommandation, I manually queried each package for its version field, using the following shell loop:
for p in $(opam list -a -s); do echo "$p $(opam show -f version $p)"; done
It works, but it takes ~85 seconds to complete on my machine (querying over 1000 packages currently available).

Frama-C Gui on mavericks not working

Does anyone have installed Frama-C on Mavericks ?
Because i can't install it or do not know how to install it (Gui Version)!
I already installed ocaml on my pc, but for the Gui version i need to install these libraries : Gtk, GtkSourceView, GnomeCanvas and Lablgtk2.
So i saw a previous post and did that :
export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig
sudo port install opam
opam init
Y
eval `opam config env`
sudo port install gtksourceview2 lablgtk2 ocaml-ocamlgraph
opam install frama-c
Im' having a problem in making "make" with frama-c which is :
Ocamlc src/logic/property_status.cmo
File "src/logic/property_status.ml", line 1444, characters 4-2027:
Error: Signature mismatch:
...
Values do not match:
val vertex_attributes :
v ->
[> `Color of int
| `Label of string
| `Shape of [> `Box | `Diamond ]
| `Style of [> `Bold | `Filled ] list
| `Width of float ]
list
is not included in
val vertex_attributes :
V.t -> Graph.Graphviz.DotAttributes.vertex list
File "src/logic/property_status.ml", line 1479, characters 16-33:
Actual declaration
make: *** [src/logic/property_status.cmo] Error 2
How am i able to solve this ?
i've just successfully installed Frama-c neon (with Gui) on maverick, using opam and homebrew.
here's my walkthrough. (Thanks to tips above)
1) Install homebrew
$ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
2) Install opam:
$ brew install opam
$ opam init
(i had to modify .profile instead of .bashrc with f option)
$ eval `opam config env`
3) Install all dependencies
$ brew install gtk+
$ brew install gtksourceview
$ brew install libgnomecanvasmm libgnomecanvas
$ brew install lablgtk
4) Install Frama-c
$ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
$ opam install frama-c
If you prefer install dependencies with macports, change the PKG_CONFIG_PATH to /opt/X11/lib/pkgconfig as explained here
Hope this help
I have successfully installed frama-c Neon with gui on mavericks using brew to get all the dependencies and using the source code in http://frama-c.com/download.html . If you try to do it using brew, you should install lablgtk from this repository(https://github.com/mht208/homebrew-formal) and only after all the other dependencies so the commands to install with gui would be(in source folder):
brew install ocaml
brew install gtk
brew install gtksourceview
brew install gnomecanvasmm gnomecanvas
brew tap mht208/formal
brew install lmht208/formal/lablgtk -with-gnomecanvas -with-gtksourceview2
./configure
make
You can also install ocamlgraph with opam, and you can compile Zarith and install in your system.
Graph.Graphviz is from OCamlGraph. There seems to be an incompatibility between the two latest versions of each.
You'll have to add version contraints on the frama-c library, or change the Style attribute to have a list of the polymorphic variant set.
EDIT -
you don't need to install ocamlgraph via port, you should install that by opam as well.