In order to write code playing an ogg vorbis file on Ubuntu18, I installed openal and alut, then I downloaded libogg-1.3.3 and libvorbis-1.3.6 and did the following:
./configure
make
sudo make install
There are no errors as far as I can see, they seem to be installed in my linux system.
I copied a demo. I could append the entire code, it's not very big. For reference, the code was here: https://www.gamedev.net/articles/programming/general-and-gameplay-programming/introduction-to-ogg-vorbis-r2031/
#include <AL/al.h>
#include <AL/alut.h>
#include <vorbis/vorbisfile.h>
#include <cstdio>
#include <iostream>
#include <vector>
constexpr int BUFFER_SIZE=32768;     // 32 KB buffers
using namespace std;
void loadOgg(const char fileName[],
                         vector < char > &buffer,
                         ALenum &format, ALsizei &freq) {
  int endian = 0;             // 0 for Little-Endian, 1 for Big-Endian
  int bitStream;
  long bytes;
  char array[BUFFER_SIZE];    // Local fixed size array
  FILE *f = fopen(fileName, "rb");
  vorbis_info *pInfo;
  OggVorbis_File oggFile;
  ov_open(f, &oggFile, NULL, 0);
  pInfo = ov_info(&oggFile, -1);
  format = pInfo->channels == 1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16;
  freq = pInfo->rate;
  // decode the OGG file and put the raw audio dat into the buffer
  do {
    // Read up to a buffer's worth of decoded sound data
    bytes = ov_read(&oggFile, array, BUFFER_SIZE, endian, 2, 1, &bitStream);
    // Append to end of buffer
    buffer.insert(buffer.end(), array, array + bytes);
  } while (bytes > 0);
  ov_clear(&oggFile); // release the file resources at the end
}
int main(int argc, char *argv[]) {
  ALint state;             // The state of the sound source
  ALuint bufferID;         // The OpenAL sound buffer ID
  ALuint sourceID;         // The OpenAL sound source
  ALenum format;           // The sound data format
  ALsizei freq;            // The frequency of the sound data
  vector<char> buffer;     // The sound buffer data from file
  // Initialize the OpenAL library
  alutInit(&argc, argv);
  // Create sound buffer and source
  alGenBuffers(1, &bufferID);
  alGenSources(1, &sourceID);
  // Set the source and listener to the same location
  alListener3f(AL_POSITION, 0.0f, 0.0f, 0.0f);
  alSource3f(sourceID, AL_POSITION, 0.0f, 0.0f, 0.0f);
    loadOgg(argv[1], buffer, format, freq);
}
To compile:
g++ -g playSound.cc -lopenal -lalut -logg -lvorbis
There are no errors complaining that any of the libraries are not found, yet there is an undefined symbol ov_open, ov_info, ov_read
Since I assume these symbols are either in libogg or libvorbis, I tried removing the -logg -lvorbis (same result) and then as a sanity check, I tried linking to a fake library (-lfugu) which gave me an error because fugu does not exist. So clearly the link is finding the ogg and vorbis libraries, but not defining those symbols.
