ExternalProject_Add_Step ERROR add_custom_command given APPEND option with output - cmake

Using cmake version 3.7.0-rc3 on Win7, I can run the below code using ExternalProject_Add_Step no problem. But using cmake version 3.7.0 on Ubuntu16, I get the error:
add_custom_command given APPEND option with output "ExternalProjects/Stamp/boost/boost-CONFIGURE" which is not already a custom command output.
Here's simplified code that reproduces the issue.
ExternalProject_Add(
boost
URL https://sourceforge.net/projects/boost/files/boost/1.62.0/boost_1_62_0.tar.gz/download
URL_HASH MD5=6f4571e7c5a66ccc3323da6c24be8f05
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
ExternalProject_Add_Step(
boost UNIX_CONFIGURE DEPENDEES DOWNLOAD DEPENDERS CONFIGURE
WORKING_DIRECTORY "<SOURCE_DIR>" COMMAND ./bootstrap.sh
)
The culprit seems to be DEPENDERS CONFIGURE. If I take that out, then it works fine. But... I'd like to be able to specify that the step CONFIGURE depends on this custom step, and on Windows I can, but on Ubuntu I can't. Any ideas why?

I don't see it in the documentation, but you've just simply run into a case sensitivity issue. Modifying your CMakeLists.txt to:
❯ cat ../CMakeLists.txt
cmake_minimum_required(VERSION 3.7)
include(ExternalProject)
ExternalProject_Add(
boost
URL https://sourceforge.net/projects/boost/files/boost/1.62.0/boost_1_62_0.tar.gz/download
URL_HASH MD5=6f4571e7c5a66ccc3323da6c24be8f05
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
ExternalProject_Add_Step(
boost UNIX_CONFIGURE DEPENDEES download DEPENDERS configure
WORKING_DIRECTORY "boost-prefix/src/boost/" COMMAND ./bootstrap.sh
)
Notice that "download" and "configure" in ExternalProject_Add_Step() are now downcased. Now, cmake and make complete successfully.
❯ cmake ..
-- The C compiler identification is AppleClang 8.0.0.8000042
-- The CXX compiler identification is AppleClang 8.0.0.8000042
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/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: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/nega/foo/build
❯ make
Scanning dependencies of target boost
[ 11%] Creating directories for 'boost'
[ 22%] Performing download step (download, verify and extract) for 'boost'
-- verifying file...
file='/Users/nega/foo/build/boost-prefix/src/boost_1_62_0.tar.gz'
-- File already exists and hash match (skip download):
file='/Users/nega/foo/build/boost-prefix/src/boost_1_62_0.tar.gz'
MD5='6f4571e7c5a66ccc3323da6c24be8f05'
-- extracting...
src='/Users/nega/foo/build/boost-prefix/src/boost_1_62_0.tar.gz'
dst='/Users/nega/foo/build/boost-prefix/src/boost'
-- extracting... [tar xfz]
-- extracting... [analysis]
-- extracting... [rename]
-- extracting... [clean up]
-- extracting... done
[ 33%] Performing UNIX_CONFIGURE step for 'boost'
Building Boost.Build engine with toolset darwin... tools/build/src/engine/bin.macosxx86_64/b2
Detecting Python version... 2.7
Detecting Python root... /Users/nega/i3/virtenv
Unicode/ICU support for Boost.Regex?... not found.
Generating Boost.Build configuration in project-config.jam...
Bootstrapping is done. To build, run:
./b2
To adjust configuration, edit 'project-config.jam'.
Further information:
- Command line help:
./b2 --help
- Getting started guide:
http://www.boost.org/more/getting_started/unix-variants.html
- Boost.Build documentation:
http://www.boost.org/build/doc/html/index.html
[ 44%] No update step for 'boost'
[ 55%] No patch step for 'boost'
[ 66%] No configure step for 'boost'
[ 77%] No build step for 'boost'
[ 88%] No install step for 'boost'
[100%] Completed 'boost'
[100%] Built target boost
Now, look in boost-prefix/src/boost-stamp of your build directory:
❯ v boost-prefix/src/boost-stamp
total 32
drwxr-xr-x 15 nega staff 510 Dec 20 12:29 ./
drwxr-xr-x 6 nega staff 204 Dec 20 12:28 ../
-rw-r--r-- 1 nega staff 0 Dec 20 12:29 boost-UNIX_CONFIGURE
-rw-r--r-- 1 nega staff 0 Dec 20 12:29 boost-build
-rw-r--r-- 1 nega staff 0 Dec 20 12:29 boost-configure
-rw-r--r-- 1 nega staff 0 Dec 20 12:29 boost-done
-rw-r--r-- 1 nega staff 0 Dec 20 12:28 boost-download
-rw-r--r-- 1 nega staff 0 Dec 20 12:29 boost-install
-rw-r--r-- 1 nega staff 0 Dec 20 12:28 boost-mkdir
-rw-r--r-- 1 nega staff 0 Dec 20 12:29 boost-patch
-rw-r--r-- 1 nega staff 0 Dec 20 12:29 boost-update
-rw-r--r-- 1 nega staff 173 Dec 20 12:18 boost-urlinfo.txt
-rw-r--r-- 1 nega staff 4424 Dec 20 12:18 download-boost.cmake
-rw-r--r-- 1 nega staff 1611 Dec 20 12:28 extract-boost.cmake
-rw-r--r-- 1 nega staff 0 Dec 20 12:28 verify-boost.cmake
You'll notice at each step has a "file stamp" named after it. The default steps are all in lowercase, and your custom step "UNIX_CONFIGURE" is uppercase, just as you defined it. If you mix case your custom step, you'll get that as output.
❯ grep -i unix ../CMakeLists.txt
boost uNiX_CoNFiGuRe DEPENDEES download DEPENDERS configure
❯ make | grep -i unix
[ 33%] Performing uNiX_CoNFiGuRe step for 'boost'
❯ find boost-prefix/src/boost-stamp | grep -i unix
boost-prefix/src/boost-stamp/boost-uNiX_CoNFiGuRe
Also, look at the make output.
[ 22%] Performing download step (download, verify and extract) for 'boost'
[....]
[ 33%] Performing uNiX_CoNFiGuRe step for 'boost'
[....]
[ 44%] No update step for 'boost'
[ 55%] No patch step for 'boost'
[ 66%] No configure step for 'boost'
[ 77%] No build step for 'boost'
[ 88%] No install step for 'boost'
[100%] Completed 'boost'
[100%] Built target boost
All the default steps are referred to in lowercase.
Summary
In CMake's ExternalProject module, refer to default steps in lowercase.

Related

Does Apache Guacamole support VNC Connection with GNUTLS?

Currently I've working on my custom Remote Desktop Service which is strongly based on Apache Guacamole.
I found that I can encrypt VNC connection between Guacamole (which is actually LibVNCClient) and my TigerVNC Server with SSL/TLS.
So I built LibVNCServer with -DWITH_GNUTLS=ON -DWITH_OPENSSL=OFFoption and installed Guacamole based on customed LibVNCServer.
Below is the generated log when I build LibVNCServer and Guacamole.
cmake -DWITH_OPENSSL=OFF -DWITH_GNUTLS=ON ..
-- The C compiler identification is GNU 4.8.5
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.7")
-- Found LZO: /usr/lib64/liblzo2.so
-- Found JPEG: /usr/lib64/libjpeg.so (found version "62")
-- Performing Test FOUND_LIBJPEG_TURBO
-- Performing Test FOUND_LIBJPEG_TURBO - Success
-- Found PNG: /usr/lib64/libpng.so (found version "1.5.13")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- 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
-- Found SDL2: /usr/lib64/libSDL2.so;-lpthread
-- Found GTK2_GTK: /usr/lib64/libgtk-x11-2.0.so
-- Found GnuTLS: /usr/lib64/libgnutls.so (found version "3.3.29")
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.27.1")
-- Checking for module 'libsystemd'
-- Found libsystemd, version 219
-- Found FFMPEG: /usr/include/ffmpeg (found suitable version "3.4.9", minimum required is "3.1.0") found components: avformat avcodec avutil swscale
-- Looking for dirent.h
-- Looking for dirent.h - found
-- Looking for endian.h
-- Looking for endian.h - found
-- Looking for fcntl.h
-- Looking for fcntl.h - found
-- Looking for netinet/in.h
-- Looking for netinet/in.h - found
-- Looking for sys/endian.h
-- Looking for sys/endian.h - not found
-- Looking for sys/socket.h
-- Looking for sys/socket.h - found
-- Looking for sys/stat.h
-- Looking for sys/stat.h - found
-- Looking for sys/time.h
-- Looking for sys/time.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for sys/wait.h
-- Looking for sys/wait.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for sys/resource.h
-- Looking for sys/resource.h - found
-- Looking for vfork.h
-- Looking for vfork.h - not found
-- Looking for ws2tcpip.h
-- Looking for ws2tcpip.h - not found
-- Looking for arpa/inet.h
-- Looking for arpa/inet.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for gettimeofday
-- Looking for gettimeofday - found
-- Looking for vfork
-- Looking for vfork - found
-- Looking for vprintf
-- Looking for vprintf - found
-- Looking for mmap
-- Looking for mmap - found
-- Looking for fork
-- Looking for fork - found
-- Looking for ftime
-- Looking for ftime - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for gethostname
-- Looking for gethostname - found
-- Looking for inet_ntoa
-- Looking for inet_ntoa - found
-- Looking for memmove
-- Looking for memmove - found
-- Looking for memset
-- Looking for memset - found
-- Looking for mkfifo
-- Looking for mkfifo - found
-- Looking for select
-- Looking for select - found
-- Looking for socket
-- Looking for socket - found
-- Looking for strchr
-- Looking for strchr - found
-- Looking for strcspn
-- Looking for strcspn - found
-- Looking for strdup
-- Looking for strdup - found
-- Looking for strerror
-- Looking for strerror - found
-- Looking for strstr
-- Looking for strstr - found
-- Looking for htobe64
-- Looking for htobe64 - found
-- Looking for OSSwapHostToBigInt64
-- Looking for OSSwapHostToBigInt64 - not found
-- Building crypto with builtin functions, only including SHA1 and D3DES
-- Threads support is using pthreads
-- Check size of pid_t
-- Check size of pid_t - done
-- Check size of size_t
-- Check size of size_t - done
-- Check size of socklen_t
-- Check size of socklen_t - done
-- Check size of in_addr_t
-- Check size of in_addr_t - done
-- Check if the system is big endian
-- Searching 16 bit integer
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Searching 16 bit integer - Using unsigned short
-- Check if the system is big endian - little endian
-- Building TLS with GnuTLS
-- Configuring done
-- Generating done
-- Build files have been written to: /root/libvncserver/build
[root#localhost build]# cmake --build .
Scanning dependencies of target vncclient
[ 1%] Building C object CMakeFiles/vncclient.dir/libvncclient/cursor.c.o
[ 2%] Building C object CMakeFiles/vncclient.dir/libvncclient/listen.c.o
[ 3%] Building C object CMakeFiles/vncclient.dir/libvncclient/rfbproto.c.o
[ 4%] Building C object CMakeFiles/vncclient.dir/libvncclient/sockets.c.o
[ 5%] Building C object CMakeFiles/vncclient.dir/libvncclient/vncviewer.c.o
[ 6%] Building C object CMakeFiles/vncclient.dir/common/crypto_included.c.o
[ 7%] Building C object CMakeFiles/vncclient.dir/common/sha1.c.o
[ 8%] Building C object CMakeFiles/vncclient.dir/common/d3des.c.o
[ 8%] Building C object CMakeFiles/vncclient.dir/common/turbojpeg.c.o
[ 9%] Building C object CMakeFiles/vncclient.dir/libvncclient/tls_gnutls.c.o
[ 10%] Linking C shared library libvncclient.so
[ 10%] Built target vncclient
Scanning dependencies of target vncserver
[ 11%] Building C object CMakeFiles/vncserver.dir/libvncserver/main.c.o
[ 12%] Building C object CMakeFiles/vncserver.dir/libvncserver/rfbserver.c.o
/root/libvncserver/libvncserver/rfbserver.c: In function ‘rfbProcessExtendedServerCutTextData’:
/root/libvncserver/libvncserver/rfbserver.c:2134:20: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
stream.next_in = data;
^
[ 13%] Building C object CMakeFiles/vncserver.dir/libvncserver/rfbregion.c.o
[ 14%] Building C object CMakeFiles/vncserver.dir/libvncserver/auth.c.o
[ 15%] Building C object CMakeFiles/vncserver.dir/libvncserver/sockets.c.o
[ 16%] Building C object CMakeFiles/vncserver.dir/libvncserver/stats.c.o
[ 17%] Building C object CMakeFiles/vncserver.dir/libvncserver/corre.c.o
[ 18%] Building C object CMakeFiles/vncserver.dir/libvncserver/hextile.c.o
[ 19%] Building C object CMakeFiles/vncserver.dir/libvncserver/rre.c.o
[ 20%] Building C object CMakeFiles/vncserver.dir/libvncserver/translate.c.o
[ 21%] Building C object CMakeFiles/vncserver.dir/libvncserver/cutpaste.c.o
[ 21%] Building C object CMakeFiles/vncserver.dir/libvncserver/httpd.c.o
[ 22%] Building C object CMakeFiles/vncserver.dir/libvncserver/cursor.c.o
[ 23%] Building C object CMakeFiles/vncserver.dir/libvncserver/font.c.o
[ 24%] Building C object CMakeFiles/vncserver.dir/libvncserver/draw.c.o
[ 25%] Building C object CMakeFiles/vncserver.dir/libvncserver/selbox.c.o
[ 26%] Building C object CMakeFiles/vncserver.dir/common/vncauth.c.o
[ 27%] Building C object CMakeFiles/vncserver.dir/libvncserver/cargs.c.o
[ 28%] Building C object CMakeFiles/vncserver.dir/libvncserver/ultra.c.o
[ 29%] Building C object CMakeFiles/vncserver.dir/libvncserver/scale.c.o
[ 30%] Building C object CMakeFiles/vncserver.dir/common/crypto_included.c.o
[ 31%] Building C object CMakeFiles/vncserver.dir/common/sha1.c.o
[ 32%] Building C object CMakeFiles/vncserver.dir/common/d3des.c.o
[ 33%] Building C object CMakeFiles/vncserver.dir/libvncserver/rfbssl_gnutls.c.o
[ 33%] Building C object CMakeFiles/vncserver.dir/libvncserver/zlib.c.o
[ 34%] Building C object CMakeFiles/vncserver.dir/libvncserver/zrle.c.o
[ 35%] Building C object CMakeFiles/vncserver.dir/libvncserver/zrleoutstream.c.o
[ 36%] Building C object CMakeFiles/vncserver.dir/libvncserver/zrlepalettehelper.c.o
[ 37%] Building C object CMakeFiles/vncserver.dir/libvncserver/tight.c.o
[ 38%] Building C object CMakeFiles/vncserver.dir/common/turbojpeg.c.o
[ 39%] Building C object CMakeFiles/vncserver.dir/libvncserver/tightvnc-filetransfer/rfbtightserver.c.o
[ 40%] Building C object CMakeFiles/vncserver.dir/libvncserver/tightvnc-filetransfer/handlefiletransferrequest.c.o
[ 41%] Building C object CMakeFiles/vncserver.dir/libvncserver/tightvnc-filetransfer/filetransfermsg.c.o
[ 42%] Building C object CMakeFiles/vncserver.dir/libvncserver/tightvnc-filetransfer/filelistinfo.c.o
[ 43%] Building C object CMakeFiles/vncserver.dir/libvncserver/websockets.c.o
[ 44%] Building C object CMakeFiles/vncserver.dir/libvncserver/ws_decode.c.o
[ 45%] Building C object CMakeFiles/vncserver.dir/common/base64.c.o
[ 46%] Linking C shared library libvncserver.so
[ 46%] Built target vncserver
Scanning dependencies of target test_tjbench
[ 47%] Building C object CMakeFiles/test_tjbench.dir/test/tjbench.c.o
[ 48%] Building C object CMakeFiles/test_tjbench.dir/test/tjutil.c.o
[ 49%] Building C object CMakeFiles/test_tjbench.dir/test/bmp.c.o
[ 50%] Building C object CMakeFiles/test_tjbench.dir/common/turbojpeg.c.o
[ 51%] Linking C executable test/tjbench
[ 51%] Built target test_tjbench
Scanning dependencies of target test_copyrecttest
[ 52%] Building C object CMakeFiles/test_copyrecttest.dir/test/copyrecttest.c.o
[ 53%] Linking C executable test/copyrecttest
[ 53%] Built target test_copyrecttest
Scanning dependencies of target test_cargstest
[ 54%] Building C object CMakeFiles/test_cargstest.dir/test/cargstest.c.o
[ 55%] Linking C executable test/cargstest
[ 55%] Built target test_cargstest
Scanning dependencies of target client_examples_gtkvncviewer
[ 56%] Building C object CMakeFiles/client_examples_gtkvncviewer.dir/client_examples/gtkvncviewer.c.o
[ 57%] Linking C executable client_examples/gtkvncviewer
[ 57%] Built target client_examples_gtkvncviewer
Scanning dependencies of target test_wstest
[ 58%] Building C object CMakeFiles/test_wstest.dir/test/wstest.c.o
[ 59%] Linking C executable test/wstest
[ 59%] Built target test_wstest
Scanning dependencies of target examples_fontsel
[ 60%] Building C object CMakeFiles/examples_fontsel.dir/examples/fontsel.c.o
[ 61%] Linking C executable examples/fontsel
[ 61%] Built target examples_fontsel
Scanning dependencies of target examples_pnmshow24
[ 62%] Building C object CMakeFiles/examples_pnmshow24.dir/examples/pnmshow24.c.o
[ 62%] Linking C executable examples/pnmshow24
[ 62%] Built target examples_pnmshow24
Scanning dependencies of target copy-compile-commands
[ 62%] Built target copy-compile-commands
Scanning dependencies of target examples_regiontest
[ 63%] Building C object CMakeFiles/examples_regiontest.dir/examples/regiontest.c.o
[ 64%] Linking C executable examples/regiontest
[ 64%] Built target examples_regiontest
Scanning dependencies of target examples_cursors
[ 65%] Building C object CMakeFiles/examples_cursors.dir/examples/cursors.c.o
[ 66%] Linking C executable examples/cursors
[ 66%] Built target examples_cursors
Scanning dependencies of target examples_camera
[ 67%] Building C object CMakeFiles/examples_camera.dir/examples/camera.c.o
[ 67%] Linking C executable examples/camera
[ 67%] Built target examples_camera
Scanning dependencies of target examples_backchannel
[ 68%] Building C object CMakeFiles/examples_backchannel.dir/examples/backchannel.c.o
[ 69%] Linking C executable examples/backchannel
[ 69%] Built target examples_backchannel
Scanning dependencies of target examples_vncev
[ 69%] Building C object CMakeFiles/examples_vncev.dir/examples/vncev.c.o
[ 70%] Linking C executable examples/vncev
[ 70%] Built target examples_vncev
Scanning dependencies of target client_examples_SDLvncviewer
[ 70%] Building C object CMakeFiles/client_examples_SDLvncviewer.dir/client_examples/SDLvncviewer.c.o
[ 71%] Linking C executable client_examples/SDLvncviewer
[ 71%] Built target client_examples_SDLvncviewer
Scanning dependencies of target examples_pnmshow
[ 72%] Building C object CMakeFiles/examples_pnmshow.dir/examples/pnmshow.c.o
[ 73%] Linking C executable examples/pnmshow
[ 73%] Built target examples_pnmshow
Scanning dependencies of target examples_colourmaptest
[ 74%] Building C object CMakeFiles/examples_colourmaptest.dir/examples/colourmaptest.c.o
[ 75%] Linking C executable examples/colourmaptest
[ 75%] Built target examples_colourmaptest
Scanning dependencies of target test_encodingstest
[ 76%] Building C object CMakeFiles/test_encodingstest.dir/test/encodingstest.c.o
[ 77%] Linking C executable test/encodingstest
[ 77%] Built target test_encodingstest
Scanning dependencies of target examples_example
[ 78%] Building C object CMakeFiles/examples_example.dir/examples/example.c.o
[ 79%] Linking C executable examples/example
[ 79%] Built target examples_example
Scanning dependencies of target examples_blooptest
[ 80%] Building C object CMakeFiles/examples_blooptest.dir/examples/blooptest.c.o
[ 81%] Linking C executable examples/blooptest
[ 81%] Built target examples_blooptest
Scanning dependencies of target examples_repeater
[ 82%] Building C object CMakeFiles/examples_repeater.dir/examples/repeater.c.o
[ 83%] Linking C executable examples/repeater
[ 83%] Built target examples_repeater
Scanning dependencies of target test_tjunittest
[ 84%] Building C object CMakeFiles/test_tjunittest.dir/test/tjunittest.c.o
[ 84%] Building C object CMakeFiles/test_tjunittest.dir/test/tjutil.c.o
[ 85%] Building C object CMakeFiles/test_tjunittest.dir/common/turbojpeg.c.o
[ 86%] Linking C executable test/tjunittest
[ 86%] Built target test_tjunittest
Scanning dependencies of target examples_rotate
[ 87%] Building C object CMakeFiles/examples_rotate.dir/examples/rotate.c.o
[ 88%] Linking C executable examples/rotate
[ 88%] Built target examples_rotate
Scanning dependencies of target examples_simple
[ 89%] Building C object CMakeFiles/examples_simple.dir/examples/simple.c.o
[ 90%] Linking C executable examples/simple
[ 90%] Built target examples_simple
Scanning dependencies of target examples_simple15
[ 91%] Building C object CMakeFiles/examples_simple15.dir/examples/simple15.c.o
[ 92%] Linking C executable examples/simple15
[ 92%] Built target examples_simple15
Scanning dependencies of target examples_storepasswd
[ 93%] Building C object CMakeFiles/examples_storepasswd.dir/examples/storepasswd.c.o
[ 94%] Linking C executable examples/storepasswd
[ 94%] Built target examples_storepasswd
Scanning dependencies of target examples_filetransfer
[ 95%] Building C object CMakeFiles/examples_filetransfer.dir/examples/filetransfer.c.o
[ 96%] Linking C executable examples/filetransfer
[ 96%] Built target examples_filetransfer
Scanning dependencies of target client_examples_backchannel
[ 97%] Building C object CMakeFiles/client_examples_backchannel.dir/client_examples/backchannel.c.o
[ 98%] Linking C executable client_examples/backchannel
[ 98%] Built target client_examples_backchannel
Scanning dependencies of target client_examples_ppmtest
[ 99%] Building C object CMakeFiles/client_examples_ppmtest.dir/client_examples/ppmtest.c.o
[100%] Linking C executable client_examples/ppmtest
[100%] Built target client_examples_ppmtest
[root#localhost build]# make
[ 10%] Built target vncclient
[ 46%] Built target vncserver
[ 51%] Built target test_tjbench
[ 53%] Built target test_copyrecttest
[ 55%] Built target test_cargstest
[ 57%] Built target client_examples_gtkvncviewer
[ 59%] Built target test_wstest
[ 61%] Built target examples_fontsel
[ 62%] Built target examples_pnmshow24
[ 62%] Built target copy-compile-commands
[ 64%] Built target examples_regiontest
[ 66%] Built target examples_cursors
[ 67%] Built target examples_camera
[ 69%] Built target examples_backchannel
[ 70%] Built target examples_vncev
[ 71%] Built target client_examples_SDLvncviewer
[ 73%] Built target examples_pnmshow
[ 75%] Built target examples_colourmaptest
[ 77%] Built target test_encodingstest
[ 79%] Built target examples_example
[ 81%] Built target examples_blooptest
[ 83%] Built target examples_repeater
[ 86%] Built target test_tjunittest
[ 88%] Built target examples_rotate
[ 90%] Built target examples_simple
[ 92%] Built target examples_simple15
[ 94%] Built target examples_storepasswd
[ 96%] Built target examples_filetransfer
[ 98%] Built target client_examples_backchannel
[100%] Built target client_examples_ppmtest
[root#localhost build]# make test
Running tests...
Test project /root/libvncserver/build
Start 1: cargs
1/4 Test #1: cargs ............................ Passed 0.01 sec
Start 2: includetest
2/4 Test #2: includetest ...................... Passed 0.62 sec
Start 3: turbojpeg
3/4 Test #3: turbojpeg ........................ Passed 6.17 sec
Start 4: wstest
4/4 Test #4: wstest ........................... Passed 0.01 sec
100% tests passed, 0 tests failed out of 4
Total Test time (real) = 6.82 sec
[root#localhost build]# make install
[ 10%] Built target vncclient
[ 46%] Built target vncserver
[ 51%] Built target test_tjbench
[ 53%] Built target test_copyrecttest
[ 55%] Built target test_cargstest
[ 57%] Built target client_examples_gtkvncviewer
[ 59%] Built target test_wstest
[ 61%] Built target examples_fontsel
[ 62%] Built target examples_pnmshow24
[ 62%] Built target copy-compile-commands
[ 64%] Built target examples_regiontest
[ 66%] Built target examples_cursors
[ 67%] Built target examples_camera
[ 69%] Built target examples_backchannel
[ 70%] Built target examples_vncev
[ 71%] Built target client_examples_SDLvncviewer
[ 73%] Built target examples_pnmshow
[ 75%] Built target examples_colourmaptest
[ 77%] Built target test_encodingstest
[ 79%] Built target examples_example
[ 81%] Built target examples_blooptest
[ 83%] Built target examples_repeater
[ 86%] Built target test_tjunittest
[ 88%] Built target examples_rotate
[ 90%] Built target examples_simple
[ 92%] Built target examples_simple15
[ 94%] Built target examples_storepasswd
[ 96%] Built target examples_filetransfer
[ 98%] Built target client_examples_backchannel
[100%] Built target client_examples_ppmtest
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/lib64/libvncclient.so.0.9.13
-- Up-to-date: /usr/local/lib64/libvncclient.so.1
-- Up-to-date: /usr/local/lib64/libvncclient.so
-- Up-to-date: /usr/local/include/rfb/keysym.h
-- Up-to-date: /usr/local/include/rfb/threading.h
-- Up-to-date: /usr/local/include/rfb/rfb.h
-- Up-to-date: /usr/local/include/rfb/rfbclient.h
-- Installing: /usr/local/include/rfb/rfbconfig.h
-- Up-to-date: /usr/local/include/rfb/rfbproto.h
-- Up-to-date: /usr/local/include/rfb/rfbregion.h
-- Installing: /usr/local/lib64/libvncserver.so.0.9.13
-- Up-to-date: /usr/local/lib64/libvncserver.so.1
-- Up-to-date: /usr/local/lib64/libvncserver.so
-- Up-to-date: /usr/local/include/rfb/keysym.h
-- Up-to-date: /usr/local/include/rfb/threading.h
-- Up-to-date: /usr/local/include/rfb/rfb.h
-- Up-to-date: /usr/local/include/rfb/rfbclient.h
-- Up-to-date: /usr/local/include/rfb/rfbconfig.h
-- Up-to-date: /usr/local/include/rfb/rfbproto.h
-- Up-to-date: /usr/local/include/rfb/rfbregion.h
-- Installing: /usr/local/lib64/cmake/LibVNCServer/LibVNCServerTargets.cmake
-- Installing: /usr/local/lib64/cmake/LibVNCServer/LibVNCServerTargets-noconfig.cmake
-- Installing: /usr/local/lib64/cmake/LibVNCServer/LibVNCServerConfigVersion.cmake
-- Installing: /usr/local/lib64/cmake/LibVNCServer/LibVNCServerConfig.cmake
-- Installing: /usr/local/lib64/pkgconfig/libvncserver.pc
-- Installing: /usr/local/lib64/pkgconfig/libvncclient.pc
------------------------------------------------
guacamole-server version 1.2.0
------------------------------------------------
Library status:
freerdp2 ............ yes
pango ............... yes
libavcodec .......... yes
libavformat.......... yes
libavutil ........... yes
libssh2 ............. yes
libssl .............. yes
libswscale .......... yes
libtelnet ........... yes
libVNCServer ........ yes
libvorbis ........... yes
libpulse ............ yes
libwebsockets ....... yes
libwebp ............. yes
wsock32 ............. no
Protocol support:
Kubernetes .... yes
RDP ........... yes
SSH ........... yes
Telnet ........ yes
Rlogin ........ yes
VNC ........... yes
Services / tools:
guacd ...... yes
guacenc .... yes
guaclog .... yes
FreeRDP plugins: /usr/lib64/freerdp2
Init scripts: /etc/init.d
Systemd units: no
Type "make" to compile guacamole-server.
Below is guacd log when I try to connect TigerVNC Server via Guacamole.
Jan 13 17:33:42 localhost guacd[19563]: Creating new client for protocol "vnc"
Jan 13 17:33:42 localhost guacd[19563]: Connection ID is "$83a2d4dd-24cc-441a-af1e-66a0e429639c"
Jan 13 17:33:42 localhost guacd[31041]: Cursor rendering: local
Jan 13 17:33:42 localhost guacd[31041]: User "#9cdcd7df-1d51-498f-bb4b-2399d1a1b8de" joined connection "$83a2d4dd-24cc-441a-af1e-66a0e429639c" (1 users now present)
Jan 13 17:33:42 localhost guacd[31041]: VNC server supports protocol version 3.8 (viewer 3.8)
Jan 13 17:33:42 localhost guacd[31041]: We have 2 security types to read
Jan 13 17:33:42 localhost guacd[31041]: 0) Received security type 19
Jan 13 17:33:42 localhost guacd[31041]: Selecting security type 19 (0/2 in the list)
Jan 13 17:33:42 localhost guacd[31041]: 1) Received security type 19
Jan 13 17:33:42 localhost guacd[31041]: Selected Security Scheme 19
Jan 13 17:33:42 localhost guacd[31041]: TLS is not supported.
Jan 13 17:33:42 localhost guacd[31041]: Connect failed. Waiting 1000ms before retrying...
Jan 13 17:33:43 localhost guacd[31041]: VNC server supports protocol version 3.8 (viewer 3.8)
Jan 13 17:33:43 localhost guacd[31041]: We have 2 security types to read
Jan 13 17:33:43 localhost guacd[31041]: 0) Received security type 19
Jan 13 17:33:43 localhost guacd[31041]: Selecting security type 19 (0/2 in the list)
Jan 13 17:33:43 localhost guacd[31041]: 1) Received security type 19
Jan 13 17:33:43 localhost guacd[31041]: Selected Security Scheme 19
Jan 13 17:33:43 localhost guacd[31041]: TLS is not supported.
Jan 13 17:33:43 localhost guacd[31041]: Connect failed. Waiting 1000ms before retrying...
Jan 13 17:33:44 localhost guacd[31041]: VNC server supports protocol version 3.8 (viewer 3.8)
Jan 13 17:33:44 localhost guacd[31041]: We have 2 security types to read
Jan 13 17:33:44 localhost guacd[31041]: 0) Received security type 19
Jan 13 17:33:44 localhost guacd[31041]: Selecting security type 19 (0/2 in the list)
Jan 13 17:33:44 localhost guacd[31041]: 1) Received security type 19
Jan 13 17:33:44 localhost guacd[31041]: Selected Security Scheme 19
Jan 13 17:33:44 localhost guacd[31041]: TLS is not supported.
Jan 13 17:33:44 localhost guacd[31041]: Connect failed. Waiting 1000ms before retrying...
Jan 13 17:33:45 localhost guacd[31041]: VNC server supports protocol version 3.8 (viewer 3.8)
Jan 13 17:33:45 localhost guacd[31041]: We have 2 security types to read
Jan 13 17:33:45 localhost guacd[31041]: 0) Received security type 19
Jan 13 17:33:45 localhost guacd[31041]: Selecting security type 19 (0/2 in the list)
Jan 13 17:33:45 localhost guacd[31041]: 1) Received security type 19
Jan 13 17:33:45 localhost guacd[31041]: Selected Security Scheme 19
Jan 13 17:33:45 localhost guacd[31041]: TLS is not supported.
Jan 13 17:33:45 localhost guacd[31041]: Unable to connect to VNC server.
Jan 13 17:33:45 localhost guacd[31041]: User "#9cdcd7df-1d51-498f-bb4b-2399d1a1b8de" disconnected (0 users remain)
Jan 13 17:33:45 localhost guacd[31041]: Last user of connection "$83a2d4dd-24cc-441a-af1e-66a0e429639c" disconnected
Jan 13 17:33:47 localhost guacd[19563]: Connection "$83a2d4dd-24cc-441a-af1e-66a0e429639c" removed.
I cannot find any error log during make and make install.
What can I do further for encrypting my VNC connection?
Don't consider this a proper answer because it probably won't solve your issue.
Actually it works for me:
I have started TigerVNC v1.11.0 like this:
vncserver -geometry 1024x768 -SecurityTypes TLSVnc -alwaysshared :1
Log:
$ cat ~/.vnc/debian:5901.log
Sat Jun 25 19:39:46 2022
Connections: accepted: 127.0.0.1::47286
SConnection: Client needs protocol version 3.8
SConnection: Client requests security type VeNCrypt(19)
SVeNCrypt: Client requests security type TLSVnc (258)
Sat Jun 25 19:39:48 2022
VNCSConnST: Server default pixel format depth 24 (32bpp) little-endian rgb888
VNCSConnST: Client pixel format depth 24 (32bpp) little-endian rgb888
I am using Guacamole v1.3.0. Log:
# journalctl -u guacd.service
Jun 25 19:39:46 debian guacd[270122]: Creating new client for protocol "vnc"
Jun 25 19:39:46 debian guacd[270122]: Connection ID is "$14bc9889-ad11-4457-96ee-091f1f06455c"
Jun 25 19:39:46 debian guacd[892713]: Cursor rendering: local
Jun 25 19:39:46 debian guacd[892713]: User "#549da414-67b2-4679-968d-216c11142a74" joined connection "$14bc9889-ad11-4457-96ee-091f1f06455c" (1 users now present)
Jun 25 19:39:46 debian guacd[892713]: Using non-standard VNC clipboard encoding: 'UTF-8'.
Jun 25 19:39:46 debian guacd[892713]: VNC server supports protocol version 3.8 (viewer 3.8)
Jun 25 19:39:46 debian guacd[892713]: We have 1 security types to read
Jun 25 19:39:46 debian guacd[892713]: 0) Received security type 19
Jun 25 19:39:46 debian guacd[892713]: Selecting security type 19 (0/1 in the list)
Jun 25 19:39:46 debian guacd[892713]: Selected Security Scheme 19
Jun 25 19:39:46 debian guacd[892713]: GnuTLS version 3.7.1 initialized.
Jun 25 19:39:46 debian guacd[892713]: Got VeNCrypt version 0.2 from server.
Jun 25 19:39:46 debian guacd[892713]: We have 1 security types to read
Jun 25 19:39:46 debian guacd[892713]: 0) Received security type 258
Jun 25 19:39:46 debian guacd[892713]: Selecting security type 258 (0/1 in the list)
Jun 25 19:39:46 debian guacd[892713]: TLS session initialized.
Jun 25 19:39:46 debian guacd[892713]: TLS anonymous credential created.
Jun 25 19:39:46 debian guacd[892713]: TLS handshake blocking.
Jun 25 19:39:47 debian guacd[892713]: TLS handshake blocking.
Jun 25 19:39:48 debian guacd[892713]: TLS handshake done.
Jun 25 19:39:48 debian guacd[892713]: Libgcrypt warning: missing initialization - please fix the application
Jun 25 19:39:48 debian guacd[892713]: VNC authentication succeeded
I don't think that SSL library plays a role, but just in case stock guacd is linked against OpenSSL:
# ldd `which guacd`
libcrypto.so.1.1 => /lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007fabf9992000)
libssl.so.1.1 => /lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007fabfa0ac000)
So I suggest you to try to upgrade TigerVNC first (as it seems to be the easiest in your case). If that does not help, then try stock guacd.

