Compiler error reporting is too harsh for ./configure - c++

So, I am trying to compile a Homebrew App for CFW Nintendo 3DS. I am doing it on Linux Mint 18.2. The compiler fails to compile some required dependencies.
Here is the code from the compiler:
#!/bin/sh
set -ex
mkdir -p build
# Install libarchive and libmpg123 for host
apt-get update
apt-get -y install libarchive-dev libmpg123-dev
# Install libarchive for 3ds
git clone https://github.com/Cruel/3ds_portlibs.git
cd 3ds_portlibs
make zlib
make install-zlib
make libarchive
make install
# Install libmpg123 for 3ds
wget -O libmpg123-dev.tar.gz https://notabug.org/attachments/216a6d61-f167-4f65-84dc-fa98c2247fc1
tar -xaf libmpg123-dev.tar.gz -C $DEVKITPRO/portlibs/3ds
cd ../build
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_EMULATOR=ON -DBUILD_TESTS=ON ..
make -j4
Here is the output error that I get:
+ mkdir -p build
+ apt-get update
Ign:1 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://dl.google.com/linux/chrome/deb stable Release
Hit:3 http://archive.ubuntu.com/ubuntu xenial InRelease
Hit:4 http://deb.torproject.org/torproject.org xenial InRelease
Hit:7 http://ppa.launchpad.net/alessandro-strada/ppa/ubuntu xenial InRelease
Get:8 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Hit:9 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:10 http://ppa.launchpad.net/jonathonf/ffmpeg-3/ubuntu xenial InRelease
Hit:6 http://screenshots.getdeb.net xenial-getdeb InRelease
Get:11 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Ign:12 http://packages.linuxmint.com sonya InRelease
Hit:13 http://packages.linuxmint.com sonya Release
Hit:15 http://archive.canonical.com/ubuntu xenial InRelease
Fetched 204 kB in 5s (38.6 kB/s)
Reading package lists...
+ apt-get -y install libarchive-dev libmpg123-dev
Reading package lists...
Building dependency tree...
Reading state information...
libmpg123-dev is already the newest version (1.22.4-1).
libarchive-dev is already the newest version (3.2.1-2~ubuntu16.04.1).
0 upgraded, 0 newly installed, 0 to remove and 100 not upgraded.
+ git clone https://github.com/Cruel/3ds_portlibs.git
Cloning into '3ds_portlibs'...
+ cd 3ds_portlibs
+ CFLAGS=-m64
+ make zlib
wget -O zlib-1.2.8.tar.gz "http://prdownloads.sourceforge.net/libpng/zlib-1.2.8.tar.gz"
--2017-08-02 08:47:03-- http://prdownloads.sourceforge.net/libpng/zlib-1.2.8.tar.gz
Resolving prdownloads.sourceforge.net (prdownloads.sourceforge.net)... 216.34.181.59
Connecting to prdownloads.sourceforge.net (prdownloads.sourceforge.net)|216.34.181.59|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://downloads.sourceforge.net/project/libpng/zlib/1.2.8/zlib-1.2.8.tar.gz [following]
--2017-08-02 08:47:03-- http://downloads.sourceforge.net/project/libpng/zlib/1.2.8/zlib-1.2.8.tar.gz
Resolving downloads.sourceforge.net (downloads.sourceforge.net)... 216.34.181.59
Connecting to downloads.sourceforge.net (downloads.sourceforge.net)|216.34.181.59|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://versaweb.dl.sourceforge.net/project/libpng/zlib/1.2.8/zlib-1.2.8.tar.gz [following]
--2017-08-02 08:47:04-- https://versaweb.dl.sourceforge.net/project/libpng/zlib/1.2.8/zlib-1.2.8.tar.gz
Resolving versaweb.dl.sourceforge.net (versaweb.dl.sourceforge.net)... 104.238.205.251
Connecting to versaweb.dl.sourceforge.net (versaweb.dl.sourceforge.net)|104.238.205.251|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 571091 (558K) [application/x-gzip]
Saving to: ‘zlib-1.2.8.tar.gz’
2017-08-02 08:47:04 (1.95 MB/s) - ‘zlib-1.2.8.tar.gz’ saved [571091/571091]
Using ar
Checking for arm-none-eabi-gcc...
Compiler error reporting is too harsh for ./configure (perhaps remove -Werror).
** ./configure aborting.
Makefile:195: recipe for target 'zlib' failed
make: *** [zlib] Error 1
I also noticed if I remove the lines about zlib, I get a different error:
+ export CPP3DS=/home/eddy/Documents/FreeShop/cpp3ds
+ for dev in ''\''arc13'\'''
+ cd /home/eddy/Documents/FreeShop/arc13/freeshop
+ for dx in '"3ds_portlibs"' '"build"'
+ '[' -d 3ds_portlibs ']'
+ rm -r 3ds_portlibs
+ for dx in '"3ds_portlibs"' '"build"'
+ '[' -d build ']'
+ rm -r build
+ mkdir -p build
+ export CC=arm-none-eabi-gcc
+ CC=arm-none-eabi-gcc
+ export CXX=arm-none-eabi-g++
+ CXX=arm-none-eabi-g++
+ apt-get update
Ign:1 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://deb.torproject.org/torproject.org xenial InRelease
Hit:3 http://dl.google.com/linux/chrome/deb stable Release
Ign:4 http://packages.linuxmint.com sonya InRelease
Hit:5 http://packages.linuxmint.com sonya Release
Hit:6 http://ppa.launchpad.net/alessandro-strada/ppa/ubuntu xenial InRelease
Hit:7 http://archive.ubuntu.com/ubuntu xenial InRelease
Hit:8 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:12 http://archive.canonical.com/ubuntu xenial InRelease
Hit:13 http://ppa.launchpad.net/jonathonf/ffmpeg-3/ubuntu xenial InRelease
Hit:14 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:10 http://screenshots.getdeb.net xenial-getdeb InRelease
Hit:15 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
Reading package lists...
+ apt-get -y install libarchive-dev libmpg123-dev
Reading package lists...
Building dependency tree...
Reading state information...
libmpg123-dev is already the newest version (1.22.4-1).
libarchive-dev is already the newest version (3.2.1-2~ubuntu16.04.1).
0 upgraded, 0 newly installed, 0 to remove and 103 not upgraded.
+ git clone https://github.com/Cruel/3ds_portlibs.git
Cloning into '3ds_portlibs'...
+ cd 3ds_portlibs
+ make CC=DEVKITPRO
Please choose one of the following targets:
freetype (requires zlib to be installed)
libexif
libjpeg-turbo
libpng (requires zlib to be installed)
sqlite
zlib
mxml
expat
libxml2
jansson
physfs (requires zlib to be installed)
libmad
libogg
libvorbis (requires libogg to be installed)
giflib
libconfig
bzip2
xz
libarchive
nettle
wslay
+ make libarchive
wget -O libarchive-3.1.2.tar.gz "http://www.libarchive.org/downloads/libarchive-3.1.2.tar.gz"
--2017-08-02 16:36:34-- http://www.libarchive.org/downloads/libarchive-3.1.2.tar.gz
Resolving www.libarchive.org (www.libarchive.org)... 2600:9000:2025:5a00:16:e6b0:f440:93a1, 2600:9000:2025:fe00:16:e6b0:f440:93a1, 2600:9000:2025:2600:16:e6b0:f440:93a1, ...
Connecting to www.libarchive.org (www.libarchive.org)|2600:9000:2025:5a00:16:e6b0:f440:93a1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4527540 (4.3M) [application/x-gzip]
Saving to: ‘libarchive-3.1.2.tar.gz’
2017-08-02 16:36:40 (54.6 MB/s) - ‘libarchive-3.1.2.tar.gz’ saved [4527540/4527540]
patching file libarchive/archive_ppmd7.c
patching file libarchive/archive_read_disk_posix.c
patching file libarchive/archive_write_disk_posix.c
patching file libarchive/archive_write_set_format_iso9660.c
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-none-eabi-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... arm-none-eabi
checking for arm-none-eabi-gcc... arm-none-eabi-gcc
checking whether the C compiler works... no
configure: error: in `/home/eddy/Documents/FreeShop/arc13/freeshop/3ds_portlibs/libarchive-3.1.2':
configure: error: C compiler cannot create executables
See `config.log' for more details
Makefile:274: recipe for target 'libarchive' failed
make: *** [libarchive] Error 77
Judging from the error, it seems that I'm compiling an ARM application on a 64-bit system and it fails due to that. However, I need to compile the source code in ARM since it's supposed to be installed on a Nintendo 3DS. How can I fix this error in order to compile the application?
Edit: I tried setting up the compiler for root and got this error:
-- Check for working C compiler: /opt/devkitPro/devkitARM/bin/arm-none-eabi-gcc -- broken
CMake Error at /usr/share/cmake-3.5/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "/opt/devkitPro/devkitARM/bin/arm-none-eabi-gcc" is not able
to compile a simple test program.
It fails with the following output:
Change Dir: /home/eddy/Documents/FreeShop/arc13/freeshop/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_ef3eb/fast"
/usr/bin/make -f CMakeFiles/cmTC_ef3eb.dir/build.make
CMakeFiles/cmTC_ef3eb.dir/build
make[1]: Entering directory
'/home/eddy/Documents/FreeShop/arc13/freeshop/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_ef3eb.dir/testCCompiler.c.o
/opt/devkitPro/devkitARM/bin/arm-none-eabi-gcc -o
CMakeFiles/cmTC_ef3eb.dir/testCCompiler.c.o -c
/home/eddy/Documents/FreeShop/arc13/freeshop/build/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_ef3eb
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_ef3eb.dir/link.txt
--verbose=1
/opt/devkitPro/devkitARM/bin/arm-none-eabi-gcc
CMakeFiles/cmTC_ef3eb.dir/testCCompiler.c.o -o cmTC_ef3eb -rdynamic
arm-none-eabi-gcc: error: unrecognized command line option '-rdynamic'
CMakeFiles/cmTC_ef3eb.dir/build.make:97: recipe for target 'cmTC_ef3eb'
failed
make[1]: *** [cmTC_ef3eb] Error 1
make[1]: Leaving directory
'/home/eddy/Documents/FreeShop/arc13/freeshop/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_ef3eb/fast' failed
make: *** [cmTC_ef3eb/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:7 (project)
-- Configuring incomplete, errors occurred!
See also "/home/eddy/Documents/FreeShop/arc13/freeshop/build/CMakeFiles/CMakeOutput.log".
See also "/home/eddy/Documents/FreeShop/arc13/freeshop/build/CMakeFiles/CMakeError.log".
I am also getting this error:
-- strip: /opt/devkitPro/devkitARM/bin/arm-none-eabi-strip - found
-- 3dslink: /opt/devkitPro/devkitARM/bin/3dslink - found
-- Looking for Picasso...
-- Picasso: /opt/devkitPro/devkitARM/bin/picasso - found
-- Looking for nihstro...
-- nihstro - not found
CMake Error at /home/eddy/Documents/FreeShop/cpp3ds/cmake/template_emu/CMakeLists.txt:1 (find_package):
By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"Qt5Widgets", but CMake did not find one.
Could not find a package configuration file provided by "Qt5Widgets" with
any of the following names:
Qt5WidgetsConfig.cmake
qt5widgets-config.cmake
Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH or set
"Qt5Widgets_DIR" to a directory containing one of the above files. If
"Qt5Widgets" provides a separate development package or SDK, be sure it has
been installed.
-- Configuring incomplete, errors occurred!
See also "/home/eddy/Documents/FreeShop/arc13/freeshop/build/CMakeFiles/CMakeOutput.log".

From this question, it looks like it's failing as it can't find a valid compiler.
You'll need to download a cross compiler in order to compile code for one architecture on a different one. You can follow the steps in this question to get an ARM compiler, and then the ./configure script may work on its own (it looks like it's looking for a cross compiler), or you can use eg.:
export CC=arm-linux-gnueabi-gcc
export CXX=arm-linux-gnueabi-g++
...before running ./configure to set the compilers for the build system (assuming it obeys the CC convention).
If this doesn't work, you may need specific DS cross-compilers, rather than just generic ARM ones. It might be worth looking at this site if you haven't already, to see if their devkitARM provides the cross compiler you need.
Edit: If you look carefully at your new output, you'll see make CC=DEVKITPRO. This is calling make directly with DEVKITPRO set as the compiler, overriding any attempts to change the compiler beforehand.
You should make sure the DEVKITPRO binary is accessible from your PATH - open a terminal and type DEVKITPRO and see if you can execute it, or if it's not found. If it's not found, check over the instructions on the devkitARM page referenced above to make sure you've installed it as they expected, in particular the line in the Linux installation instructions saying echo "export DEVKITPRO=/opt/devkitPro" >> ~/.bashrc.
Edit Edit: There's a list of libraries and toolkits here. Look on your project's installation page to find any dependencies, and track them down and install them as well.

