[cmake-developers] nvidia nsight tegra set vcxproj properties (Ant Build) in cmake file

Mikhail Filimonov mfilimonov at nvidia.com
Mon Aug 31 11:16:53 EDT 2015


Hi, guys.
It looks that an error ‘ld.bfd.exe: cannot find -l-Wl,-Bdynamic’
was introduced by
commit 675ef165f213a6db1f9d0dfbebf6a0afc5469494
Author: Chuck Atkins <chuck.atkins at kitware.com>
Date:   Fri Aug 7 15:11:57 2015 -0400
    Allow LINK_SEARCH_{START,END}_STATIC props to have default values.
    Use the CMAKE_LINK_SEARCH_START_STATIC and CMAKE_LINK_SEARCH_END_STATIC
    variables to initialize the LINK_SEARCH_START_STATIC and
    LINK_SEARCH_END_STATIC target properties respectively.
it seems that it uncovered the hidden error in linker flags command line generation.
I’ve attached a simple fix that mitigates the issue, though maybe Chuck could devise a better way to handle it.

Peter, you could apply the attached patch locally to the latest CMake source to verify if it helps.

Regards,
-Mikhail

From: cmake-developers [mailto:cmake-developers-bounces at cmake.org] On Behalf Of Dmitry Polyanitsa
Sent: Friday, August 28, 2015 7:32 PM
To: Peter List <pem.list at gmail.com>
Cc: cmake-developers at cmake.org
Subject: Re: [cmake-developers] nvidia nsight tegra set vcxproj properties (Ant Build) in cmake file

Hi Peter,

We’ll look into that and get back to you!

-Dmitry

From: Peter List [mailto:pem.list at gmail.com]
Sent: Friday, August 28, 2015 8:45 AM
To: Dmitry Polyanitsa <dpolyanitsa at nvidia.com<mailto:dpolyanitsa at nvidia.com>>
Cc: cmake-developers at cmake.org<mailto:cmake-developers at cmake.org>
Subject: Re: [cmake-developers] nvidia nsight tegra set vcxproj properties (Ant Build) in cmake file

A related but different issue...  I tried adding this to my CMakeLists.txt:

set(CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES zzz)
set(CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES yyy)

But cmake 3.1.1 release does not add the expected properties to my vcxproj.  In fact, the strings "zzz" and "yyy" are not found in my vcxproj file.

So I tried a nightly build, but I got a different error - full text pasted below

Looks like cmake is doing some sanity check by building a simple test program, but link fails with cannot find -l-Wl,-Bdynamic.

Maybe "cmake-3.3.20150826-g566f1-win32-x86" isn't ready yet?

Btw I'm using AndroidWorks-1R2-win.exe + NVIDIA_Nsight_Tegra_Release_3.1.15202.6244.exe, so another guess is that maybe it's a compatibility issue...  Like I have to use a particular version of nsight with a particular version of cmake

thank you for any leads,
Peter

...
...
...

> "C:\Program Files (x86)\cmake-3.3.20150826-g566f1-win32-x86\bin\cmake" -G"Visual Studio 10 2010" -DCMAKE_SYSTEM_NAME="Android"  ..\pemDemos

