This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Issues during pc-ble-driver build

I am following this tutorial to be able to run the ble_connectovity example on the Nordic: github.com/.../pc-ble-driver

I can build and install Boost and cmake runs successfully. However, when I hit "make" I get the following error: before I dig in the generated makefiles...: what can be the issue?

> user@user-vm:/.../nordic/pc-ble-driver/build$ make
Scanning dependencies of target pc_ble_driver_obj_sd_api_v3
CMakeFiles/pc_ble_driver_obj_sd_api_v3.dir/depend.make:4: *** missing separator.  Stop.
CMakeFiles/Makefile2:289: recipe for target 'CMakeFiles/pc_ble_driver_obj_sd_api_v3.dir/all' failed
make[1]: *** [CMakeFiles/pc_ble_driver_obj_sd_api_v3.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

The offending file contains:

> \# CMAKE generated file: DO NOT EDIT!
> 
> \# Generated by "Unix Makefiles" Generator, CMake Version 3.5
> 
CMakeFiles/pc_ble_driver_obj_sd_api_v3.dir/src/sd_api_v3/sdk/components/serialization/application/codecs/s132/serializers/app_ble_user_mem.c.o: ../include/common/adapter.h
CMakeFiles/pc_ble_driver_obj_sd_api_v3.dir/src/sd_api_v3/sdk/components/serialization/application/codecs/s132/serializers/app_ble_user_mem.c.o: ../include/common/config/platform.h

Here's info regarding my setup:

  • Xubuntu: 4.4.0-47-generic #68-Ubuntu SMP Wed Oct 26 19:39:52 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
  • Boost 1.61.0
  • cmake version 3.5.1
  • GNU Make 4.1
  • gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

Thanks, Dirk

  • The system and toolchain you are running on should be able to compile pc-ble-driver without problems. We have run successfully on a similar Xubuntu system.

    Could you show the exact cmake command you are running?

  • This is my cmake command line:

    cmake -B. -H.. -G "Unix Makefiles" -DBOOST_ROOT="/home/userx/tools/boost_1_61_0"  -DBOOST_INCLUDEDIR="/home/userx/tools/boost_1_61_0_install/include"  -DBOOST_LIBRARYDIR=/home/userx/tools/boost_1_61_0_install/lib
    

    Here is the stdout:

    -- The C compiler identification is GNU 5.4.0
    -- The CXX compiler identification is GNU 5.4.0
    -- Check for working C compiler: /usr/bin/cc
    -- Check for working C compiler: /usr/bin/cc -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Check for working CXX compiler: /usr/bin/c++
    -- Check for working CXX compiler: /usr/bin/c++ -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Architecture not set, using native 64-bit toolchain.
    -- Building with build type: .
    -- Looking for pthread.h
    -- Looking for pthread.h - found
    -- Looking for pthread_create
    -- Looking for pthread_create - not found
    -- Looking for pthread_create in pthreads
    -- Looking for pthread_create in pthreads - not found
    -- Looking for pthread_create in pthread
    -- Looking for pthread_create in pthread - found
    -- Found Threads: TRUE  
    -- Boost version: 1.61.0
    -- Found the following Boost libraries:
    --   thread
    --   system
    --   regex
    --   date_time
    --   chrono
    --   atomic
    -- Found Git: /usr/bin/git (found version "2.7.4") 
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /mnt/hgfs/userx/git/nordic/pc-ble-driver/build
    

    Update #1 2016_11_28: The original cmake issue might have had something todo with my files being located on a shared directory (Xubuntu is running in a VM). I redid the install/build process in a local directory and get a lot further....but the build still fails when it is trying to create "libpc_ble_driver_shared_sd_api_v3.so":

    [ 21%] Building CXX object CMakeFiles/pc_ble_driver_obj_sd_api_v3.dir/src/common/platform/linux/serial_port_enum.cpp.o
    [ 21%] Built target pc_ble_driver_obj_sd_api_v3
    Scanning dependencies of target pc_ble_driver_static_sd_api_v3
    [ 21%] Linking CXX static library libpc_ble_driver_static_sd_api_v3.a
    [ 21%] Built target pc_ble_driver_static_sd_api_v3
    Scanning dependencies of target pc_ble_driver_shared_sd_api_v3
    [ 21%] Linking CXX shared library libpc_ble_driver_shared_sd_api_v3.so
    /usr/bin/ld: /home/userx/tools/boost_1_61_0/stage/lib/libboost_thread.a(thread.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
    /home/userx/tools/boost_1_61_0/stage/lib/libboost_thread.a: error adding symbols: Bad value
    collect2: error: ld returned 1 exit status
    CMakeFiles/pc_ble_driver_shared_sd_api_v3.dir/build.make:147: recipe for target 'libpc_ble_driver_shared_sd_api_v3.so' failed
    make[2]: *** [libpc_ble_driver_shared_sd_api_v3.so] Error 1
    CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/pc_ble_driver_shared_sd_api_v3.dir/all' failed
    make[1]: *** [CMakeFiles/pc_ble_driver_shared_sd_api_v3.dir/all] Error 2
    Makefile:83: recipe for target 'all' failed
    make: *** [all] Error 2
    

    It looks like the problem is with my BOOST install, but I would expect cmake to catch that. Could you check if you see anything wrong with it? These are ALL steps I used in my build process:

    tar -xzf boost_1_61_0.tar.gz
    cd boost_1_61_0
    mkdir ~/pool
    ./bootstrap.sh --prefix=$HOME/pool --libdir=$HOME/pool/lib --with-libraries="thread,system,regex,date_time,chrono,atomic"
    ./b2
    ./b2 install
    cd ~/projects/test/nordic/test/pc-ble-driver/build
    cmake -B. -H.. -G "Unix Makefiles" -DBOOST_ROOT="~/pool"  -DBOOST_INCLUDEDIR="~/pool"  -DBOOST_LIBRARYDIR="~/pool/lib"
    make
    

    Directory listing:

    userx@userx-vm:~/projects/test/nordic/test/pc-ble-driver/build$ ll ~/pool/lib/
    total 5088
    drwxrwxr-x 2 userx userx    4096 Nov 28 11:28 ./
    drwxrwxr-x 4 userx userx    4096 Nov 28 11:28 ../
    -rw-rw-r-- 1 userx userx    2706 Nov 28 11:28 libboost_atomic.a
    lrwxrwxrwx 1 userx userx      25 Nov 28 11:28 libboost_atomic.so -> libboost_atomic.so.1.61.0*
    -rwxrwxr-x 1 userx userx    8160 Nov 28 11:28 libboost_atomic.so.1.61.0*
    -rw-rw-r-- 1 userx userx  124822 Nov 28 11:28 libboost_chrono.a
    lrwxrwxrwx 1 userx userx      25 Nov 28 11:28 libboost_chrono.so -> libboost_chrono.so.1.61.0*
    -rwxrwxr-x 1 userx userx   36848 Nov 28 11:28 libboost_chrono.so.1.61.0*
    -rw-rw-r-- 1 userx userx  167576 Nov 28 11:28 libboost_date_time.a
    lrwxrwxrwx 1 userx userx      28 Nov 28 11:28 libboost_date_time.so -> libboost_date_time.so.1.61.0*
    -rwxrwxr-x 1 userx userx   98816 Nov 28 11:28 libboost_date_time.so.1.61.0*
    -rw-rw-r-- 1 userx userx 2866496 Nov 28 11:28 libboost_regex.a
    lrwxrwxrwx 1 userx userx      24 Nov 28 11:28 libboost_regex.so -> libboost_regex.so.1.61.0*
    -rwxrwxr-x 1 userx userx 1222904 Nov 28 11:28 libboost_regex.so.1.61.0*
    -rw-rw-r-- 1 userx userx   48046 Nov 28 11:28 libboost_system.a
    lrwxrwxrwx 1 userx userx      25 Nov 28 11:28 libboost_system.so -> libboost_system.so.1.61.0*
    -rwxrwxr-x 1 userx userx   19976 Nov 28 11:28 libboost_system.so.1.61.0*
    -rw-rw-r-- 1 userx userx  373382 Nov 28 11:28 libboost_thread.a
    lrwxrwxrwx 1 userx userx      25 Nov 28 11:28 libboost_thread.so -> libboost_thread.so.1.61.0*
    -rwxrwxr-x 1 userx userx  216264 Nov 28 11:28 libboost_thread.so.1.61.0*
    

    Update #2 2016_11_28:

    The following "fixes" the build:

    sed -i 's/\.a/\.so/g' CMakeFiles/pc_ble_driver_shared_sd_api_v2.dir/link.txt
    sed -i 's/\.a/\.so/g' CMakeFiles/pc_ble_driver_shared_sd_api_v3.dir/link.txt
    

    Not sure what can cause this, but at this point I believe it's something with cmake itself (?)

  • Hi, I'm not able to see anything wrong with your setup. I get the same output when running cmake, and running make afterwards works fine on our machines. I'm not sure what the issue could be here.

  • You are missing some flags in your boost build command. Here is from the README: $ ./b2 toolset=gcc cxxflags=-fPIC cflags=-fPIC address-model=64 link=static --with-thread --with-system --with-regex --with-date_time --with-chrono
    Try rebuilding boost with the extra flags.

Related