Difference between revisions of "Building OSSv4 from source"

From Open Sound System
Jump to: navigation, search
m (Extract the source tarball)
m (Reverted edits by RobertColeman88 (talk) to last revision by Cesium)
 
(27 intermediate revisions by 4 users not shown)
Line 6: Line 6:
 
* OS system headers, development libraries
 
* OS system headers, development libraries
 
* Compiler: GCC, Sun Studio 10+, UnixWare C Compiler
 
* Compiler: GCC, Sun Studio 10+, UnixWare C Compiler
* Tools: GNU gawk - (Solaris versions at: http://www.sun.com/software/solaris/freeware/s10pkgs_download.xml) (used for creating man pages)
+
 
* Graphics Libraries: Runtime libraries and header files for GTK1 or for GTK2 (used by ossxmix)
+
==== Optional dependencies ====
 +
* Tools: GNU gawk - (Solaris versions at: http://www.sun.com/software/solaris/freeware/s10pkgs_download.xml). Used for creating man pages with txt2man. OSS fallbacks to a small C program to do this if gawk isn't there - result is uglier but usable.
 +
* Graphics Libraries: Runtime libraries and header files for GTK1 or for GTK2. Required to build the graphical mixer ossxmix.
 +
* Tools: libtool. Can be used only under Linux in order to build libsalsa.
  
 
=== Building the source ===
 
=== Building the source ===
  
Basic use of the build system is close to autoconf ("configure && make && make install"), with one very important difference: The OSS build system must use separate build and source directories (unlike GNU autoconf where both are mixed), so a command like "./configure" will NOT work. These instructions will show how it's used.
+
Basic use of the build system is close to autoconf-based build system ("configure && make && make install"), with one very important difference: The OSS build system must use separate build and source directories (unlike GNU autoconf where both are mixed), so a command like "./configure" will NOT work. These instructions will show how it's used.
  
==== Obtain the latest stable source tarball for the OSS package. ====
+
==== Obtain the OSS source ====
 +
<span id="Obtain the latest stable source tarball for the OSS package.></span>
  
 
[http://www.4front-tech.com/developer/sources/stable/gpl/ OSS Stable Releases]
 
[http://www.4front-tech.com/developer/sources/stable/gpl/ OSS Stable Releases]
Line 19: Line 23:
 
[http://www.4front-tech.com/developer/sources/testing/gpl/ OSS Current Testing Release]
 
[http://www.4front-tech.com/developer/sources/testing/gpl/ OSS Current Testing Release]
  
[http://mercurial.opensound.com/ Mercurial repository] - requires mercurial to get the source
+
[http://opensound.hg.sourceforge.net/hgweb/opensound Mercurial repository] - requires mercurial to get the source, e.g.
 
+
  hg clone http://opensound.hg.sourceforge.net/hgweb/opensound /usr/src/oss
==== Make the source directory, current ====
+
  
 +
==== Change to the source directory ====
 +
<span id="Make the source directory, current"></span>
 
  cd /usr/src
 
  cd /usr/src
  
 
==== Extract the source tarball ====
 
==== Extract the source tarball ====
 +
 +
This step is only needed if you didn't use mercurial earlier.
  
 
  tar -xvjf ~/oss-v*.tar.bz2
 
  tar -xvjf ~/oss-v*.tar.bz2
 
if you're using mercurial, instead use the repository you have cloned previously:
 
  mv http://mercurial.opensound.com /usr/src/oss
 
  
 
==== Create a build directory, and make it current ====
 
==== Create a build directory, and make it current ====
  
 +
rm -rf ~/oss
 
  mkdir ~/oss
 
  mkdir ~/oss
 
  cd ~/oss
 
  cd ~/oss
  
Do not use a directory which is a subdirectory of the extracted source - the configure script will fail.
+
The build directory must be empty.
 +
Under OSSv4.0 and OSSv4.1, do not use a directory which is a subdirectory of the extracted source - the configure script will fail.
  
 
==== Run the configure script ====
 
==== Run the configure script ====
  
Note that the configure script must be invoked using a full pathname. An error will occur during build, if a relative pathname is used
+
Note that the configure script must be invoked using a full pathname when compiling OSSv4 version 4.0, as its configure script will fail if a relative pathname is used.
 +
 
 +
/usr/src/oss*/configure
  
/usr/src/oss-v*/configure
+
===== Notable configure switches (optional) =====
 +
<span id="Notable configure switches"></span>
 +
* GTK1 environment variable: Force use of GTK1 for ossxmix rather than GTK2.
 +
* NO_WARNING_CHECKS env var: don't use -Werror and -Wall flags.
 +
* --only-drv=[list]: Compile only the drivers listed in the comma delimited list. Note: don't forget oss_ prefix e.g. oss_audigyls
 +
* --config-vmix=NO|FLOAT|FIXEDPOINT: Don't compile vmix (NO)/Use only integer arithmetic for vmix (FIXEDPOINT)/Use floating arithmatic (FLOAT). Compiling on Linux defaults to FLOAT, all else defaults to FIXEDPOINT.
 +
* --enable-libsalsa=NO: Don't build libsalsa (Linux only - other OSs don't build libsalsa).
  
 
==== Run make build ====
 
==== Run make build ====
Line 57: Line 71:
 
There are two alternative targets when compiling for the Linux OS:
 
There are two alternative targets when compiling for the Linux OS:
  
*make tarball
 
 
*make deb
 
*make deb
 +
*make tarball
 +
 +
The first creates a OSS package in debian's DEB format. The second creates a tarball of OSS.
  
 
==== Installing the OSS kernel modules ====
 
==== Installing the OSS kernel modules ====
  
The kernel modules are build during a separate phase of the installation. It is necessary to become root to build the kernel modules:
+
The kernel modules are built during a separate phase of the installation. It is necessary to become root to build the kernel modules:
  
 
   su root
 
   su root
Line 68: Line 84:
  
 
This will create the appropriate kernel modules, and the Open Sound System tools.
 
This will create the appropriate kernel modules, and the Open Sound System tools.
 +
 +
* Alternately, you can install the package created by the package targets above to the same effect as the "make install" command.
  
 
Installation is now complete.
 
Installation is now complete.
Line 97: Line 115:
 
=== Error: Too many levels of symbolic links ===
 
=== Error: Too many levels of symbolic links ===
  
This error may occur when the configure script is being run within a subdirectory of the project directory:
+
This error may occur when the configure script is being run within a subdirectory of the source directory. The problem does not occur in OSS v4.2 and above as it has been modified to support this.
  
 
  # This may produce an error
 
  # This may produce an error
Line 122: Line 140:
 
=== Error: No such file or directory ===
 
=== Error: No such file or directory ===
  
The configure script must be invoked using a full pathname. This error occurs, if a relative pathname is used. This restriction does not apply to 4.1.
+
The configure script must be invoked using a full pathname. This error occurs, if a relative pathname is used. This restriction does not apply to version 4.1 and above.
  
 
  Scanning .
 
  Scanning .
Line 132: Line 150:
  
 
Invoke the configure script with a full pathname.
 
Invoke the configure script with a full pathname.
 +
 +
----
  
 
=== Error: undefined reference to `oss_strcmp' ===
 
=== Error: undefined reference to `oss_strcmp' ===
Line 142: Line 162:
  
 
----
 
----
 +
 +
=== Error related to "warnings being treated as errors" ===
 +
 +
  cc1: warnings being treated as errors
 +
 +
==== Resolution ====
 +
 +
OSS compile uses -Wall and -Werror. A few compilers/headers may be more strict than the usual, causing the compile to fail. Set the NO_WARNING_CHECKS environment variable when calling configure to avoid this.
 +
 +
----
 +
 +
=== Error: /bin/sh: scripts/mod/modpost: No such file or directory ===
 +
 +
This error may occur during "make install". The error occurs because the kernel headers scripts have not been built.
 +
 +
==== Resolution ====
 +
 +
Build the kernel header scripts as follows:
 +
 +
cd /usr/src/linux
 +
make scripts
 +
 +
----
 +
 +
=== Error: cp: cannot stat `lib/libsalsa/.libs/libsalsa.so.2.0.0': No such file or directory ===
 +
 +
This error occurs during compilation.
 +
 +
==== Resolution ====
 +
 +
This error can be safely ignored.
 +
 +
=== Error: No rule to make target `/usr/lib/oss/build/osscore_mainline.c', needed by `/usr/lib/oss/build/osscore_mainline.o'. Stop.  ===
 +
 +
This error occurs during installation.
 +
 +
==== Resolution ====
 +
 +
"--only-drv" switch requires to keep "oss_" prefix ("--only-drv=oss_sblive,oss_hdaudio").
 +
 +
== Notes ==
 +
 +
=== Speeding up compiling ===
 +
*--only-drv switch can be used to only compile the drivers the system uses. "ossinfo", "ossdetect -v" or devices.list file can be used to get the names of the drivers.
 +
* --config-midi=NO and --enable-libsalsa=NO (Linux only) can be used to disable compiling of MIDI support and of libsalsa.
 +
 +
=== The Open Sound System on Linux/geode ===
 +
geode processors don't have the necessary floating point support for floating point arithmetic used by vmix FLOAT mode. The parameter --config-vmix=FIXEDPOINT should be used to make vmix use integer fixed point arithmetic.

Latest revision as of 16:30, 26 July 2012

Building the OSS sound system from source

Requirements to build the source code

  • OS: Linux 2.6+, Solaris v10+, FreeBSD 6+, UnixWare7
  • OS system headers, development libraries
  • Compiler: GCC, Sun Studio 10+, UnixWare C Compiler

Optional dependencies

  • Tools: GNU gawk - (Solaris versions at: http://www.sun.com/software/solaris/freeware/s10pkgs_download.xml). Used for creating man pages with txt2man. OSS fallbacks to a small C program to do this if gawk isn't there - result is uglier but usable.
  • Graphics Libraries: Runtime libraries and header files for GTK1 or for GTK2. Required to build the graphical mixer ossxmix.
  • Tools: libtool. Can be used only under Linux in order to build libsalsa.

Building the source

Basic use of the build system is close to autoconf-based build system ("configure && make && make install"), with one very important difference: The OSS build system must use separate build and source directories (unlike GNU autoconf where both are mixed), so a command like "./configure" will NOT work. These instructions will show how it's used.

Obtain the OSS source

OSS Stable Releases

OSS Current Testing Release

Mercurial repository - requires mercurial to get the source, e.g.

  hg clone http://opensound.hg.sourceforge.net/hgweb/opensound /usr/src/oss

Change to the source directory

cd /usr/src

Extract the source tarball

This step is only needed if you didn't use mercurial earlier.

tar -xvjf ~/oss-v*.tar.bz2

Create a build directory, and make it current

rm -rf ~/oss
mkdir ~/oss
cd ~/oss

The build directory must be empty. Under OSSv4.0 and OSSv4.1, do not use a directory which is a subdirectory of the extracted source - the configure script will fail.

Run the configure script

Note that the configure script must be invoked using a full pathname when compiling OSSv4 version 4.0, as its configure script will fail if a relative pathname is used.

/usr/src/oss*/configure
Notable configure switches (optional)

  • GTK1 environment variable: Force use of GTK1 for ossxmix rather than GTK2.
  • NO_WARNING_CHECKS env var: don't use -Werror and -Wall flags.
  • --only-drv=[list]: Compile only the drivers listed in the comma delimited list. Note: don't forget oss_ prefix e.g. oss_audigyls
  • --config-vmix=NO|FLOAT|FIXEDPOINT: Don't compile vmix (NO)/Use only integer arithmetic for vmix (FIXEDPOINT)/Use floating arithmatic (FLOAT). Compiling on Linux defaults to FLOAT, all else defaults to FIXEDPOINT.
  • --enable-libsalsa=NO: Don't build libsalsa (Linux only - other OSs don't build libsalsa).

Run make build

 make build

Packing Open Sound System (optional)

 make package

The package target creates a native package for the currently compiled-for OS. On Linux an RPM package will be generated.

There are two alternative targets when compiling for the Linux OS:

  • make deb
  • make tarball

The first creates a OSS package in debian's DEB format. The second creates a tarball of OSS.

Installing the OSS kernel modules

The kernel modules are built during a separate phase of the installation. It is necessary to become root to build the kernel modules:

 su root
 make install

This will create the appropriate kernel modules, and the Open Sound System tools.

  • Alternately, you can install the package created by the package targets above to the same effect as the "make install" command.

Installation is now complete.

Testing the Open Sound System

To test the Open Sound System:

soundon
osstest

Errors during build

Error: Cannot open: No such file or directory

This error can occur when tar tries to extract to /usr/src but doesn't have write permissions.

bunzip2 -c /tmp/oss-v4.1-build*-src-gpl.tar.bz2 | tar xvf -
oss-v4.1-build080509-src-gpl/RELNOTES.txt 
tar: oss-v4.1-build080509-src-gpl/RELNOTES.txt: Cannot open: No such file or directory 
tar: Error exit delayed from previous errors

Resolution

Use a directory which you have write permissions to, or change to root (su/sudo), or change /usr/src permissions to allow writing.


Error: Too many levels of symbolic links

This error may occur when the configure script is being run within a subdirectory of the source directory. The problem does not occur in OSS v4.2 and above as it has been modified to support this.

# This may produce an error
cd ~/oss-v*
mkdir build
cd build
../configure

This produces an error:

../build/cmd/.config: Too many levels of symbolic links

Resolution

Use a build directory outside of the current project directory:

cd
mkdir oss
cd oss
/usr/src/oss/oss-v*/configure

Error: No such file or directory

The configure script must be invoked using a full pathname. This error occurs, if a relative pathname is used. This restriction does not apply to version 4.1 and above.

Scanning .
Scanning ./cmd
Scanning ./cmd/ossdevlinks
./cmd/ossdevlinks/ossdevlinks.c: No such file or directory

Resolution

Invoke the configure script with a full pathname.


Error: undefined reference to `oss_strcmp'

ossdevlinks.c:(.text+0x21c): undefined reference to `oss_strcmp'

Resolution

You probably have had CFLAGS, OSFLAGS or LIBRARIES set in the environment before running configure. The best option is to unset them all and not to try to pass manual flags via configure - it's unlikely any flags will provide any performance gain at all, and far more likely they'll make the compilation fail somewhere.


Error related to "warnings being treated as errors"

 cc1: warnings being treated as errors

Resolution

OSS compile uses -Wall and -Werror. A few compilers/headers may be more strict than the usual, causing the compile to fail. Set the NO_WARNING_CHECKS environment variable when calling configure to avoid this.


Error: /bin/sh: scripts/mod/modpost: No such file or directory

This error may occur during "make install". The error occurs because the kernel headers scripts have not been built.

Resolution

Build the kernel header scripts as follows:

cd /usr/src/linux
make scripts

Error: cp: cannot stat `lib/libsalsa/.libs/libsalsa.so.2.0.0': No such file or directory

This error occurs during compilation.

Resolution

This error can be safely ignored.

Error: No rule to make target `/usr/lib/oss/build/osscore_mainline.c', needed by `/usr/lib/oss/build/osscore_mainline.o'. Stop.

This error occurs during installation.

Resolution

"--only-drv" switch requires to keep "oss_" prefix ("--only-drv=oss_sblive,oss_hdaudio").

Notes

Speeding up compiling

  • --only-drv switch can be used to only compile the drivers the system uses. "ossinfo", "ossdetect -v" or devices.list file can be used to get the names of the drivers.
  • --config-midi=NO and --enable-libsalsa=NO (Linux only) can be used to disable compiling of MIDI support and of libsalsa.

The Open Sound System on Linux/geode

geode processors don't have the necessary floating point support for floating point arithmetic used by vmix FLOAT mode. The parameter --config-vmix=FIXEDPOINT should be used to make vmix use integer fixed point arithmetic.