Author Topic: How to set up C::B for Android NDK compiler?  (Read 56213 times)

Offline amarty

  • Multiple posting newcomer
  • *
  • Posts: 41
How to set up C::B for Android NDK compiler?
« on: November 15, 2012, 02:20:07 am »
I try to set up Code::Blocks with Mentor Graphics CodeSourcery ARM GCC - this works fine.
In the same manner I try to set up Code::Blocks for Android NDK ARM GCC and got an error:

"Project - debug" uses an invalid compiler [YOUR ANSWER IS ALREADY THERE. SEARCH THE FORUMS!].
Probably the toolchain path within the compiler options is not setup correctly?! Skipping...

Summary information about my NDK installation:

NDK root        : D:\android-ndk-r8b
arm-linux-androideabi-g++.exe and others are in
                   : D:\android-ndk-r8b\toolchains\arm-linux-androideabi-4.4.3\prebuilt\windows\bin
make.exe is in: D:\android-ndk-r8b\prebuilt\windows\bin\

My Code::Blocks setting is:

1) Compiler's installation directory (the 'bin' removed fom path)
     - D:\android-ndk-r8b\toolchains\arm-linux-androideabi-4.4.3\prebuilt\windows
2) Additional paths
     - D:\android-ndk-r8b\prebuilt\windows\bin
     - D:\android-ndk-r8b\toolchains\arm-linux-androideabi-4.4.3\prebuilt\windows\bin

I try to set 1 and 2 in varios ways, but result is the same - error. I can't understand, is it my fail, or it is some bug or misconfiguration in C::B or NDK?

Can anybody help me?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: How to set up C::B for Android NDK compiler?
« Reply #1 on: November 15, 2012, 09:29:23 am »
arm-linux-androideabi-g++.exe and others are in
Did you name the compiler's executables names like that?

The algorithm is very simple:
C::B searches for all given tools (i.e. "g++.exe") in either the main or "bin" sub-folder and any additional provided folders.

So either the names of your tools are wrong, or the path's.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline amarty

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: How to set up C::B for Android NDK compiler?
« Reply #2 on: November 15, 2012, 09:43:20 am »
arm-linux-androideabi-g++.exe and others are in
Did you name the compiler's executables names like that?
Yes, compiler executables have such names. CodeSourcery Tollset compiler has name "arm-none-linux-gnueabi-g++.exe", but it works fine.

So either the names of your tools are wrong, or the path's.

I checked all names and paths more than ten times