CMake INSTALL and RENAME cannot find file

I'm trying to make and install a config.cmake file for the project that I'm building, and the install part isn't working because apparently it can't find the file. I was originally using the INSTALL command from cmake, and when that didn't work I tried file( RENAME ... ) because I have a little more experience with it - neither seem to work. I've verified that the file is being made in the correct location and with the expected filename.
This is the relevant part of the CMakeLists.txt:
################################################################################
# Build the config.cmake file for finding project information
################################################################################
file(WRITE ${CMAKE_BINARY_DIR}/${PROJECT_NAME}Config.cmake "set(${PROJECT_NAME}_PROTO_DIR ${PROTO_MAIN_DIR})\n")
file(APPEND ${CMAKE_BINARY_DIR}/${PROJECT_NAME}Config.cmake "set(${PROJECT_NAME}_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/include/;${PROTO_GEN_DIR})\n")
file(APPEND ${CMAKE_BINARY_DIR}/${PROJECT_NAME}Config.cmake "set(${PROJECT_NAME}_LIBRARY_DIR ${CMAKE_CURRENT_LIST_DIR}/lib/)\n")
file(APPEND ${CMAKE_BINARY_DIR}/${PROJECT_NAME}Config.cmake "set(${PROJECT_NAME}_LIBRARIES ${PROJECT_LIBRARIES})\n")
message( "CMAKE_BINARY_DIR: " ${CMAKE_BINARY_DIR} )
message( "PROJECT_NAME: " ${PROJECT_NAME} )
#INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}Config.cmake DESTINATION ~/CMake/Modules/)
file(RENAME ${CMAKE_BINARY_DIR}/${PROJECT_NAME}Config.cmake ~/CMake/Modules/${PROJECT_NAME}Config.cmake)
Here's the relevant output when I try to rune cmake:
CMAKE_BINARY_DIR: /home/ava/workspace/frontseat_drivers/build
PROJECT_NAME: frontseat
CMake Error at src/frontseat/CMakeLists.txt:47 (file):
file RENAME failed to rename
/home/ava/workspace/frontseat_drivers/build/frontseatConfig.cmake
to
~/CMake/Modules/frontseatConfig.cmake
because: No such file or directory
and here's output confirming that the file is where I expect with the name that I expect:
ava#3b97b310abf0:~/workspace/frontseat_drivers/build$ ls -l
total 32
-rw-rw-r--. 1 ava ava 12219 Jun 13 19:04 CMakeCache.txt
drwxrwxr-x. 5 ava ava 4096 Jun 13 18:48 CMakeFiles
-rw-rw-r--. 1 ava ava 2250 Jun 13 15:41 cmake_install.cmake
-rw-rw-r--. 1 ava ava 315 Jun 14 12:30 frontseatConfig.cmake
-rw-rw-r--. 1 ava ava 6397 Jun 13 18:48 Makefile
drwxrwxr-x. 5 ava ava 98 Jun 13 18:48 src
What would cause CMake not to be able to see the file?
The error is probably about destination file ~/CMake/Modules/frontseatConfig.cmake. It is because CMake doesn't interpret ~ part, so it cannot resolve the path correctly.
Instead of ~ use $ENV{HOME} for point to the user's home directory.

