bbc / audiowaveform

C++ program to generate waveform data and render waveform images from audio files
https://waveform.prototyping.bbc.co.uk
GNU General Public License v3.0
1.9k stars 242 forks source link

How to install on Amazon Lambda? #35

Open renatoargh opened 8 years ago

renatoargh commented 8 years ago

I have successfully installed audiowaveform on Amazon Linux (which is the same OS for Amazon Lambda), but I can't seem to find a way to create a unique executable file that will include all shared libraries in which audiowaveform depends upon (running ldd audiowaveform shows a lot of them). I can't think of any other way to achieve this. Any hints?

Being able to do this means that I would be able to run it on-demand not worrying about provisioning any EC2 servers (and then saving a lot of $ since my demand is very low).

thom4parisot commented 8 years ago

Probably best way would be to make a Node.js native addon to wrap the sources and to compile it for the adequate platform target.

renatoargh commented 8 years ago

I will try implementing this (node native add-ons) and will post any progress or further questions here.

thom4parisot commented 8 years ago

Perfect @renatoargh :-)

jon-mann commented 8 years ago

hey @renatoargh, did you have any luck?

bradddd commented 8 years ago

Has anyone gotten this to work yet?

chrisn commented 8 years ago

The article Running Arbitrary Executables in AWS Lambda has some useful information:

If you compile your own binaries, ensure that they’re either statically linked or built for the matching version of Amazon Linux. The current version of Amazon Linux in use within AWS Lambda can always be found on the Supported Versions page of the Lambda docs.

So, the first thing to do is modify CMakeLists.txt to enable (optional) static linking.

holmesal commented 7 years ago

Has anyone succeeded in getting this to work?

alexwhittemore commented 7 years ago

Hey y'all, in particular @chrisn - I've dug in with CMakeLists.txt and discerned that I need to be linking the .a static copies of the dependencies by setting set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") before all the references to find_package() that I want linked statically, for example, before

find_package(LibId3Tag REQUIRED)
if(LIBID3TAG_FOUND)
    message(STATUS "LIBID3TAG_INCLUDE_DIR='${LIBID3TAG_INCLUDE_DIR}'")
    message(STATUS "LIBID3TAG_LIBRARY=${LIBID3TAG_LIBRARY}")
    include_directories(${LIBID3TAG_INCLUDE_DIR})
endif(LIBID3TAG_FOUND)

I figured out that if I use readelf, I can determine what libraries THESE depend on, for example, readelf -d /usr/lib/libid3tag.so gives me

Dynamic section at offset 0x17da0 contains 26 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libz.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000e (SONAME)             Library soname: [libid3tag.so.0]

In other words, libid3tag.so depends on libz and libc (the standard library). If I do this same thing for libz, I find that it depends on only libc, so i've hit the end of the dependency tree.

In order to satisfy this dependency before static linking, I got to the point of including it in my CMakeLists.txt before libid3tag:

find_package( ZLIB REQUIRED )
if ( ZLIB_FOUND )
    message(STATUS "ZLIB_INCLUDE_DIRS=${ZLIB_INCLUDE_DIRS}")
    include_directories( ${ZLIB_INCLUDE_DIRS} )
endif( ZLIB_FOUND )

In some cases, these dependencies are satisfied by "FindX.cmake" definitions that ship with cmake. In this case, I had to dig around online to find a "Findzlib.cmake" that works to drop in my cmake/modules directory with the others.

So two questions:

First) If I want to statically link this, do I seriously have to chase down the entire dependency tree and add directives to find and include all those things? Is there no shorthand way that cmake does this automatically for me? It feels like a tremendous repetition of labor that someone must have come across before.

Second) This strategy worked great for libid3tag - I found the one dependency, zlib, and included libz.a with the above find_package. Using readelf on the primary target output (audiowaveform), I determine that, yes, libid3tag gets statically linked and no longer shows up as a dynamic dependency. Cool! BUT, I extrapolated the process to LibGD, which has a longer list of deps:


# LibGD Requires:
# libjpeg
# libz
# libpng12
# libfreetype
# libfontconfig
# libXpm
# libvpx
# libm
# libtiff

Despite putting libz before both LibGD and LibId3Tag, my compliation now fails:

/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libpng.a(libpng12_la-png.o): In function `png_reset_crc':
(.text+0x1ab): undefined reference to `crc32'

That's super confusing to me, because crc32 is a function in zlib, and should already be statically linked in my output. So why is the linker complaining that it's not found?

I'd sure love a little more guidance from someone who perhaps knows how the toolchain works.

EDIT: Oh, for the benefit of others - I left out a detail or two above. Namely, here's my "Linker" section:

#-------------------------------------------------------------------------------
#
# Linker
#
#-------------------------------------------------------------------------------

# Statically link everything?
#Static start
#set_target_properties(audiowaveform PROPERTIES LINK_SEARCH_START_STATIC 1)
#set_target_properties(audiowaveform PROPERTIES LINK_SEARCH_END_STATIC 1)
#set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")

