Forums - Compiler v3.3.1 with NDK r9

15 posts / 0 new
Last post
Compiler v3.3.1 with NDK r9
pvrtisrp
Join Date: 28 Sep 13
Posts: 47
Posted: Thu, 2013-10-03 23:29

Dear all,

I see the compiler has been updated so I try again. However, I still cannot use it in NDK r9.

OS: Windows 8 64 bit,  Android NDK r9 for 64 bits

C:\android-ndk\toolchains\arm-linux-androideabi-snapdragonclang3.3.1

My Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := MyApp
LOCAL_SRC_FILES := test.cpp
include $(BUILD_SHARED_LIBRARY)
 
My Application.mk
NDK_TOOLCHAIN_VERSION := snapdragonclang3.3.1
APP_ABI := armeabi-v7a
APP_PLATFORM := android-10
 

test.cpp:  bool test() { return true; }

Input:

call C:\android-ndk\ndk-build NDK_DEBUG=0
 
Output:
 
"Compile++ thumb : MyApp <= test.cpp
process_begin: CreateProcess(NULL, bash 
C:\android-ndk\toolchains\arm-linux-androideabi-snapdragonclang3.3.1\snapdragon-clang++ 
-MMD 
-MP 
-MF .
/obj/local/armeabi-v7a/objs/MyApp/test.o.d 
-gcc-toolchain 
C:/android-ndk/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64 
-fpic 
-ffunction-sections 
-funwind-tables 
-fstack-protector 
-no-canonical-prefixes 
-target 
armv7-none-linux-androideabi 
-march=armv7-a 
-mfloat-abi=softfp 
-fno-exceptions
-fno-rtti 
-mthumb 
-DNDEBUG 
-fomit-frame-pointer 
-fno-strict-aliasing 
-IC:/android-ndk/sources/cxx-stl/system/include 
-Ijni 
-DANDROID 
-Wa,
--noexecstack 
-Wformat 
-Werror=format-security 
-IC:/android-ndk/platforms/android-9/arch-arm/usr/include 
-c jni/test.cpp 
-o ./obj/local/armeabi-v7a/objs/MyApp/test.o, ...) failed.
 
make (e=2): The system cannot find the file specified.
make: *** [obj/local/armeabi-v7a/objs/MyApp/test.o] Error 2
 

I really want to have some advices...Could anyone help me?

Thank you very much!!!

Cathy

  • Up0
  • Down0
Mandeep
Join Date: 19 Jun 13
Posts: 6
Posted: Fri, 2013-10-04 11:35

Cathy,

Please set the variable PLATFORM=windows-x86_64 on the command line invocation.

This enables the Snapdragon wrapper scripts to use the correct GCC 4.7 toolchain for the platform.

I was able to build your test case by setting this variable:

  $ PLATFORM=windows-x86_64 /cygdrive/c/android-ndk-r9/ndk-build NDK_DEBUG=0

  Cygwin         : Generating dependency file converter script

  Compile++ thumb  : MyApp <= test.cpp

  clang++.exe: warning: argument unused during compilation: '-march=armv7-a'

  StaticLibrary  : libstdc++.a

  SharedLibrary  : libMyApp.so

  Install        : libMyApp.so => libs/armeabi-v7a/libMyApp.so

Note: The Android.mk, Application.mk and test.cpp files are under jni directory.

Thanks,

Mandeep

  • Up0
  • Down0
pvrtisrp
Join Date: 28 Sep 13
Posts: 47
Posted: Sat, 2013-10-05 08:17

Thanks for your reply, 

I add it but I still get the same error messges....

How to make messages more clear?... I try it again and again...

How to use LLVM...Should I need Cygwin?

  • Up0
  • Down0
pvrtisrp
Join Date: 28 Sep 13
Posts: 47
Posted: Sat, 2013-10-05 08:43

BTW, I directly try to compile sample code "hello-jni" under the NDK r9 folder, but it still cannot work.

P.S. I add Application.mk only.

NDK_TOOLCHAIN_VERSION := snapdragonclang3.3.1
PLATFORM := windows-x86_64
APP_ABI := armeabi-v7a
APP_PLATFORM := android-10
 
Do I need to modify "setup.mk", "config.mk", "snapdragon-clang", or "snapdragon-clang++"?
 
I think they are just default setting so that I can change the setting in my Application.mk and Android.mk, am I right?
 
Also, I read those files but I still do not know what cause the tragedy...
  • Up0
  • Down0
pvrtisrp
Join Date: 28 Sep 13
Posts: 47
Posted: Sun, 2013-10-06 01:37

BTW, if I set NDK_TOOLCHAIN_VERSION := clang3.3

every things work very well....

  • Up0
  • Down0
pvrtisrp
Join Date: 28 Sep 13
Posts: 47
Posted: Sun, 2013-10-06 20:36

I use another computer (Windows XP 32 bits) to try again,

and download 32 bits SDK and NDK r9, try to compile the sample code, it shows the same error message...

 

 

  • Up0
  • Down0