Related

installation error: 'Unable to locate package g++-4.8'

I am trying to install gcc and g++ version 4.8 to run a specific software in Ubuntu 22.04.1
when I perform
sudo apt-get install g++-4.8
it says
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package g++-4.8
E: Couldn't find any package by glob 'g++-4.8'
E: Couldn't find any package by regex 'g++-4.8'
and When I perform
sudo apt-get install gcc-4.8
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'gcc-4.8-hppa64' for regex 'gcc-4.8'
The following packages were automatically installed and are no longer required:
chromium-codecs-ffmpeg-extra gstreamer1.0-vaapi i965-va-driver intel-media-va-driver libaacs0 libaom3 libass9 libavcodec58 libavformat58 libavutil56 libbdplus0 libbluray2
libbs2b0 libchromaprint1 libcodec2-1.0 libdav1d5 libflashrom1 libflite1 libftdi1-2 libgme0 libgsm1 libgstreamer-plugins-bad1.0-0 libigdgmm12 liblilv-0-0 libmfx1 libmysofa1
libnorm1 libopenmpt0 libpgm-5.3-0 libpostproc55 librabbitmq4 librubberband2 libserd-0-0 libshine3 libsnappy1v5 libsord-0-0 libsratom-0-0 libsrt1.4-gnutls libssh-gcrypt-4
libswresample3 libswscale5 libudfread0 libva-drm2 libva-wayland2 libva-x11-2 libva2 libvdpau1 libvidstab1.1 libx265-199 libxvidcore4 libzimg2 libzmq5 libzvbi-common libzvbi0
mesa-va-drivers mesa-vdpau-drivers pocketsphinx-en-us va-driver-all vdpau-driver-all
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
What could be done?
You could possibly recompile gcc 4.8.5 with the following script. However there is a lot that can go wrong depending on the machine that you are compiling it since the compiler itself depends on a large set of utilities - called the toolchain and they are tightly coupled with the machine's own system libraries, in particular the C standard library.
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