Can not link libuuid when using CMake toolchain file to cross-compile Azure IoTHub SDK

I don't know how to write CMake toolchain-file properly to build Azure IoTHub SDK v1.2.10 successfully.
This is my command:
azure-iot-sdk-c/build_all/linux# ./build.sh --no-amqp --no-http --no_uploadtoblob --no-logging --toolchain-file mytoolchain.cmake
And here is the build result, ld cannot find -luuid:
Scanning dependencies of target iothub_convenience_sample
[ 69%] Building C object iothub_client/samples/iothub_convenience_sample/CMakeFiles/iothub_convenience_sample.dir/iothub_convenience_sample.c.o
[ 70%] Building C object iothub_client/samples/iothub_convenience_sample/CMakeFiles/iothub_convenience_sample.dir/__/__/__/certs/certs.c.o
[ 71%] Linking C executable iothub_convenience_sample
/usr/local/bin/compile_tool/arm-2010q1/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -luuid
collect2: ld returned 1 exit status
iothub_client/samples/iothub_convenience_sample/CMakeFiles/iothub_convenience_sample.dir/build.make:128: recipe for target 'iothub_client/samples/iothub_convenience_sample/iothub_convenience_sample' failed
make[2]: *** [iothub_client/samples/iothub_convenience_sample/iothub_convenience_sample] Error 1
CMakeFiles/Makefile2:1327: recipe for target 'iothub_client/samples/iothub_convenience_sample/CMakeFiles/iothub_convenience_sample.dir/all' failed
make[1]: *** [iothub_client/samples/iothub_convenience_sample/CMakeFiles/iothub_convenience_sample.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Below is my toolchain-file:
INCLUDE(CMakeForceCompiler)
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_C_COMPILER /usr/local/bin/compile_tool/arm-2010q1/bin/arm-none-linux-gnueabi-gcc)
SET(CMAKE_CXX_COMPILER /usr/local/bin/compile_tool/arm-2010q1/bin/arm-none-linux-gnueabi-g++)
# set OpenSSL path
SET(OPENSSL_SSL_LIBRARY /myspace/application/openssl/libssl.so)
SET(OPENSSL_CRYPTO_LIBRARY /myspace/application/openssl/libcrypto.so)
SET(OPENSSL_INCLUDE_DIR /myspace/application/openssl/include)
# I can use INCLUDE_DIRECTORIES to find uuid.h
INCLUDE_DIRECTORIES(/myspace/application/libuuid/include)
# But I can't link libuuid by setting CMAKE_FIND_ROOT_PATH... Why?
SET(CMAKE_FIND_ROOT_PATH /myspace/application/libuuid/lib)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
I've downloaded libuuid sources and built it into /myspace/application/libuuid/lib/:
root#my-pc:/myspace/application/libuuid/lib# ls -l
total 116
-rw-r--r-- 1 root root 63258 十一 9 13:57 libuuid.a
-rwxr-xr-x 1 root root 953 十一 9 13:57 libuuid.la
lrwxrwxrwx 1 root root 16 十一 9 13:57 libuuid.so -> libuuid.so.1.0.0
lrwxrwxrwx 1 root root 16 十一 9 13:57 libuuid.so.1 -> libuuid.so.1.0.0
-rwxr-xr-x 1 root root 41893 十一 9 13:57 libuuid.so.1.0.0
drwxr-xr-x 2 root root 4096 十一 9 13:57 pkgconfig
However, if I manually copy libuuid.so.1 and libuuid.so.1.0.0 to the path within my cross-compiler(/usr/local/bin/compile_tool/arm-2010q1/arm-none-linux-gnueabi/lib), it can successfully link libuuid.
So, I think there must be something wrong in my toolchain-file. I've tried to use CMAKE_EXE_LINKER_FLAGS, CMAKE_SHARED_LINKER_FLAGS, link_directories, and link_libraries, all of above failed.
I hope somebody can teach me how to improve my toolchain-file. Thanks!
PS. I don't want to modify Azure IoTHub sources in order to keep it unchanged and easy to maintain.
I have installed compiled libuuid library in cross compiler default path. I use aarch64-linux-gnu so default path will be /usr/aarch64-linux-gnu/

