Author Topic: custom makefile&compiler  (Read 3968 times)

Offline wiseguy

  • Single posting newcomer
  • *
  • Posts: 2
custom makefile&compiler
« on: April 06, 2011, 04:21:10 pm »
Hi,
Im having some problems using CodeBlocks to build a project usualy done with makefiles. The Makefile is using another version of gcc than the default one. Normaly I just do a export PATH=$PATH:~/somedir/compiler and then cd /home/me/mylib and then make. This works fine. I have also set up a project in CodeBlocks to build this lib and it works fine as long as I modify the makefile to use the default gcc. But when I try to use the other (some version of gcc) compiler it doesnt work. I do not want to do any changes in the Makefile to make it work for CodeBlocks because I still want to do the normal make build outside CodeBlocks. There are some rows in the Makefile that looks something like this:

GNU_TARGET_NAME=i586-unknown-linux-gnu
CROSS_COMPILE=$(GNU_TARGET_NAME)-
CC = $(CROSS_COMPILE)gcc
CXX = $(CROSS_COMPILE)g++
AR = $(CROSS_COMPILE)ar

ifeq ($(shell which $(CC)),)
$(error Compiler $(CC) not found) - please make sure that it's in the PATH
endif

And I get this buildlog message:

Using makefile: Makefile
../../common.mk:26: *** Compiler i586-unknown-linux-gnu-gcc not found.  Stop.
TOP is: /home/me/mytest
Process terminated with status 2 (0 minutes, 0 seconds)
1 errors, 0 warnings

Sorry but I'm new to Linux and I'm new to CodeBlocks..
 

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: custom makefile&compiler
« Reply #1 on: April 06, 2011, 05:36:51 pm »
../../common.mk:26: *** Compiler i586-unknown-linux-gnu-gcc not found.  Stop.
That's all you need to know.

The "make" application (not Code::Blocks) cannot find a compiler with the name "i586-unknown-linux-gnu-gcc". So either you forgot to install this compiler or its not in the PATH.

Consult the developer / install / make documentation of your application. I'm afraid there is no way we could help you here any further as this is out of the scope of Code::Blocks, we don't know your Linux setup, the library/application you want to build nor the environment/compiler needed. Sorry.
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 wiseguy

  • Single posting newcomer
  • *
  • Posts: 2
Re: custom makefile&compiler
« Reply #2 on: April 07, 2011, 11:28:21 am »
Solved by adding PATH environment var to CodeBlocks settings.

IWould say this definately is a CodeBlocks related problem because I thought that when CodeBlocks executed a custom Makefile it just uses the shell and my shell rc have a corect PATH set. But when I did put a "echo $PATH" as a pre-build step i saw that the PATH was not set correctly. And then I relized that CodeBlocks must be executed in some other environment (I have no idea how this works in Linux).

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: custom makefile&compiler
« Reply #3 on: April 07, 2011, 11:45:26 am »
Code::Blocks sets the same environment variables it can see itself.
Which variables it sees depends on your OS and the OS-settings.

If you start C::B from a console, you should get all your (login-)shell variables, but if you start it (e.g.) from menu, these settings are (in most cases) different.