-- The C compiler identification is GNU 4.9.0
-- The CXX compiler identification is GNU 4.9.0
-- Check for working C compiler using: Visual Studio 10 2010
-- Check for working C compiler using: Visual Studio 10 2010 -- broken
CMake Error at C:/Program Files (x86)/cmake-3.3.20150826-g566f1-win32-x86/share/cmake-3.3/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler
  "C:/Programs/NVPACK/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-gcc.exe"
  is not able to compile a simple test program.
  It fails with the following output:
   Change Dir: H:/Pem_Code/grfxdemossdl2015/pemDemos/build-android-vs2010/CMakeFiles/CMakeTmp
  Run Build
  Command:"C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe"
  "cmTC_84fb1.vcxproj" "/p:Configuration=Debug" "/p:VisualStudioVersion=10.0"
  Microsoft (R) Build Engine version 4.6.79.0
  [Microsoft .NET Framework, version 4.0.30319.42000]
  Copyright (C) Microsoft Corporation.  All rights reserved.
  Build started 8/28/2015 12:35:31 AM.

  Project
  "H:\Pem_Code\grfxdemossdl2015\pemDemos\build-android-vs2010\CMakeFiles\CMakeTmp\cmTC_84fb1.vcxproj"
  on node 1 (default targets).

  PrepareForBuild:

    Creating directory "cmTC_84fb1.dir\Debug\".
    Creating directory "H:\Pem_Code\grfxdemossdl2015\pemDemos\build-android-vs2010\CMakeFiles\CMakeTmp\Debug\".

  InitializeBuildStatus:

    Creating "cmTC_84fb1.dir\Debug\cmTC_84fb1.unsuccessfulbuild" because "AlwaysCreate" was specified.

  ClCompile:

    C:\Programs\NVPACK\android-ndk-r10e\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\bin\arm-linux-androideabi-g++.exe
    testCCompiler.c

  C:\Program Files
  (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(991,5): warning
  MSB8012: TargetExt(.) does not match the Linker's OutputFile property value
  ().  This may cause your project to build incorrectly.  To correct this,
  please make sure that $(OutDir), $(TargetName) and $(TargetExt) property
  values match the value specified in %(Link.OutputFile).
  [H:\Pem_Code\grfxdemossdl2015\pemDemos\build-android-vs2010\CMakeFiles\CMakeTmp\cmTC_84fb1.vcxproj]


  Link:

    C:\Programs\NVPACK\android-ndk-r10e\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\bin\arm-linux-androideabi-g++.exe cmTC_84fb1.dir
Debug/testCCompiler.o  -Wl,-soname,cmTC_84fb1. -shared --sysroot=C:/Programs/NVPACK/android-ndk-r10e/platforms/android-9/arch-arm -Wl,-rpath-link=C:/
rograms/NVPACK/android-ndk-r10e/platforms/android-9/arch-arm/usr/lib "-l-Wl,-Bdynamic" -fuse-ld=bfd -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relr
 -Wl,-z,now -L"C:/Programs/NVPACK/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9/arm
7-a" -L"C:/Programs/NVPACK/android-ndk-r10e/platforms/android-9/arch-arm/usr/lib" -L"C:/Programs/NVPACK/android-ndk-r10e/sources/cxx-stl/gnu-libstdc+
/4.9/libs/armeabi-v7a" -L"C:/Programs/NVPACK/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/lib/gcc/arm-linux-androide
bi/4.9/armv7-a" "C:/Programs/NVPACK/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/libgnustl_static.a" -lc -lm -llog -lgcc -oH:/
em_Code/grfxdemossdl2015/pemDemos/build-android-vs2010/CMakeFiles/CMakeTmp/Debug/cmTC_84fb1.
    c:/programs/nvpack/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../.
/../arm-linux-androideabi/bin/ld.bfd.exe: cannot find -l-Wl,-Bdynamic

  collect2.exe : error : ld returned 1 exit status
  [H:\Pem_Code\grfxdemossdl2015\pemDemos\build-android-vs2010\CMakeFiles\CMakeTmp\cmTC_84fb1.vcxproj]


  Done Building Project
  "H:\Pem_Code\grfxdemossdl2015\pemDemos\build-android-vs2010\CMakeFiles\CMakeTmp\cmTC_84fb1.vcxproj"
  (default targets) -- FAILED.



  Build FAILED.




  "H:\Pem_Code\grfxdemossdl2015\pemDemos\build-android-vs2010\CMakeFiles\CMakeTmp\cmTC_84fb1.vcxproj"
  (default target) (1) ->

  (DoLinkOutputFilesMatch target) ->

    C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(991,5): warning MSB8012: TargetExt(.) does not match the Linker's Ou
putFile property value (). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(Ta
getExt) property values match the value specified in %(Link.OutputFile). [H:\Pem_Code\grfxdemossdl2015\pemDemos\build-android-vs2010\CMakeFiles
CMakeTmp\cmTC_84fb1.vcxproj]






  "H:\Pem_Code\grfxdemossdl2015\pemDemos\build-android-vs2010\CMakeFiles\CMakeTmp\cmTC_84fb1.vcxproj"
  (default target) (1) ->

  (Link target) ->

    collect2.exe : error : ld returned 1 exit status [H:\Pem_Code\grfxdemossdl2015\pemDemos\build-android-vs2010\CMakeFiles\CMakeTmp\cmTC_84fb1
vcxproj]



      1 Warning(s)
      1 Error(s)



  Time Elapsed 00:00:00.91





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)


-- Configuring incomplete, errors occurred!
See also "H:/Pem_Code/grfxdemossdl2015/pemDemos/build-android-vs2010/CMakeFiles/CMakeOutput.log".
See also "H:/Pem_Code/grfxdemossdl2015/pemDemos/build-android-vs2010/CMakeFiles/CMakeError.log".

H:\Pem_Code\grfxdemossdl2015\pemDemos\build-android-vs2010>





On Thu, Aug 27, 2015 at 11:50 PM, Peter List <pem.list at gmail.com<mailto:pem.list at gmail.com>> wrote:
vs2010 works for my CMakeLists.txt:

> cmake -G"Visual Studio 10 2010" -DCMAKE_SYSTEM_NAME="Android"  ..\pemDemos
-- The C compiler identification is GNU 4.9.0
-- The CXX compiler identification is GNU 4.9.0
-- Check for working C compiler using: Visual Studio 10 2010
-- Check for working C compiler using: Visual Studio 10 2010 -- 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 using: Visual Studio 10 2010
-- Check for working CXX compiler using: Visual Studio 10 2010 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMAKE_SYSTEM_NAMEAndroid
-- Configuring done
-- Generating done
-- Build files have been written to: H:/Pem_Code/hobby/grfxdemossdl2015/pemDemos/build-android-vs2010

