4

I am attempting to compile Tox (specifically toxcore). When I attempt to compile it, I encounter the following error:

>make
make  all-recursive
make[1]: Entering directory '/root/Tox/toxcore'
Making all in build
make[2]: Entering directory '/root/Tox/toxcore/build'
  CCLD     libtoxav.la
/usr/bin/ld: /usr/local/lib/libvpx.a(vpx_codec.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libvpx.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:1385: recipe for target 'libtoxav.la' failed
make[2]: *** [libtoxav.la] Error 1
make[2]: Leaving directory '/root/Tox/toxcore/build'
Makefile:506: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/root/Tox/toxcore'
Makefile:410: recipe for target 'all' failed
make: *** [all] Error 2

Following the error message, I have attempted to use fPIC by exporting C++ flags (export CXXFLAGS="$CXXFLAGS -fPIC"), by adding an argument to configure (./configure --enable-shared) and by editing the Makefile (changing CC = gcc to CC = gcc -fPIC), but these attempts have not worked and I still encounter the same error. What might be going wrong?

Here's the approach I have right now (on Ubuntu):

sudo apt-get install pkg-config
sudo apt-get install build-essential
sudo apt-get install libtool
sudo apt-get install autotools-dev
sudo apt-get install automake
sudo apt-get install checkinstall
sudo apt-get install check
sudo apt-get install git
sudo apt-get install yasm

cd ~
mkdir Tox
cd Tox

git clone https://github.com/jedisct1/libsodium.git
cd libsodium
git checkout tags/1.0.3
./autogen.sh
./configure && make check
sudo checkinstall --install --pkgname libsodium --pkgversion 1.0.0 --nodoc
sudo ldconfig
cd ..

git clone https://chromium.googlesource.com/webm/libvpx
cd libvpx
git checkout tags/v1.3.0
./configure
make
make install
cd ..

git clone https://github.com/irungentoo/toxcore.git
cd toxcore
autoreconf -i
./configure
make
sudo make install
cd ..
Ismael Luceno
  • 2,055
  • 15
  • 26
d3pd
  • 7,935
  • 24
  • 76
  • 127
  • 2
    Did you clean the previous build after you change the configure? You may check the log to see if you really append `-fPIC` in the compile flags. – Mine Nov 16 '16 at 22:07
  • @Mine Thanks for your comment. Yes, I attempted a few make cleans. In `config.log` I see references to `-fPIC` that suggest that it is indeed being used (e.g. `checking if gcc PIC flag -fPIC -DPIC works`, `result: yes` etc.). – d3pd Nov 17 '16 at 12:28

2 Answers2

0

There must be a bug in the configuration script, it shouldn't come up with libvpx.a.

But worry not, since Ubuntu provides packages for both libvpx-dev and libsodium-dev, and using those seems to work just fine, so you should probably just do that unless there's some strong reason not to.

Also, unless you need classic toxcore, it seems c-toxcore is the successor, so you probably should use it instead.

Ismael Luceno
  • 2,055
  • 15
  • 26
  • Super, installation of `libvox-dev` and `libsodium-dev` seems to have worked. Thanks! – d3pd Nov 28 '16 at 17:52
0

Configuring with --enable-pic will add in the necessary -fPIC options, and works for me.

Nathan Kidd
  • 2,919
  • 21
  • 22