# Specify libraries to link against.
set(LIBS ${LIBSNDFILE_LIBRARY} ${ZLIB_LIBRARY} ${JPEG_LIBRARIES} ${ZLIB_LIBRARY} ${PNG_LIBRARIES} ${FREETYPE_LIBRARIES} ${FONTCONFIG_LIBRARIES} ${XPM_LIBRARIES} ${VPX_LIBRARIES} ${TIFF_LIBRARIES} ${LIBGD_LIBRARY} ${LIBMAD_LIBRARY} ${ZLIB_LIBRARY} ${LIBID3TAG_LIBRARY} ${Boost_LIBRARIES})
target_link_libraries(audiowaveform ${LIBS})

The critical bit is set(LIBS... which now includes all the dependencies I manually chased down above. The three commented out lines are things I came across before, but that I don't really know the meaning of. And they didn't seem to be required for getting the simple case of static-libid3tag-only up and running.

georgebohnisch commented 7 years ago

Need this for Lambda as well. @alexwhittemore any luck? If we can get the static binary I can publish a repo with the working Lambda config.

alexwhittemore commented 7 years ago

@georgebohnisch Still WIP. I took a break on it for a few days to come back with fresh eyes.

holmesal commented 7 years ago

We weren't able to get this working using the method @alexwhittemore was chasing down above, but we did come across a commercial product called Ermine that allowed us to bundle this up and deploy it on AWS Lambda - it was quite easy once we bought the license.

It's a paid product so it might not be the right option for everyone here, but I wanted to make it known in case anyone else is in the same boat as us.

ffxsam commented 7 years ago

I got this working on Lambda. To save everyone else the heavy lifting, feel free to grab this:

http://ffxsam.s3.amazonaws.com/public/audiowaveform-lambda.zip

When you package up your Lambda function, leave the bin and lib folders intact. Lambda's environment will automatically have /var/task/lib in LD_LIBRARY_PATH so no extra work there is needed. However, you will have to add the bin folder to the path inside your exports.handler function:

process.env.PATH =
    process.env.PATH + ':' + process.env.LAMBDA_TASK_ROOT + '/bin';

Then you can use Node.js to execute audiowaveform.

I know it's not an ideal solution, so if anyone ever figures out how to statically link all those library files into a single binary, please reply to this thread!

chrisn commented 7 years ago

Thanks so much for your contribution, Sam.

georgebohnisch commented 6 years ago

Thanks @ffxsam!

alexwhittemore commented 6 years ago

If it fits it ships! Great contribution @ffxsam

georgebohnisch commented 6 years ago

@ffxsam can you post a sample of your lambda script to get this working?

ffxsam commented 6 years ago

@georgebohnisch The code is proprietary so I can't share the whole thing, but this is the relevant part:

execute(`audiowaveform -i ${wavFilename} --pixels-per-second ${pps} -b 8 -o ${peaksFilename}`).then(() => {
  // do something else
});

With execute defined as:

function execute(command) {
  return new Promise((resolve, reject) => {
    const exec = require('child_process').exec;
    let output = '';
    const child = exec(command, error => {
      if (error) reject(error);
      else resolve(output);
    });

    child.stderr.on('data', data => {
      output += data.toString();
    });
  });
}
ojczeo commented 6 years ago

@ffxsam how do format input/output params for audiowaveform (in your example wavFilename and peaksFilename)? I have problem with accessing files stored at s3? Does audiowaveform handle s3 streams? in my case seems not. Should I copy file first to Lambda tmp directory? How to do that. When I copy file error happens anyway.

Error logs below:

Request ID:
"eed2f9ba-5828-11e8-9f6d-35c41cb7d06f"

Function Logs:
START RequestId: eed2f9ba-5828-11e8-9f6d-35c41cb7d06f Version: $LATEST
2018-05-15T10:15:46.426Z    eed2f9ba-5828-11e8-9f6d-35c41cb7d06f    {"errorMessage":"Command failed: audiowaveform -i /tmp/tmp_file -w 1920 -h 1080 -c audition --pixels-per-second 1000 -b 16 -o /tmp/09a4f4c7-51d5-4564-94f9-12e471709d61.png
Can't generate \"/tmp/09a4f4c7-51d5-4564-94f9-12e471709d61.png\" from \"/tmp/tmp_file\"
","errorType":"Error","stackTrace":["Can't generate \"/tmp/09a4f4c7-51d5-4564-94f9-12e471709d61.png\" from \"/tmp/tmp_file\"","","ChildProcess.exithandler (child_process.js:275:12)","emitTwo (events.js:126:13)","ChildProcess.emit (events.js:214:7)","maybeClose (internal/child_process.js:925:16)","Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)"]}
2018-05-15T10:15:46.426Z    eed2f9ba-5828-11e8-9f6d-35c41cb7d06f    audiowaveform error:  { Error: Command failed: audiowaveform -i /tmp/tmp_file -w 1920 -h 1080 -c audition --pixels-per-second 1000 -b 16 -o /tmp/09a4f4c7-51d5-4564-94f9-12e471709d61.png
Can't generate "/tmp/09a4f4c7-51d5-4564-94f9-12e471709d61.png" from "/tmp/tmp_file"

    at ChildProcess.exithandler (child_process.js:275:12)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
  killed: false,
  code: 1,
  signal: null,
  cmd: 'audiowaveform -i /tmp/tmp_file -w 1920 -h 1080 -c audition --pixels-per-second 1000 -b 16 -o /tmp/09a4f4c7-51d5-4564-94f9-12e471709d61.png' }
END RequestId: eed2f9ba-5828-11e8-9f6d-35c41cb7d06f
REPORT RequestId: eed2f9ba-5828-11e8-9f6d-35c41cb7d06f  Duration: 18.54 ms  Billed Duration: 100 ms     Memory Size: 1024 MB    Max Memory Used: 36 MB  
ojczeo commented 6 years ago

I finally resolved problem with Lambda, here's a script, might be useful for somebody: https://gist.github.com/ojczeo/1f7325b438945bb4878941fb2ebb8409

chrisn commented 6 years ago

The static-link branch allows audiowaveform to be linked statically against libgd, libsndfile, etc. See README.md for details on how to build. I haven't tried deploying the resulting binary to Lambda, feedback welcome.

ajbarber commented 5 years ago

The static-link branch allows audiowaveform to be linked statically against libgd, libsndfile, etc. See README.md for details on how to build. I haven't tried deploying the resulting binary to Lambda, feedback welcome.

I can build statically successfully, following the instructions on the main README. As for deploying to AWS lambda, there is no need to use the archived binaries attached above anymore....

ffxsam commented 5 years ago

@ajbarber Great news, and good timing for me! I'll see if I can do a static build on an Amazon Linux EC2 (so it's Lambda-compatible).

ffxsam commented 5 years ago

The static-link branch allows audiowaveform to be linked statically against libgd, libsndfile, etc. See README.md for details on how to build. I haven't tried deploying the resulting binary to Lambda, feedback welcome.

@chrisn What is this static-link branch? I don't see that branch in this repo.

ffxsam commented 5 years ago

@ajbarber I don't know how you got this to build. I tried to install the dependencies:

$ sudo yum install git make cmake gcc-c++ libmad-devel   libid3tag-devel libsndfile-devel gd-devel boost-devel

and get:

No package libmad-devel available.
No package libid3tag-devel available.
No package libsndfile-devel available.
alexwhittemore commented 5 years ago

@ffxsam looks like it's not actually a branch, but just a makefile flag option that's been added to the current master (haven't tested though).

ffxsam commented 5 years ago

Also:

-- Build type not specified: default is Release
-- CMAKE_VERSION=2.8.12.2
-- Build type: Release
-- CMAKE_MODULE_PATH='/home/ec2-user/audiowaveform/cmake/modules'
-- Building version 1.3.3
-- Static build
-- Could NOT find ZLIB (missing:  ZLIB_LIBRARY) (found version "1.2.8")
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
  Could NOT find PNG (missing: PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake/Modules/FindPNG.cmake:105 (find_package_handle_standard_args)
  cmake/modules/FindLibGD.cmake:39 (find_package)
  CMakeLists.txt:81 (find_package)

-- Configuring incomplete, errors occurred!

Can anyone help with this? These libraries are installed globally. Not sure why cmake is not seeing them. Once I get it solved, I can update the repo's README for instructions specific to Amazon Linux.

ajbarber commented 5 years ago

Also:

-- Build type not specified: default is Release
-- CMAKE_VERSION=2.8.12.2
-- Build type: Release
-- CMAKE_MODULE_PATH='/home/ec2-user/audiowaveform/cmake/modules'
-- Building version 1.3.3
-- Static build
-- Could NOT find ZLIB (missing:  ZLIB_LIBRARY) (found version "1.2.8")
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
  Could NOT find PNG (missing: PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake/Modules/FindPNG.cmake:105 (find_package_handle_standard_args)
  cmake/modules/FindLibGD.cmake:39 (find_package)
  CMakeLists.txt:81 (find_package)

-- Configuring incomplete, errors occurred!

Can anyone help with this? These libraries are installed globally. Not sure why cmake is not seeing them. Once I get it solved, I can update the repo's README for instructions specific to Amazon Linux.

Cmake is complaining as the static versions of these libraries (i.e suffix .a) are either not installed on your system (likely) or it can't find them (unlikely) :smile:

ajbarber commented 5 years ago

To help anyone who just wants a binary here is my Dockerfile:

FROM ubuntu:14.04
RUN apt-get update
RUN apt-get --assume-yes install wget libstdc++6-4.7-dev libc6-dev git make cmake gcc g++ libmad0-dev \
  libid3tag0-dev libsndfile1-dev libgd-dev libboost-filesystem-dev \
  libboost-program-options-dev \
  libboost-regex-dev

COPY ./build.sh build.sh
RUN chmod +x build.sh
RUN ./build.sh

and here is the build script build.sh

#!/bin/bash
git clone https://github.com/bbc/audiowaveform.git
cd audiowaveform
wget https://github.com/google/googletest/archive/release-1.8.0.tar.gz
tar xzf release-1.8.0.tar.gz
ln -s googletest-release-1.8.0/googletest googletest
ln -s googletest-release-1.8.0/googlemock googlemock
mkdir build
cd build
cmake -D BUILD_STATIC=1 ..
make
ffxsam commented 5 years ago

@ajbarber

Cmake is complaining as the static versions of these libraries (i.e suffix .a) are either not installed on your system (likely) or it can't find them (unlikely)

Aha. I had to do sudo yum install libpng-static zlib-static. But now I get:

CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
  Could NOT find LibFLAC (missing: LIBFLAC_LIBRARIES)

And there is no FLAC library in the yum repository. Seems like I might have to manually build it. 😫

EDIT: I'm slowly building all the required libraries manually. Too bad this is really not a more straightforward process!

chrisn commented 5 years ago

@ffxsam The static-link branch was merged to master back in July last year.

chrisn commented 5 years ago

IIRC not all of the dependencies are provided with static libraries, some are only distributed with shared libraries (.so). For those, your only option would be to build the library from source.

ffxsam commented 5 years ago

@chrisn Yep, I got that part (had to manually build a bunch of stuff). I've opened a new issue as it's somewhat unrelated at this point (libgd is the last one that won't seem to be built into the executable). #86

raedatoui commented 4 years ago

I got this working without static compiling https://gist.github.com/raedatoui/a0b06c1b239a7ca35b9df29245a82a6f

chrisn commented 4 years ago

@raedatoui Awesome! Do you mind if I include this info in our documentation?

ffxsam commented 4 years ago

Giving this a spin. Needs a bit more documentation, like how to actually compile and get the binary out in a single step. Also, if it's not using static compiling, doesn't that mean it relies on external libraries which we don't want in a Lambda environment?

Also, compile.sh needs cd / before this line: git clone https://github.com/bbc/audiowaveform.git

ffxsam commented 4 years ago

@raedatoui Thanks for the Docker setup. It does compile, but as it's not a static build, it won't work in a Lambda function.

ajbarber commented 4 years ago

I've been running the Dockerfile https://github.com/bbc/audiowaveform/issues/35#issuecomment-474612570 above in a production lambda for about 9 months now. You build it in the ubuntu container, copy it out as part of an npm build step into a bin folder, then deploy your lambda. Not sure why you would do it any other way for lambda :smile:

Here is my scripts in package.json if it helps anyone:

"scripts": { "test": "jasmine", "make-bin": "docker build . -t wavecontainer", "make-install": "id=$(docker create wavecontainer); docker cp $id:/audiowaveform/build/audiowaveform ./bin/audiowaveform; docker rm -v $id && echo \"Binary available in bin directory\" && exit 0", "make-clean": "docker rm -f /wavecontainer" },

@ffxsam The make-install step above will get the audiowaveform binary out of the container for you.

ffxsam commented 4 years ago

You build it in the ubuntu container, copy it out as part of an npm build step into a bin folder, then deploy your lambda.

But a binary built on Ubuntu wouldn't run on Lambda since it's Amazon Linux (which I think is based on CentOS).

EDIT: Wait, whaaaaat?! I just tried it and it worked. Since when is this possible? I remember trying to run Ubuntu binaries on Lambda before and it didn't work.

That said, when I compiled audiowaveform, I got it down to 1.6MB. Any idea why yours is 4.7MB?

ajbarber commented 4 years ago

re EDIT: It shouldn't matter as it is statically linked, the only thing it is looking for on the lambda instance is a few core c libraries, which as long as they are in sensible places, the runtime linking will find them. So you could build on a number of 64 bit linux distro containers and it will work. Well excluding size optimised containers like Alpine, although they may work too...

EDIT: Wait, whaaaaat?! I just tried it and it worked. Since when is this possible? I remember trying to run Ubuntu binaries on Lambda before and it didn't work.

Since always :), different distros just means that things may be in different places. however that doesn't concern us as we are compiling (almost) everything we need in to the binary.

To see what is driving the size difference, you would have to build the binary in my container and compare to yours using ldd audiowaveform.

raedatoui commented 4 years ago

@ffxsam if I add this binary and libmad.so to the lambda package, and add a python wrapper that uses the subprocess module, it wouldnt work? seems that @ajbarber got the same working. I didnt compile this on ubuntu, i compile it on a amazonlinux just for consistency

ffxsam commented 4 years ago

@ajbarber Ok, so this is the smaller version:

    linux-vdso.so.1 =>  (0x00007ffd8feec000)
    libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007f7f4cf55000)
    libm.so.6 => /lib64/libm.so.6 (0x00007f7f4cc53000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f7f4ca3d000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f7f4c670000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f7f4d259000)

and the 4.7MB build:

    linux-vdso.so.1 =>  (0x00007ffdb273f000)
    libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007f588dc3d000)
    libm.so.6 => /lib64/libm.so.6 (0x00007f588d93b000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f588d725000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f588d358000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f588df41000)

@raedatoui It might..? Not totally sure.

ajbarber commented 4 years ago

@ffxsam I see, I intially thought it might be that the smaller binary was not compiling in some library or other, however your terminal dump there shows they are the same.

In that case one of the dev dependencies pulled in from the ubuntu package manager could be bloated for some reason, perhaps with debug symbols for example, or some other nested ancillary dependency which was not captured in your alternative smaller build, and which we clearly don't need in a production build.

ffxsam commented 4 years ago

Hey, I'm working on a modification of your Dockerfile and script that will build using Amazon Linux. I need help though.. been at this for hours and I'm stuck now.

Unfortunately, on Amazon Linux, the libraries in the yum repository are not static.. (most of the ones needed, anyway). So I had to grab and build those manually. I get to a point and then it bombs out because apparently the boost148-static package has every Boost static lib except the regex one. 😕

If there's a better way to do this, someone please stop me so I don't waste more time. 😅

Dockerfile

FROM amazonlinux:latest
RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN yum -y update
RUN yum -y install wget libstdc++ glibc-devel.x86_64 git make cmake xz \
  zlib-static gcc gcc-c++ libmad-devel libpng-static libtool autogen \
  libid3tag-devel gd-devel boost148-static

COPY ./build.sh build.sh
RUN chmod +x build.sh
RUN ./build.sh

build.sh

#!/bin/bash

BOOST_INCLUDEDIR=/usr/include/boost148
BOOST_LIBRARYDIR=/usr/lib64/boost148

# Build FLAC libs
wget https://ftp.osuosl.org/pub/xiph/releases/flac/flac-1.3.3.tar.xz
unxz flac-1.3.3.tar.xz
tar xf flac-1.3.3.tar
cd flac-1.3.3
./configure
make install
cp src/libFLAC/.libs/libFLAC-static.a /usr/lib64/libFLAC.a
cd /

# Build Vorbis libs
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.6.tar.gz
tar xf libvorbis-1.3.6.tar.gz
cd libvorbis-1.3.6
./configure
make install
cd /

# Build OGG libs
wget http://downloads.xiph.org/releases/ogg/libogg-1.3.4.tar.gz
tar xf libogg-1.3.4.tar.gz
cd libogg-1.3.4
./configure
make install
cd /

# Build libsndfile
#git clone https://github.com/erikd/libsndfile.git
#cd libsndfile
#sed -i 's/1.14/1.13.1/' configure.ac
#./autogen.sh
#./configure
#make
#make check
#cp src/.libs/libsndfile.* /usr/lib64
#cd /

# Build libmad
wget https://sourceforge.net/projects/mad/files/libmad/0.15.1b/libmad-0.15.1b.tar.gz/download -O libmad-0.15.1b.tar.gz
tar xf libmad-0.15.1b.tar.gz
cd libmad-0.15.1b
sed -i 's/ -fforce-mem//' configure
./configure
make
cp .libs/libmad.a /usr/lib64
cd /

git clone https://github.com/bbc/audiowaveform.git
cd audiowaveform
wget https://github.com/google/googletest/archive/release-1.8.0.tar.gz
tar xzf release-1.8.0.tar.gz
ln -s googletest-release-1.8.0/googletest googletest
ln -s googletest-release-1.8.0/googlemock googlemock
mkdir build
cd build
cmake -D ENABLE_TESTS=0 -D BUILD_STATIC=1 ..
make
strip audiowaveform

(note: commented out the libsndfile build and install, apparently something else builds it I'm pretty sure, so it's not needed here)

ajbarber commented 4 years ago

This package appears to have the regex .a :

https://centos.pkgs.org/8/centos-powertools-x86_64/boost-static-1.66.0-6.el8.x86_64.rpm.html

ffxsam commented 4 years ago

I think I ran into a problem trying to install boost166-static but I'll try again and see what happens. (it's boost169-static actually, my mistake)

ffxsam commented 4 years ago

Bah. It needs python 3.6 libs, and unfortunately I don't think I can easily install those via yum.

Error: Package: boost169-numpy3-1.69.0-2.el7.x86_64 (epel)
           Requires: libpython3.6m.so.1.0()(64bit)
Error: Package: python36-numpy-1.12.1-3.el7.x86_64 (epel)
           Requires: libpython3.6m.so.1.0()(64bit)
Error: Package: boost169-python3-1.69.0-2.el7.x86_64 (epel)
           Requires: libpython3.6m.so.1.0()(64bit)
Error: Package: python36-numpy-1.12.1-3.el7.x86_64 (epel)
           Requires: python(abi) = 3.6
           Installed: python-2.7.16-3.amzn2.0.1.x86_64 (installed)
               python(abi) = 2.7
               python(abi) = 2.7
           Available: python-2.7.5-58.amzn2.x86_64 (amzn2-core)
               python(abi) = 2.7
               python(abi) = 2.7
           Available: python-2.7.14-58.amzn2.0.2.x86_64 (amzn2-core)
               python(abi) = 2.7
               python(abi) = 2.7
   (etc)
ffxsam commented 4 years ago

Ok, I've got all the requirements built (manually in most cases). From within the audiowaveform build dir, cmake -D ENABLE_TESTS=0 -D BUILD_STATIC=1 .. actually works without issue. But then make fails with an error that's way over my head:

Linking CXX executable audiowaveform
CMakeFiles/audiowaveform.dir/src/Options.cpp.o: In function `hasOptionValue(boost::program_options::variables_map const&, char const*)':
Options.cpp:(.text+0xf7): undefined reference to `boost::program_options::abstract_variables_map::operator[](std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
CMakeFiles/audiowaveform.dir/src/Options.cpp.o: In function `Options::Options()':
Options.cpp:(.text+0x1b5): undefined reference to `boost::program_options::options_description::options_description(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, unsigned int)'
CMakeFiles/audiowaveform.dir/src/Options.cpp.o: In function `Options::parseCommandLine(int, char const* const*)':
Options.cpp:(.text+0xecb): undefined reference to `boost::program_options::abstract_variables_map::operator[](std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
Options.cpp:(.text+0xf19): undefined reference to `boost::program_options::abstract_variables_map::operator[](std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
Options.cpp:(.text+0xf67): undefined reference to `boost::program_options::abstract_variables_map::operator[](std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
Options.cpp:(.text+0xfb5): undefined reference to `boost::program_options::abstract_variables_map::operator[](std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
CMakeFiles/audiowaveform.dir/src/Options.cpp.o: In function `boost::program_options::validation_error::validation_error(boost::program_options::validation_error::kind_t, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)':
Options.cpp:(.text._ZN5boost15program_options16validation_errorC2ENS1_6kind_tERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_i[_ZN5boost15program_options16validation_errorC5ENS1_6kind_tERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_i]+0x25): undefined reference to `boost::program_options::validation_error::get_template[abi:cxx11](boost::program_options::validation_error::kind_t)'
Options.cpp:(.text._ZN5boost15program_options16validation_errorC2ENS1_6kind_tERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_i[_ZN5boost15program_options16validation_errorC5ENS1_6kind_tERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_i]+0x3d): undefined reference to `boost::program_options::error_with_option_name::error_with_option_name(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
CMakeFiles/audiowaveform.dir/src/Options.cpp.o: In function `boost::program_options::typed_value<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char>::xparse(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) const':
Options.cpp:(.text._ZNK5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcE6xparseERNS_3anyERKSt6vectorIS7_SaIS7_EE[_ZNK5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcE6xparseERNS_3anyERKSt6vectorIS7_SaIS7_EE]+0x17): undefined reference to `boost::program_options::validate(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, int)'
CMakeFiles/audiowaveform.dir/src/Options.cpp.o: In function `std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > boost::program_options::to_internal<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)':
Options.cpp:(.text._ZN5boost15program_options11to_internalINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESt6vectorIS7_SaIS7_EERKS8_IT_SaISB_EE[_ZN5boost15program_options11to_internalINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESt6vectorIS7_SaIS7_EERKS8_IT_SaISB_EE]+0xa8): undefined reference to `boost::program_options::to_internal(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/audiowaveform.dir/src/Options.cpp.o: In function `boost::program_options::basic_command_line_parser<char>::basic_command_line_parser(int, char const* const*)':
Options.cpp:(.text._ZN5boost15program_options25basic_command_line_parserIcEC2EiPKPKc[_ZN5boost15program_options25basic_command_line_parserIcEC5EiPKPKc]+0xe1): undefined reference to `boost::program_options::detail::cmdline::cmdline(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)'
CMakeFiles/audiowaveform.dir/src/Options.cpp.o: In function `boost::program_options::typed_value<double, char>::name[abi:cxx11]() const':
Options.cpp:(.text._ZNK5boost15program_options11typed_valueIdcE4nameB5cxx11Ev[_ZNK5boost15program_options11typed_valueIdcE4nameB5cxx11Ev]+0x1e): undefined reference to `boost::program_options::arg[abi:cxx11]'
CMakeFiles/audiowaveform.dir/src/Options.cpp.o: In function `boost::program_options::typed_value<RGBA, char>::name[abi:cxx11]() const':
Options.cpp:(.text._ZNK5boost15program_options11typed_valueI4RGBAcE4nameB5cxx11Ev[_ZNK5boost15program_options11typed_valueI4RGBAcE4nameB5cxx11Ev]+0x1e): undefined reference to `boost::program_options::arg[abi:cxx11]'
CMakeFiles/audiowaveform.dir/src/Options.cpp.o: In function `boost::program_options::typed_value<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char>::name() const':
Options.cpp:(.text._ZNK5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcE4nameEv[_ZNK5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcE4nameEv]+0x1e): undefined reference to `boost::program_options::arg[abi:cxx11]'
CMakeFiles/audiowaveform.dir/src/Options.cpp.o: In function `boost::program_options::typed_value<int, char>::name[abi:cxx11]() const':
Options.cpp:(.text._ZNK5boost15program_options11typed_valueIicE4nameB5cxx11Ev[_ZNK5boost15program_options11typed_valueIicE4nameB5cxx11Ev]+0x1e): undefined reference to `boost::program_options::arg[abi:cxx11]'
CMakeFiles/audiowaveform.dir/src/Options.cpp.o: In function `void boost::program_options::validate<double, char>(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, double*, long)':
Options.cpp:(.text._ZN5boost15program_options8validateIdcEEvRNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIT0_St11char_traitsIS7_ESaIS7_EEESaISB_EEPT_l[_ZN5boost15program_options8validateIdcEEvRNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIT0_St11char_traitsIS7_ESaIS7_EEESaISB_EEPT_l]+0x4ed): undefined reference to `boost::program_options::invalid_option_value::invalid_option_value(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/audiowaveform.dir/src/Options.cpp.o: In function `void boost::program_options::validate<RGBA, char>(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, RGBA*, long)':
Options.cpp:(.text._ZN5boost15program_options8validateI4RGBAcEEvRNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIT0_St11char_traitsIS8_ESaIS8_EEESaISC_EEPT_l[_ZN5boost15program_options8validateI4RGBAcEEvRNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIT0_St11char_traitsIS8_ESaIS8_EEESaISC_EEPT_l]+0x325): undefined reference to `boost::program_options::invalid_option_value::invalid_option_value(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/audiowaveform.dir/src/Options.cpp.o: In function `void boost::program_options::validate<int, char>(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, int*, long)':
Options.cpp:(.text._ZN5boost15program_options8validateIicEEvRNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIT0_St11char_traitsIS7_ESaIS7_EEESaISB_EEPT_l[_ZN5boost15program_options8validateIicEEvRNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIT0_St11char_traitsIS7_ESaIS7_EEESaISB_EEPT_l]+0x16a): undefined reference to `boost::program_options::invalid_option_value::invalid_option_value(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/audiowaveform.dir/src/Options.cpp.o:(.rodata._ZTVN5boost16exception_detail19error_info_injectorINS_15program_options20invalid_option_valueEEE[_ZTVN5boost16exception_detail19error_info_injectorINS_15program_options20invalid_option_valueEEE]+0x30): undefined reference to `boost::program_options::error_with_option_name::substitute_placeholders(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
CMakeFiles/audiowaveform.dir/src/Options.cpp.o:(.rodata._ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15program_options20invalid_option_valueEEEEE[_ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15program_options20invalid_option_valueEEEEE]+0x38): undefined reference to `boost::program_options::error_with_option_name::substitute_placeholders(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
CMakeFiles/audiowaveform.dir/src/Options.cpp.o:(.rodata._ZTCN5boost10wrapexceptINS_15program_options20invalid_option_valueEEE0_NS_16exception_detail10clone_implINS4_19error_info_injectorIS2_EEEE[_ZTVN5boost10wrapexceptINS_15program_options20invalid_option_valueEEE]+0x38): undefined reference to `boost::program_options::error_with_option_name::substitute_placeholders(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
CMakeFiles/audiowaveform.dir/src/Options.cpp.o:(.rodata._ZTVN5boost10wrapexceptINS_15program_options20invalid_option_valueEEE[_ZTVN5boost10wrapexceptINS_15program_options20invalid_option_valueEEE]+0x38): undefined reference to `boost::program_options::error_with_option_name::substitute_placeholders(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
CMakeFiles/audiowaveform.dir/src/Options.cpp.o:(.rodata._ZTVN5boost16exception_detail19error_info_injectorINS_15program_options16validation_errorEEE[_ZTVN5boost16exception_detail19error_info_injectorINS_15program_options16validation_errorEEE]+0x30): undefined reference to `boost::program_options::error_with_option_name::substitute_placeholders(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
CMakeFiles/audiowaveform.dir/src/Options.cpp.o:(.rodata._ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15program_options16validation_errorEEEEE[_ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15program_options16validation_errorEEEEE]+0x38): more undefined references to `boost::program_options::error_with_option_name::substitute_placeholders(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const' follow
CMakeFiles/audiowaveform.dir/src/Options.cpp.o:(.rodata._ZTVN5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEE[_ZTVN5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEE]+0x38): undefined reference to `boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool) const'
CMakeFiles/audiowaveform.dir/src/Options.cpp.o:(.rodata._ZTVN5boost15program_options11typed_valueIicEE[_ZTVN5boost15program_options11typed_valueIicEE]+0x38): undefined reference to `boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool) const'
CMakeFiles/audiowaveform.dir/src/Options.cpp.o:(.rodata._ZTVN5boost15program_options11typed_valueIdcEE[_ZTVN5boost15program_options11typed_valueIdcEE]+0x38): undefined reference to `boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool) const'
CMakeFiles/audiowaveform.dir/src/Options.cpp.o:(.rodata._ZTVN5boost15program_options11typed_valueI4RGBAcEE[_ZTVN5boost15program_options11typed_valueI4RGBAcEE]+0x38): undefined reference to `boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool) const'
CMakeFiles/audiowaveform.dir/src/Rgba.cpp.o: In function `__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > boost::re_detail_106900::re_is_set_member<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, char, boost::regex_traits<char, boost::cpp_regex_traits<char> >, unsigned int>(__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::re_detail_106900::re_set_long<unsigned int> const*, boost::re_detail_106900::regex_data<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, bool)':
Rgba.cpp:(.text._ZN5boost16re_detail_10690016re_is_set_memberIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEjEET_SH_SH_PKNS0_11re_set_longIT2_EERKNS0_10regex_dataIT0_T1_EEb[_ZN5boost16re_detail_10690016re_is_set_memberIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEjEET_SH_SH_PKNS0_11re_set_longIT2_EERKNS0_10regex_dataIT0_T1_EEb]+0x17e): undefined reference to `boost::re_detail_106900::cpp_regex_traits_implementation<char>::transform_primary[abi:cxx11](char const*, char const*) const'
Rgba.cpp:(.text._ZN5boost16re_detail_10690016re_is_set_memberIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEjEET_SH_SH_PKNS0_11re_set_longIT2_EERKNS0_10regex_dataIT0_T1_EEb[_ZN5boost16re_detail_10690016re_is_set_memberIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEjEET_SH_SH_PKNS0_11re_set_longIT2_EERKNS0_10regex_dataIT0_T1_EEb]+0x4e7): undefined reference to `boost::re_detail_106900::cpp_regex_traits_implementation<char>::transform[abi:cxx11](char const*, char const*) const'
CMakeFiles/audiowaveform.dir/src/MathUtil.cpp.o: In function `boost::re_detail_106900::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::unwind_long_set_repeat(bool)':
MathUtil.cpp:(.text._ZN5boost16re_detail_10690012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS_9sub_matchISC_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE22unwind_long_set_repeatEb[_ZN5boost16re_detail_10690012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS_9sub_matchISC_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE22unwind_long_set_repeatEb]+0x5ba): undefined reference to `boost::re_detail_106900::cpp_regex_traits_implementation<char>::transform_primary[abi:cxx11](char const*, char const*) const'
MathUtil.cpp:(.text._ZN5boost16re_detail_10690012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS_9sub_matchISC_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE22unwind_long_set_repeatEb[_ZN5boost16re_detail_10690012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS_9sub_matchISC_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE22unwind_long_set_repeatEb]+0x8f5): undefined reference to `boost::re_detail_106900::cpp_regex_traits_implementation<char>::transform[abi:cxx11](char const*, char const*) const'
CMakeFiles/audiowaveform.dir/src/MathUtil.cpp.o: In function `boost::re_detail_106900::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::match_long_set()':
MathUtil.cpp:(.text._ZN5boost16re_detail_10690012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS_9sub_matchISC_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE14match_long_setEv[_ZN5boost16re_detail_10690012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS_9sub_matchISC_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE14match_long_setEv]+0x1b3): undefined reference to `boost::re_detail_106900::cpp_regex_traits_implementation<char>::transform_primary[abi:cxx11](char const*, char const*) const'
MathUtil.cpp:(.text._ZN5boost16re_detail_10690012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS_9sub_matchISC_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE14match_long_setEv[_ZN5boost16re_detail_10690012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS_9sub_matchISC_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE14match_long_setEv]+0x613): undefined reference to `boost::re_detail_106900::cpp_regex_traits_implementation<char>::transform[abi:cxx11](char const*, char const*) const'
CMakeFiles/audiowaveform.dir/src/MathUtil.cpp.o: In function `boost::re_detail_106900::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::match_long_set_repeat()':
MathUtil.cpp:(.text._ZN5boost16re_detail_10690012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS_9sub_matchISC_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE21match_long_set_repeatEv[_ZN5boost16re_detail_10690012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS_9sub_matchISC_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE21match_long_set_repeatEv]+0x25d): undefined reference to `boost::re_detail_106900::cpp_regex_traits_implementation<char>::transform_primary[abi:cxx11](char const*, char const*) const'
MathUtil.cpp:(.text._ZN5boost16re_detail_10690012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS_9sub_matchISC_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE21match_long_set_repeatEv[_ZN5boost16re_detail_10690012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS_9sub_matchISC_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE21match_long_set_repeatEv]+0x6a4): undefined reference to `boost::re_detail_106900::cpp_regex_traits_implementation<char>::transform[abi:cxx11](char const*, char const*) const'
CMakeFiles/audiowaveform.dir/src/MathUtil.cpp.o: In function `boost::re_detail_106900::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::match_match()':
MathUtil.cpp:(.text._ZN5boost16re_detail_10690012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS_9sub_matchISC_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE11match_matchEv[_ZN5boost16re_detail_10690012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS_9sub_matchISC_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE11match_matchEv]+0xa6): undefined reference to `boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >::maybe_assign(boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > const&)'
CMakeFiles/audiowaveform.dir/src/MathUtil.cpp.o: In function `boost::re_detail_106900::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::match_imp()':
MathUtil.cpp:(.text._ZN5boost16re_detail_10690012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS_9sub_matchISC_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE9match_impEv[_ZN5boost16re_detail_10690012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS_9sub_matchISC_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE9match_impEv]+0x31a): undefined reference to `boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >::maybe_assign(boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > const&)'
CMakeFiles/audiowaveform.dir/src/MathUtil.cpp.o: In function `bool boost::regex_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >(__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >&, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags)':
MathUtil.cpp:(.text._ZN5boost11regex_matchIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS_9sub_matchISB_EEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEbT_SJ_RNS_13match_resultsISJ_T0_EERKNS_11basic_regexIT1_T2_EENS_15regex_constants12_match_flagsE[_ZN5boost11regex_matchIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS_9sub_matchISB_EEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEbT_SJ_RNS_13match_resultsISJ_T0_EERKNS_11basic_regexIT1_T2_EENS_15regex_constants12_match_flagsE]+0xe0): undefined reference to `boost::re_detail_106900::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::construct_init(boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags)'
collect2: error: ld returned 1 exit status
make[2]: *** [audiowaveform] Error 1
make[1]: *** [CMakeFiles/audiowaveform.dir/all] Error 2
make: *** [all] Error 2

Anyone have any ideas?

ffxsam commented 4 years ago

I tried manually building boost 1.48 instead of using 1.69, and it wouldn't even build. I'm giving up for now.

chrisn commented 4 years ago

I had a quick look into this, maybe a static build isn't needed after all? I used the amazonlinux Docker image to compile audiowaveform (including building libmad, libid3tag, and libsndfile from source).

Following the information here, I modified CMakeLists.txt to add aws_lambda_package_target, which creates a zip file with audiowaveform + all its dependencies.

I know very little about Lambda, so I'm not sure what to do next - e.g., how do I run this? how do I send input to it, and where does the output go?

ffxsam commented 4 years ago

@chrisn You won't have to mess with Lambda at all. If it works in the amazonlinux:2 Docker container, it'll work on Lambda.

I suppose the static build isn't necessary. I'll mess around with a shared lib build and see if it works. In the past, I was opposed to this, but since the introduction of Lambda layers, it's much easier to have several Lambda functions share a single ZIP file of binaries. As long as audiowaveform's dependencies can exist in the same folder as the binary, this should work.