However, vs2013 does not:

> cmake -G"Visual Studio 12 2013" -DCMAKE_SYSTEM_NAME="Android"  ..\pemDemos
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:1 (project):
  No CMAKE_C_COMPILER could be found.
CMake Error at CMakeLists.txt:1 (project):
  No CMAKE_CXX_COMPILER could be found.

This is with the stable release of cmake 3.1.1

I also tried a nightly build ( http://www.cmake.org/files/dev/?C=M;O=D ) -> cmake-3.3.20150826-g566f1-win32-x86, and it gives the same error.

best regards,
Peter




On Thu, Aug 27, 2015 at 12:52 PM, Dmitry Polyanitsa <dpolyanitsa at nvidia.com<mailto:dpolyanitsa at nvidia.com>> wrote:
I’m glad you like it ☺ BTW generating for VS2013 + Nsight Tegra should already be supported in CMake. Support for VS2015 will be added to Nsight Tegra in the next release.

-Dmitry

From: Peter List [mailto:pem.list at gmail.com<mailto:pem.list at gmail.com>]
Sent: Thursday, August 27, 2015 1:36 AM
To: Dmitry Polyanitsa <dpolyanitsa at nvidia.com<mailto:dpolyanitsa at nvidia.com>>
Cc: cmake-developers at cmake.org<mailto:cmake-developers at cmake.org>
Subject: Re: [cmake-developers] nvidia nsight tegra set vcxproj properties (Ant Build) in cmake file

Awesome - in that case I'll use this built-in support instead of spending time on writing a python script to call from add_custom_command().

It's not officially documented yet ( http://bit.ly/1MOzB0S ), but I can use the link you sent ( http://bit.ly/1UdL3nc ) for documentation.

I'm not sure whether this is in the CMake 3.3.1 release, but if not then I can try a nightly build:

http://www.cmake.org/download/ -> http://www.cmake.org/files/dev/?C=M;O=D -> cmake-3.3.20150824-ga3d05-win32-x86.exe

Or if that doesn't work, then maybe I'll wait a few days and try a newer nightly build :-)

thank you,
Peter

PS: I love this built-in (nvidia tegra nsight + visual studio 2010) support...  Some similar things that would also be awesome as built-in support are...  nvidia tegra nsight + visual studio 2013, 2015.  nmake + Android Studio (Windows, Mac, Linux).  iOS + XCode.




On Wed, Aug 26, 2015 at 7:15 AM, Dmitry Polyanitsa <dpolyanitsa at nvidia.com<mailto:dpolyanitsa at nvidia.com>> wrote:
Hi Peter,

Note the commit Brad mentioned in another thread:

> VS: Add more Nsight Tegra generator Android property settings

> http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8c0afaf4

It adds the ability to set both Native Library Directories and Native Library Dependencies, among other things. Thanks for the link to the forum post, by the way – we forgot to update it and will do that now.

-Dmitry

From: cmake-developers [mailto:cmake-developers-bounces at cmake.org<mailto:cmake-developers-bounces at cmake.org>] On Behalf Of Peter List
Sent: Wednesday, August 26, 2015 5:06 AM
To: cmake-developers at cmake.org<mailto:cmake-developers at cmake.org>
Subject: [cmake-developers] nvidia nsight tegra set vcxproj properties (Ant Build) in cmake file

I have a working hello world cmake + built-in Android using nvidia nsight tegra.  It uses SDL2.

Unfortunately, after I run cmake I have to manually edit the following in my vcxproj to add SDL2:

Configuration Properties > Ant Build > Native Library Directories, Native Library Dependencies

I found this post ( http://bit.ly/1NTgTE3 ) from May 5th (3 months 20 days ago) describing the same issue.  Is there an ETA on this?

Since this isn't out yet, is there a work-around I can do instead?  So far my best idea is to have cmake use add_custom_command() as a post-build step to call a python script that edits the vcxproj file XML.

    <AntBuild>
      <AntBuildPath>[path]\build-android\android-project</AntBuildPath>
      <AndroidManifestLocation>[path]\build-android\android-project\AndroidManifest.xml</AndroidManifestLocation>
      <NativeLibDirectories>../../../SDL2-2.0.3/libs/armeabi-v7a</NativeLibDirectories>
      <NativeLibDependencies>SDL2</NativeLibDependencies>
    </AntBuild>

thank you

________________________________
This email message is for the sole use of the intended recipient(s) and may contain confidential information.  Any unauthorized review, use, disclosure or distribution is prohibited.  If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
________________________________



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150831/0a0c17ee/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-for-the-link-error-cannot-find-l-Wl-Bdynamic.patch
Type: application/octet-stream
Size: 1001 bytes
Desc: 0001-Fix-for-the-link-error-cannot-find-l-Wl-Bdynamic.patch
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150831/0a0c17ee/attachment-0001.obj>


More information about the cmake-developers mailing list