CMake define new target by string processing existing $<TARGET_FILE>

I"m trying to modernize an older CMake script that essentially does the following to generate a libtool file:
get_target_property(target_location ${target} LOCATION)
get_filename_component(target_we ${target_location} NAME_WE)
get_target_property(target_deps ${target} LT_DEPENDENCY_LIBS)
# ...
# Get a bunch more properties...
# ...
set(la_target ${PROJECT_BINARY_DIR}/${target_we}.la)
# ...
# Do a bunch of file(WRITE...) file(APPEND...) etc
# ...
install(FILES ${la_target} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
You cannot get the LOCATION property from a target in modern cmake, and I can't figure out how to do get_filename_component() on a $ generator.
Using the generator in an add_custom_command() COMMAND statement only allows one line, so I can't set variables to do all the necessary get_target_property()/file(WRITE...) processing.
Alternatively I can add a COMMAND cmake -P script.cmake to run a script which can do all the string processing but can't define or reference targets, so I appear to be stuck.
EDIT: I'm using the Makefile generator, on macOS, the target in question is a shared library that's generated in the same project.
EDIT2: The error is:
The LOCATION property may not be read from target "mytarget".
Use the target name directly with add_custom_command, or use
the generator expression $<TARGET_FILE>, as appropriate.
You can to it like this:
first use file command to expand generator expressions and render a level-2 template
... which is going to be rendered at build time by configure_file
Here is a sample project:
cmake_minimum_required(VERSION 3.10)
project(location-test VERSION 0.0.1 LANGUAGES CXX)
add_executable(foo foo.cc)
file(GENERATE OUTPUT blah.la.in INPUT blah.la.in.in)
configure_file(render-variables.cmake.in render-variables.cmake #ONLY)
add_custom_command(
OUTPUT "${PROJECT_BINARY_DIR}/blah.la"
COMMAND "${CMAKE_COMMAND}"
-DPROJECT_BINARY_DIR="${PROJECT_BINARY_DIR}"
-DPROJECT_NAME="${PROJECT_NAME}"
-DPROJECT_VERSION="${PROJECT_VERSION}"
-P "${PROJECT_BINARY_DIR}/render-variables.cmake"
MAIN_DEPENDENCY "${PROJECT_BINARY_DIR}/blah.la.in"
DEPENDS "${PROJECT_BINARY_DIR}/render-variables.cmake"
)
add_custom_target(
make-la-la-la ALL
DEPENDS "${PROJECT_BINARY_DIR}/blah.la"
)
blah.la.in.in (2-levels of tempaltes %):
# This file going to be rendered by the following pipeline:
# - at CMake execution time it'll expand all generator expressions
# (e.g. $<TARGET_FILE:foo>)
# - at build time, the `render-variables.cmake` script will substitute
# CMake variables (like #PROJECT_NAME# or #PROJECT_VERSION#)
write the template for your real .la file... render-variables.cmake.in is trivial as :
configure_file("${PROJECT_BINARY_DIR}/blah.la.in" "${PROJECT_BINARY_DIR}/blah.la" #ONLY)
And finally a dummy C++ file foo.cc:
#include <iostream>
int main()
{
std::cout << "Hello Africa!\n";
}
Build it!
localtion-sample$ mkdir build/
localtion-sample$ cd build/
localtion-sample/build$ cmake ..
-- The CXX compiler identification is GNU 5.4.0
-- Check for working CXX compiler: /usr/x86_64-pc-linux-gnu/gcc-bin/5.4.0/c++ -- works
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/localtion-sample/build
localtion-sample/build$ make
Scanning dependencies of target foo
[ 33%] Building CXX object CMakeFiles/foo.dir/foo.cc.o
[ 66%] Linking CXX executable foo
[ 66%] Built target foo
Scanning dependencies of target make-la-la-la
[100%] Generating blah.la
[100%] Built target make-la-la-la
localtion-sample/build$ ll
total 52K
drwxr-xr-x 6 zaufi zaufi 320 Feb 9 22:35 CMakeFiles/
-rw-r--r-- 1 zaufi zaufi 287 Feb 9 22:35 blah.la
-rw-r--r-- 1 zaufi zaufi 300 Feb 9 22:35 blah.la.in
-rw-r--r-- 1 zaufi zaufi 11K Feb 9 22:35 CMakeCache.txt
-rw-r--r-- 1 zaufi zaufi 1.5K Feb 9 22:35 cmake_install.cmake
-rwxr-xr-x 1 zaufi zaufi 14K Feb 9 22:35 foo
-rw-r--r-- 1 zaufi zaufi 5.0K Feb 9 22:35 Makefile
-rw-r--r-- 1 zaufi zaufi 89 Feb 9 22:35 render-variables.cmake
localtion-sample/build$ cat blah.la
# This file going to be rendered by the following pipeline:
# - at CMake execution time it'll expand all generator expressions
# (e.g. /tmp/localtion-sample/build/foo)
# - at build time, the `render-variables.cmake` script will substitute
# CMake variables (like location-test or 0.0.1)

LLVm clang , Error: Invalid file format (bad magic) with -fprofile-instr-use

Flag "-fprofile-instr-use" generates error given below.
This issue occurs even if we build llvm,clang and compiler-rt using cmake or configure.
Please let me know your inputs to resolve this issue
error: Could not read profile: Invalid file format (bad magic)
Thanks,
Steps to reproduce this issue:
$ clang -O2 -fprofile-instr-generate hello.c -o c1.out
$ ls -rlt
-rw-r--r-- 1 root root 70 Jul 11 10:10 hello.c
-rwxr-xr-x 1 root root 15793 Jul 11 10:10 c1.out
-rw-r--r-- 1 root root 12203204 Jul 11 10:10 gmon.out
$ ./c1.out
Hello world
$ ls -rlt
-rw-r--r-- 1 root root 70 Jul 11 10:10 hello.c
-rwxr-xr-x 1 root root 15793 Jul 11 10:10 c1.out
-rw-r--r-- 1 root root 12203204 Jul 11 10:10 gmon.out
-rw-r--r-- 1 root root 104 Jul 11 10:10 default.profraw
$ clang -O2 -fprofile-instr-use=default.profraw hello.c -o c2.out
error: Could not read profile: Invalid file format (bad magic)
1 error generated.
Clang version (July 10th-2014 build from stage):
$ clang -v
clang version 3.5.0 (llvm.org/git/clang.git 5f9d646cba20f309bb69c6c358996d71912c54cd) (llvm.org/git/llvm.git dc90a3ab8ffc841a442888940635306de6131d2f)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Candidate multilib: .;#m64
Candidate multilib: 32;#m32
Selected multilib: .;#m64
OS: Ubuntu 14.04
LLVM configure: ../llvm/configure --enable-profiling --enable-optimized --enable-shared --disable-debug-runtime --enable-targets=x86
It turns out that step 3 outlined here: http://clang.llvm.org/docs/UsersManual.html#profiling-with-instrumentation
is required even if you only have 1 output file you are using. "Combine profiles from multiple runs and convert the “raw” profile format to the input expected by clang" makes it sound like you should only do this if you have multiple profiles, but you need to do it unconditionally.