Could NOT find Glog (missing: GLOG_INCLUDE_DIR GLOG_LIBRARY)

I am trying to install openpose in Ubuntu 20.04 using CMAKE and I get the following error:
Could NOT find Glog (missing: GLOG_INCLUDE_DIR GLOG_LIBRARY)
I am following the instructions here (unfortunately, the screenshots are not available but I just followed the textual commands):
https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/installation/README.md
I made a build folder in openpose folder and then ran the cmake-gui .. command.
A GUI opens with all these checked (I don't change anything):
and the error is:
GCC detected, adding compile flags
GCC detected, adding compile flags
Building with CUDA.
CUDA detected: 10.1
Added CUDA NVCC flags for: sm_75
cuDNN not found
Found gflags (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libgflags.so)
Could NOT find Glog (missing: GLOG_INCLUDE_DIR GLOG_LIBRARY)
CMake Warning at /usr/share/cmake-3.16/Modules/FindProtobuf.cmake:499 (message):
Protobuf compiler version 3.13.0 doesn't match library version 3.6.1
Call Stack (most recent call first):
CMakeLists.txt:429 (find_package)
Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so;-lpthread (found version "3.6.1")
Found OpenCV: /usr (found version "4.2.0")
cuDNN not found.
#!/bin/bash
echo "This script assumes Ubuntu 16 or 14 and Nvidia Graphics card up to 10XX. Otherwise, it will fail."
# Install cuDNN 5.1
if [[ $UBUNTU_VERSION == *"14."* ]] || [[ $UBUNTU_VERSION == *"15."* ]] || [[ $UBUNTU_VERSION == *"16."* ]]; then
CUDNN_URL="http://developer.download.nvidia.com/compute/redist/cudnn/v5.1/cudnn-8.0-linux-x64-v5.1.tgz"
wget -c ${CUDNN_URL}
sudo tar -xzf cudnn-8.0-linux-x64-v5.1.tgz -C /usr/local
rm cudnn-8.0-linux-x64-v5.1.tgz && sudo ldconfig
else
echo "cuDNN NOT INSTALLED! Ubuntu 16 or 14 not found. Install cuDNN manually from 'https://developer.nvidia.com/cudnn'."
fi
CMake Error at CMakeLists.txt:520 (message):
Install cuDNN using the above commands. or turn off cuDNN by setting
USE_CUDNN to OFF.
Configuring incomplete, errors occurred!
See also "/home/mona/research/code/openpose/build/CMakeFiles/CMakeOutput.log".
See also "/home/mona/research/code/openpose/build/CMakeFiles/CMakeError.log".
Then, I installed gflags using sudo apt-get install libgflags-dev command but I still get the same error. How could I fix this problem?
This is the git log to see which version of repo I am at for reproducing the error:
$ git log
commit a255747af22116ad76004437456bb531dc5d0b23 (HEAD -> master, origin/master, origin/HEAD)
Author: Wlad Meixner <9556979+gosticks#users.noreply.github.com>
Date: Mon Dec 21 22:01:10 2020 +0100
Fix possible typo (#1802)
The CMakeOutput.log and CMakeError.log can be found here https://github.com/CMU-Perceptual-Computing-Lab/openpose/issues/1814
$ sudo apt install libgoogle-glog-dev
Also,
$ sudo apt-get install libgflags-dev
$ sudo apt install libgoogle-glog-dev
$ sudo apt-get install protobuf-compiler libprotobuf-dev
since initially I didn't have any of them installed.
If you have run it from the command line you should have see them...
if (NOT GLOG_FOUND)
message(FATAL_ERROR "Glog not found. Install Glog from the command line using the command(s) -\
sudo apt-get install libgoogle-glog-dev")
endif (NOT GLOG_FOUND)
if (NOT GFLAGS_FOUND)
message(FATAL_ERROR "GFlags not found. Install GFlags from the command line using the command(s) --\
sudo apt-get install libgflags-dev")
endif (NOT GFLAGS_FOUND)
if (NOT OpenCV_FOUND)
message(FATAL_ERROR "OpenCV not found. Install OpenCV from the command line using the command(s) --\
sudo apt-get install libopencv-dev")
endif (NOT OpenCV_FOUND)
ref: https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/5a9acc730915f2171badcf10076aef9213f38e01/CMakeLists.txt#L523-L537
note: A better way, would be to use FetchContent() when third parties are missing (since they provide a CMake based build), also the command provided is ubuntu only...

CMake/Make cannot find libusb

I'm new to C/C++ and am trying to build and run ttwatch from github locally on an Ubuntu machine (Trusty Tahr). Instructions include installing some libraries first: cmake, openssl, curl, libusb, and include a note to install the "-dev" versions (eg. libssl-dev, libcurl-dev, libusb-1.0-0-dev). I'm having some trouble with libusb. I see questions about this all over the internet, but haven't yet found a solution that works.
Running cmake . appears to work fine:
meowmeow#kittytown:~/code/ttwatch$ cmake .
-- Enabled daemon function
-- Found libusb-1.0:
-- - Includes: /usr/include/libusb-1.0
-- - Libraries: /usr/lib/x86_64-linux-gnu/libusb.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/meowmeow/code/ttwatch
But running make shows that libusb is not being located properly:
meowmeow#kittytown:~/code/ttwatch$ make
[ 42%] Built target libttbin
[ 42%] Built target libttwatch
[ 42%] Built target ttbincnv
[ 42%] Built target ttbinmod
[ 42%] Built target manifest
Linking CXX executable ttwatch
CMakeFiles/ttwatch.dir/src/ttwatch.c.o: In function `main':
/home/meowmeow/code/ttwatch/src/ttwatch.c:1618: undefined reference to `libusb_init'
/home/meowmeow/code/ttwatch/src/ttwatch.c:1796: undefined reference to `libusb_exit'
...
If I check /usr/includes/, I see libusb:
meowmeow#kittytown:~/code/ttwatch$ ls /usr/include/libusb-1.0/libusb.h
/usr/include/libusb-1.0/libusb.h
And dpkg shows:
meowmeow#kittytown:~/code/ttwatch$ dpkg -L libusb-1.0-0-dev
/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/pkgconfig
/usr/lib/x86_64-linux-gnu/pkgconfig/libusb-1.0.pc
/usr/lib/x86_64-linux-gnu/libusb-1.0.a
/usr/share
/usr/share/doc
/usr/share/doc/libusb-1.0-0-dev
/usr/share/doc/libusb-1.0-0-dev/copyright
/usr/include
/usr/include/libusb-1.0
/usr/include/libusb-1.0/libusb.h
/usr/lib/x86_64-linux-gnu/libusb-1.0.so
/usr/share/doc/libusb-1.0-0-dev/README
/usr/share/doc/libusb-1.0-0-dev/changelog.Debian.gz
meowmeow#kittytown:~/code/ttwatch$ dpkg -L libusb-1.0-0
/.
/lib
/lib/x86_64-linux-gnu
/lib/x86_64-linux-gnu/libusb-1.0.so.0.1.0
/usr
/usr/share
/usr/share/doc
/usr/share/doc/libusb-1.0-0
/usr/share/doc/libusb-1.0-0/README
/usr/share/doc/libusb-1.0-0/copyright
/usr/share/doc/libusb-1.0-0/changelog.Debian.gz
/lib/x86_64-linux-gnu/libusb-1.0.so.0
The file ttwatch/includes/libttwatch.h includes libusb as #include <libusb.h>, and I've tried modifying that to #include <libusb-1.0/libusb.h>, in hopes of better matching my /usr/includes/ files, but that didn't change the error output.
Any help would be greatly appreciated!
EDIT:
Using make VERBOSE=1does show -lusb, and not -lusb-1.0:
...
/usr/bin/c++ -g CMakeFiles/ttwatch.dir/src/ttwatch.c.o CMakeFiles/ttwatch.dir/src/log.c.o CMakeFiles/ttwatch.dir/src/options.c.o CMakeFiles/ttwatch.dir/src/json.c.o CMakeFiles/ttwatch.dir/src/download.c.o CMakeFiles/ttwatch.dir/src/firmware.c.o CMakeFiles/ttwatch.dir/src/misc.c.o CMakeFiles/ttwatch.dir/src/get_activities.c.o CMakeFiles/ttwatch.dir/src/update_gps.c.o CMakeFiles/ttwatch.dir/src/set_time.c.o -o ttwatch -rdynamic libttwatch.a libttbin.a -lusb -lssl -lcrypto -lcurl
And libusb.so appears to exist:
meowmeow#kittytown:~/code/ttwatch$ dpkg-query -S /usr/lib/x86_64-linux-gnu/libusb.so
libusb-dev: /usr/lib/x86_64-linux-gnu/libusb.so
I tried uninstalling libusb-dev (sudo apt-get remove libusb-dev) and installed libusb-1.0 (sudo apt-get install libusb-1.0) to see if that would solve the issue. I now have a /usr/lib/x86_64-linux-gnu/libusb-1.0.so (note the 1.0) instead, but am now getting this from make:
make[2]: *** No rule to make target /usr/lib/x86_64-linux-gnu/libusb.so', needed by ttwatch'. Stop.
I was not aware that Debian has the packages libusb-dev and
libusb-1.0-dev. From the package information I cannot tell why there are 2
packages for the same library, perhaps libusb-dev is an older version with a
different API and other packages might still have that as a dependency. So
removing the package might not be a good idea, unless you don't care/need
packages depending on libusb-dev, in which case you can do apt-get purge
libusb-dev && apt-get autoremove. Be ware that this might uninstall
packages that you need. So do it only if you know what you are doing.
I did not expect that Debian allows you to install both packages at the same
time, but this could be if the APIs of both libraries are different and don't
conflict with each other.
This seems to confuse cmake, which somehow cannot handle when both libraries
are simultaneously installed. I've gone through the issues page and I
haven't found an issue relating to that. So if you cannot manage to build it,
I'd suggest that you go to the issue page, if you don't have an github
account, create one and leave a bug report about building the package when
libusb-dev and libusb-1.0-dev are simultaneously installed.
Another option would be to make a small modification in the file cmake_modules/FindLibUSB.cmake before you do
$ mkdir build && cd build
$ cmake ..
Find the line find_library(LIBUSB_1_LIBRARY, on the current stable version it is line 62. The next line is NAMES
and the next line is usb-1.0 usb. Remove the usb from that, so that
find_library only searches for libusb-1.0. Save the file and then you can do
$ mkdir build && cd build
$ cmake ..
This should fix the problem.

Error while running configure on nxlogs build

I'm attempting to build nxlog with some updated libraries:
Latest APR (1.5.2)
Non-Heartbleed vulnerable OpenSSL sources
PCRE 8.37
Zlib 1.2.8
After building all the dependencies I'm a little stuck on getting nxlogs to build, specifically I'm stuck on the step where I run ./configure
At first it couldn't find apr-1-config, so I added /local/apr/bin to the path.
Then it couldn't fine libapr-1 so I added /local/apr/lib to the path, this is where the problems started. When APR built there wasn't a "libapr-1" file in /local/apr/lib, only libapr-1.a, libapr-1.la, libapr-1.dll.a.
Did I build APR incorrectly?
I'm trying to build this on windows
List of steps to get where I am:
Install MINGW using MinGW Installation Manager
Add packages:
mingw-developer-toolkit
mingw-base
mingw-expat bin
mingw32-libexpat dev
msys-libopenssl dev
msys-automake
msys-autoconf
Setup msys fstab (c:/mingw /mingw)
Install Python (2.5)
Add Python and mingw to system path (C:\Python25;C:\MinGW\bin;C:\MinGW\msys\1.0\bin)
Get and build APR source (I could not get APR iconv to compile)
Download:
http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.11.tar.gz
http://mirror.nexcess.net/apache//apr/apr-1.5.2-win32-src.zip
http://mirror.nexcess.net/apache//apr/apr-util-1.5.4-win32-src.zip
http://sourceforge.net/projects/pcre/files/pcre/8.37/pcre-8.37.zip/download
http://zlib.net/zlib128.zip
Build:
Extract all files to c:\mingw\msys\1.0\src
Compile libiconv
cd libiconv-1.11
./configure CFLAGS="-O2 -s -mms-bitfields -march=i686" CXXFLAGS="-O2 -s -mms-bitfields -march=i686"
make && make install
Compile APR
cd apr
./buildconf
./configure CFLAGS="-O0 -s -mms-bitfields -march=i686" CXXFLAGS="-O0 -s -mms-bitfields -march=i686"
make && make install
cd ..
Compile APR-UTIL
cd apr-util-1.5.4
./buildconf --with-apr=/usr/src/apr-1.5.2
./configure CFLAGS="-O2 -s -mms-bitfields -march=i686" CXXFLAGS="-O2 -s -mms-bitfields -march=i686" --with-apr=/usr/src/apr-1.5.2
make && make install
cd ..
Compile PCRE
cd pcre-.37
./configure
make && make install
(make threw an error corrected with make clean, autoconf -i --force, started back at step 1)
cd ..
Compile ZLIB
cd zlib-1.2.8
make -f win32/Makefile.gcc
Compile nxlog
cd nxlog-ce-2.8.1248
./configure
This is where the problems began. First it couldn't find apr-1-config.
Fixed by adding /local/apr/bin to path.
Now it can't find libapr-1, adding /local/apr/lib to the path doesn't help. There is no libapr-1 file in the MinGW directory tree; thought I do see libapr-1.a libapr-1.la libapr.dll.a. Ideas? I assume this is supposed to be a script file to respond to queries about the library's interfaces?

Building a Debian package tries to install to real /opt

This is again one these nice Debian packaging problems.
I have an app that installs to /opt (the install location is actually irrelevant, the same problem occurs with /usr):
OPT=1 ./configure && make && make install
I took a working Debian packaging from my other app, that used CMake, but the configuring, build and installation were similar. I modified the rules file a bit to build my new app:
build: build-stamp
build-stamp:
dh_testdir
# Add here commands to compile the package.
OPT=1 ./configure && $(MAKE) -j$(shell cat /proc/cpuinfo | grep processor | wc -l)
touch build-stamp
I left the installation part untouched:
install: build
dh_testdir
dh_testroot
dh_prep
dh_installdirs
# Add here commands to install the package into debian/<packagename>
DESTDIR=`pwd`/debian/`dh_listpackages` $(MAKE) install
Now, the problem is that when I try to build the package, it tries to install
to the real /opt and crashes:
mkdir: cannot create directory ‘/opt/snm’: Permission denied
make[1]: *** [install_target] Error 1
make: *** [install] Error 2
dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2
debuild: fatal error at line 1361:
dpkg-buildpackage -rfakeroot -D -us -uc -i -b failed
I just can't figure out why my packaging doesn't work with my new app. Or alternatively, why it DID work with the other app :)
It seems that my install step was just ignoring the DESTDIR given by the Debian rules file.