Offline amarty

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: How to set up C::B for Android NDK compiler?
« Reply #3 on: November 15, 2012, 10:07:30 am »
 May be, the problem is that the NDK under Windows requires Cygwin or MSYS, and, when I compiling code in Eclipse, all paths seems like unix style path: windos path "D:\android-ndk-r8b\toolchains" looks like /d/android-ndk-r8b/toolchains. If it is true, my problem has no solution ;(

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: How to set up C::B for Android NDK compiler?
« Reply #4 on: November 15, 2012, 10:16:20 am »
Do you have a valid executable in the C-compiler field ?
If not you get this error, if I remember correctly.

If no C-compiler is available, you should additionally put the C++-compiler in the C-compiler field.

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: How to set up C::B for Android NDK compiler?
« Reply #5 on: November 15, 2012, 04:14:28 pm »
We need to do something about that error message. Can't we do something like:

Code
Error: the tool chain [compiler|linker|other] command [was not set|'[command name or command line]' was not found], please check your tool chain settings in Settings -> Compiler

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: How to set up C::B for Android NDK compiler?
« Reply #6 on: November 15, 2012, 04:48:17 pm »
We need to do something about that error message.
Although we did quite some time in the past already, but: Yes (even before he release). Will you take the action?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: How to set up C::B for Android NDK compiler?
« Reply #7 on: November 15, 2012, 05:00:14 pm »
We need to do something about that error message.
Although we did quite some time in the past already, but: Yes (even before he release). Will you take the action?

I will take a look, but unless it is really simple it may take a bit of time for me to get a patch for. (The simplest thing would be to just sharpen the wording without trying to add the context)

Offline amarty

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: How to set up C::B for Android NDK compiler?
« Reply #8 on: November 15, 2012, 08:53:07 pm »
Do you have a valid executable in the C-compiler field ?
Yes, all fields are properly filled

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: How to set up C::B for Android NDK compiler?
« Reply #9 on: November 15, 2012, 09:01:25 pm »
Yes, all fields are properly filled
You can use the cb_share_config tool, export the compiler settings in question and attach it to a post here, besides you PATH environment variable, and again the exact path where you installed your compiler into.

BTW:  I didn't even know there is a GCC for android... interesting... :-)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline amarty

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: How to set up C::B for Android NDK compiler?
« Reply #10 on: November 15, 2012, 09:04:18 pm »
We need to do something about that error message.
It's a good idea.
First, it is not quite how works the "Autodetect" button - it simply reports that nothing is found and fills "Compiler install dir" with "C:\Program Files (x86)\GNUARM" value.
Next, The executable are under bin subdirectory of taken directory, but I can't understand, is path incorrect or something wrong then compiler tryed to run.
Third, what is strange restriction when binaries must be placed under "bin" subdirectory? I think, much better to point exact to directory which contains compiler executables.
Fourth, near all fields, near [...] button will be cool if one more button be placed, [AutoLocate] - pressing on it C::B looks for files in "compiler/install/dir/bin" with mack "*gcc", "*g++", "*ar", "*gdb" etc.

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: How to set up C::B for Android NDK compiler?
« Reply #11 on: November 15, 2012, 09:19:27 pm »
Next, The executable are under bin subdirectory of taken directory, but I can't understand, is path incorrect or something wrong then compiler tryed to run.

Related: because the IsValid() check returns false, we get this "invalid" compiler message instead of attempting to run the toolchain command. It's bizarre that the check is only based on the C toolchain command and apparently not anything else.

@op: did you install the NDK while C::B is open? Sometimes I have found you need to close and reopen C::B for the environment to pick things up correctly. (This one is probably a stretch)

Offline amarty

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: How to set up C::B for Android NDK compiler?
« Reply #12 on: November 15, 2012, 09:39:21 pm »
You can use the cb_share_config tool, export the compiler settings in question and attach it to a post here, besides you PATH environment variable, and again the exact path where you installed your compiler into.
NDK root: D:\android-ndk-r8b
Binaries are in: D:\android-ndk-r8b\toolchains\arm-linux-androideabi-4.4.3\prebuilt\windows\bin
Path : c:\arc;C:\Program Files\ImageMagick-6.7.8-Q16;C:\Program Files (x86)PHP;C:Program Files (x86)IntelComposer XE 2011 SP1\redist\ia32\tbb\vc10;C:\Program Files (x86)IntelComposer XE 2011 SP1\redist\intel64\tbb\vc10;C:\Program Files (x86)IntelComposer XE 2011 SP1\redist\intel64\ipp;C:\Program Files (x86)IntelComposer XE 2011 SP1\redist\ia32\ipp;C:\Program Files (x86)IntelComposer XE 2011 SP1\redist\intel64\mkl;C:\Program Files (x86)IntelComposer XE 2011 SP1\redist\ia32\mkl;C:\Program Files (x86)Common Files\Microsoft Shared\VSA\10.0\VsaEnv;C:\Program Files (x86)Common Files\Intel\Shared Libraries\redist\intel64\mpirt;C:\Program Files (x86)Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Program Files (x86)Common Files\Intel\Shared Libraries\redist\ia32\mpirt;C:\Program Files (x86)Common Files\Intel\Shared Libraries\redist\ia32\compiler;C:\Program Files (x86)Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Program Files (x86)Common Files\Intel\Shared Libraries\redist\ia32\compiler;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;f:\usr\bin;c:\Program Files (x86)Microsoft SQL Server\90\Tools\binn\;C:\Program Files\7-Zip;C:\Program Files (x86)Microsoft Visual Studio 8\Team Tools\Performance Tools;C:\Program Files\Microsoft Windows Performance Toolkit\;C:\Program Files (x86)Graphviz 2.28\bin;C:\Program Files (x86)Javajre7bin;C:Program Files (x86)Javajre7binclient;D:apache-antbin;D:android-sdkstools;D:MinGWbin;D:MinGWmsys1.0bin;D:necessitasAndroidQt482armeabibin;D:necessitasapache-ant-1.8.4bin;D:CMakebin;C:Program Files (x86)Subversionbin;C:Program Files\TortoiseSVN\bin



BTW:  I didn't even know there is a GCC for android... interesting... :-)
Android Native Development Kit - NDK

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: How to set up C::B for Android NDK compiler?
« Reply #13 on: November 15, 2012, 09:43:11 pm »
First, it is not quite how works the "Autodetect" button - it simply reports that nothing is found and fills "Compiler install dir" with "C:\Program Files (x86)\GNUARM" value.
This is by design. The folder is the default folder, where the compiler usually is installed, if you run its installer.

Next, The executable are under bin subdirectory of taken directory, but I can't understand, is path incorrect or something wrong then compiler tryed to run.
Well you can - what I told you is true: If you see this message, CodeBlocks cannot find the compiler computed by [list of path's] + compiler executable.

Third, what is strange restriction when binaries must be placed under "bin" subdirectory? I think, much better to point exact to directory which contains compiler executables.
Again, this is by design. Most compilers are setup in a way that they have a root folder, which has at least the sub-folders "bin" for the tool chain executables, an"include" folder for its includes and a "lib" folder for libraries. So having to setup the root path is just convenient to find all the rest. Otherwise it will become so complicated that out forum will be flooded with messages "I don't get the compiler to run" - trust me.

Fourth, near all fields, near [...] button will be cool if one more button be placed, [AutoLocate] - pressing on it C::B looks for files in "compiler/install/dir/bin" with mack "*gcc", "*g++", "*ar", "*gdb" etc.
Nope. We also support compilers like MSVC where you don't have such executables and even non c/c++ compiler (take Fortran, for example). Also, we support compilers that do not have such a standard folder structure. So your suggestion will break all these cases. the way it is now works for all of them and more.[/list]
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline amarty

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: How to set up C::B for Android NDK compiler?
« Reply #14 on: November 15, 2012, 09:44:51 pm »
@op: did you install the NDK while C::B is open? Sometimes I have found you need to close and reopen C::B for the environment to pick things up correctly. (This one is probably a stretch)

No, NDK installed some time ago, and some time I use Eclipse for development, but C::B is more nice IDE (I had the experience of using it before), and now I try to configure C::B for NDK.