Raja Moderator
Join Date: 17 Apr 13
Posts: 42
Posted: Mon, 2013-10-07 10:39

Sorry to hear that you are having trouble using Snapdragon LLVM.

Can you kindly check if the "Microsoft Visual C++ 2010 Redistributable package for x86" is installed on your windows system. This package installs msvcp100.dll which is required for Snapdragon LLVM on Windows to work correctly. The redistributable package can be found at

http://www.microsoft.com/enus/ download/details.aspx?displaylang=en&id=5555

The above URL is also listed in the README.install PDF file available in Qdevnet. Kindly let us know if installing the above package fixes the issue.

Thank you for your patience

--Raja

  • Up0
  • Down0
pvrtisrp
Join Date: 28 Sep 13
Posts: 47
Posted: Mon, 2013-10-07 17:21

Yes, I try again, I also download .Net Framework.

However, as I mentioned before, because I have installed VC2010 Express & VC2012 Express, they just show "A newer version of Microsoft Visual C++ 2010 Redistributable has been detected on the machine."

P.S. I have Visual C++ 2010 Redistributable x86 & x64

They aren't helpful........

Do I need to use Cygwin or Apache Ant?

Could you try it on your computer for NDK r9 (64bits) and this compiler (3.3.1) again? And teach me your steps? Please...Thank you...

  • Up0
  • Down0
pvrtisrp
Join Date: 28 Sep 13
Posts: 47
Posted: Mon, 2013-10-07 17:25

What's your PATH environment variable?

  • Up0
  • Down0
Mandeep
Join Date: 19 Jun 13
Posts: 6
Posted: Mon, 2013-10-07 18:21

Cathy,

Please use Cygwin (and not Apache Ant). This requirement is enforced by the Android NDK (and not by LLVM itself).

Here are the steps I follow:

1. Download android-ndk-r9-windows-x86_64 (from http://dl.google.com/android/ndk/android-ndk-r9-windows-x86_64.zip) under C:\

2. Extract Snapdragon LLVM 3.3.1 under C:\android-ndk-r9-windows-x86_64\toolchains

3. I have installed CYGWIN_NT-6.1-WOW64

4. I then placed your test.cpp, Android.mk and Application.mk under C:\android-ndk-r9-windows-x86_64\samples\test\jni

5. Under Cygwin, cd /cygdrive/c/android-ndk-r9-windows-x86_64\samples\test

6. Invoke compilation as:
PLATFORM=windows-x86_64 NDK_TOOLCHAIN_VERSION=snapdragonclang3.3.1 /cygdrive/c/android-ndk-r9-windows-x86_64/ndk-build NDK_DEBUG=1

Output:

Compile++ thumb  : MyApp <= test.cpp

clang++.exe: warning: argument unused during compilation: '-march=armv7-a'
StaticLibrary  : libstdc++.a
SharedLibrary  : libMyApp.so
Install        : libMyApp.so => libs/armeabi-v7a/libMyApp.so

 

7. There is nothing special in my PATH variable.

 

Hope this helps.

  • Up0
  • Down0
pvrtisrp
Join Date: 28 Sep 13
Posts: 47
Posted: Mon, 2013-10-07 19:28

To use this compiler, do I need to copy any file to my following folders?

C:\android-ndk\platforms\android-14\arch-arm\usr\include

C:\android-ndk\platforms\android-14\arch-arm\usr\lib

android-14 is the version I use, it can be android-18 or others.

  • Up0
  • Down0
Raja Moderator
Join Date: 17 Apr 13
Posts: 42
Posted: Mon, 2013-10-07 20:46

No, you do not need to copy any file to those folders

  • Up0
  • Down0
pvrtisrp
Join Date: 28 Sep 13
Posts: 47
Posted: Mon, 2013-10-07 20:57

Thank you so much!!! Now it can compile my app.

But I do not know the reason. I just use Cygwin Terminal replace Windows Command Processor (%windir%\system32\cmd.exe).

Anyway, I will use Cygwin.

P.S. Can I directly ignore the warning "warning: argument unused during compilation: '-march=armv7-a'"?

Because I build my classmate's code and get different result. I think she may use undefined behaviors in C/C++ code. I am checking now..

 

Thanks a lot!!!

Cathy

 

 

  • Up0
  • Down0
pvrtisrp
Join Date: 28 Sep 13
Posts: 47
Posted: Mon, 2013-10-07 21:05

Oh, so sad....

If I use Clang3.3, it can get the same result with GCC.

But Snapdragon LLVM Compiler get the different result...

Is there any possible reason?

  • Up0
  • Down0
pvrtisrp
Join Date: 28 Sep 13
Posts: 47
Posted: Mon, 2013-10-07 22:54

If I use this compiler, -O3 -Ofast will cause wrong result, lower level: -O1, -O2 seem to be OK.

I enable the following warning and solve all:

-Wcast-align \
-Wreturn-type \
-Wimplicit-function-declaration \
-Wcast-align
 
Is there any suggestion?
Why Clang 3.3 with -Ofast can get the crrect result?
  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.