Author Topic: Avr-gcc project on x86_64 and gnu/stubs-32.h file  (Read 18708 times)

Offline Difool

  • Multiple posting newcomer
  • *
  • Posts: 11
Avr-gcc project on x86_64 and gnu/stubs-32.h file
« on: August 09, 2011, 11:32:59 pm »
Hi !

I'm new user of Code::Blocks and i started with avr-gcc project.
My project compile fine in command line (not with Code::Blocks) with my custom Makefile.

I've trying to copy out this Makefile in Code::Blocks but when i compile, i've this error :
Code
/usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory
I've trying with my custom Makefile (By checking « This is a custom Makefile » in Project properties) but i've the same error.

I think that installing the package "glibc-devel.i686" can solve the problem but why Code: Blocks would need this package which compile fine in command line ?

Thanks

Offline Freem

  • Almost regular
  • **
  • Posts: 219
Re: Avr-gcc project on x86_64 and gnu/stubs-32.h file
« Reply #1 on: August 10, 2011, 02:46:23 pm »
Should your project normally need it?
If yes, check directories.

Else, if you check "use a custom makefile" in C::B's project, do it work?

If yes, there is a problem with the configuration of your project.
I think you can look near included libs, maybe the assistant insert "gnu/stubs-32.h" ?

Offline Difool

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Avr-gcc project on x86_64 and gnu/stubs-32.h file
« Reply #2 on: August 10, 2011, 02:57:45 pm »
Should your project normally need it?
If yes, check directories.
No, because it works outside Code::Blocks

With my custom Makefile, it don't need stubs-64.h either (So my project don't need stubs.h ...)
(I've tried to rename stubs-64.h to stubs-64.h.old and to compile with custom Makefile and it works)

Else, if you check "use a custom makefile" in C::B's project, do it work?
Yes

If yes, there is a problem with the configuration of your project.
I think you can look near included libs, maybe the assistant insert "gnu/stubs-32.h" ?

Here is the cbp file of my project, you can see it have no mention of any stubs header
« Last Edit: August 10, 2011, 03:07:24 pm by Difool »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Avr-gcc project on x86_64 and gnu/stubs-32.h file
« Reply #3 on: August 10, 2011, 03:32:29 pm »
Read this: http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F and enable full logging.
Then inspect the commands and try them in a terminal to see, which flag or option causes this behaviour.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Difool

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Avr-gcc project on x86_64 and gnu/stubs-32.h file
« Reply #4 on: August 10, 2011, 03:49:36 pm »
Ok, it works when I remove the « /usr/include » path in Global Compiler Settings -> GNU AVR GCC Compiler -> Search Directories -> Compiler.

This path wasn't added by me, it's the default config.
Is this path useful for anything ?

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Avr-gcc project on x86_64 and gnu/stubs-32.h file
« Reply #5 on: August 10, 2011, 04:22:53 pm »
It's not in the default config of C::B !
I don't have it in my clean "GNU AVR GCC Compiler" settings.

So removing it should be save.

Offline Difool

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Avr-gcc project on x86_64 and gnu/stubs-32.h file
« Reply #6 on: August 10, 2011, 08:58:37 pm »
It's not in the default config of C::B !
I don't have it in my clean "GNU AVR GCC Compiler" settings.

So removing it should be save.

I confirm is it the default config of Code::Blocks. At least on Fedora 15 and x86_64.
I just to test on another machine with a fresh install of this distribution.
Maybe a « wrong » rpm package ...

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Avr-gcc project on x86_64 and gnu/stubs-32.h file
« Reply #7 on: August 10, 2011, 09:05:45 pm »
I don't have it in the defaults. (self compiled on centos)
Could you check if you avr-project-wizard is not doing it wrong?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Difool

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Avr-gcc project on x86_64 and gnu/stubs-32.h file
« Reply #8 on: August 10, 2011, 09:07:15 pm »
Could you check if you avr-project-wizard is not doing it wrong?

How ?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Avr-gcc project on x86_64 and gnu/stubs-32.h file
« Reply #9 on: August 10, 2011, 09:19:43 pm »
Choose the wizard -> right click -> edit script
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Difool

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Avr-gcc project on x86_64 and gnu/stubs-32.h file
« Reply #10 on: August 10, 2011, 09:32:55 pm »
Choose the wizard -> right click -> edit script
I've seen nothing strange here.

But, here, you can see my ~/.codeblocks/default.conf file.
See at lines 728-732.
« Last Edit: August 10, 2011, 09:39:48 pm by Difool »

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Avr-gcc project on x86_64 and gnu/stubs-32.h file
« Reply #11 on: August 10, 2011, 09:50:05 pm »
Choose the wizard -> right click -> edit script
I've seen nothing strange here.

But, here, you can see my ~/.codeblocks/default.conf file.
See at lines 728-732.
Please close C::B and rename the default.conf.
Than restart C::B, so the configuration is rebuild from scratch and check the "Search directories".

Offline Difool

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Avr-gcc project on x86_64 and gnu/stubs-32.h file
« Reply #12 on: August 10, 2011, 10:03:30 pm »
Please close C::B and rename the default.conf.
Than restart C::B, so the configuration is rebuild from scratch and check the "Search directories".

/usr/include always appear in the search directory

Offline Difool

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Avr-gcc project on x86_64 and gnu/stubs-32.h file
« Reply #13 on: August 11, 2011, 02:43:24 pm »
I've just to test on another linux distribution (Ubuntu 11.04 x86_64).
And it's have the same problem : the /usr/include path is, by default, in the « Search Directory » for the AVR GCC Compiler.

So the problem is not with Fedora package but with Code::Block default settings

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Avr-gcc project on x86_64 and gnu/stubs-32.h file
« Reply #14 on: August 11, 2011, 03:07:03 pm »
What happens, when you:
1. stop codeblocks
2. delete ~/.codeblocks/default.conf
3. start codeblocks

Do you see the same problem?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Avr-gcc project on x86_64 and gnu/stubs-32.h file
« Reply #15 on: August 11, 2011, 03:10:18 pm »
Seems the autodetection fails, see for the details: CompilerGNUAVR::AutoDetectInstallationDir()

http://svn.berlios.de/wsvn/codeblocks/trunk/src/plugins/compilergcc/compilerGNUAVR.cpp?peg=7359

Seems like the m_MasterPath is not set correctly.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Difool

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Avr-gcc project on x86_64 and gnu/stubs-32.h file
« Reply #16 on: August 11, 2011, 03:11:59 pm »
Please close C::B and rename the default.conf.
Than restart C::B, so the configuration is rebuild from scratch and check the "Search directories".

/usr/include always appear in the search directory

I've already do this ...
And I said I had tested with two differents linux distribs (Fedora & Ubuntu), both are fresh installs (in fact, with Live CD ...).
So, they haven't ~/.codeblocks/default.conf
« Last Edit: August 11, 2011, 03:26:43 pm by Difool »

Offline Difool

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Avr-gcc project on x86_64 and gnu/stubs-32.h file
« Reply #17 on: August 11, 2011, 03:18:08 pm »
Seems the autodetection fails, see for the details: CompilerGNUAVR::AutoDetectInstallationDir()

http://svn.berlios.de/wsvn/codeblocks/trunk/src/plugins/compilergcc/compilerGNUAVR.cpp?peg=7359

Seems like the m_MasterPath is not set correctly.

m_MasterPath is set by :
Code
    if (platform::windows)
    {
      ....
    }
    else // if platform::linux
        m_MasterPath = _T("/usr");

But what is the usefulness of adding this include path ?
Code
AddIncludeDir(m_MasterPath + sep + _T("include"));

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Avr-gcc project on x86_64 and gnu/stubs-32.h file
« Reply #18 on: August 11, 2011, 03:20:45 pm »
After installing avr-gcc, I cam confirm this issue.

If the compiler-plugin detects the gnu-avr-gcc compiler it adds /usr/include and /usr/lib to the appropriate search dirs, but this is (of course) wrong for a cross-compiler.
I guess none of these is normally needed as long as only compiler-included headers and libs are used, because the compiler normally knows where to search.
I am not sure if it is needed on windows, normally it should not.

The wrong search-dirs are only added, if auto-detection does not fail:
Code
    AutoDetectResult ret = wxFileExists(m_MasterPath + sep + _T("bin") + sep + m_Programs.C) ? adrDetected : adrGuessed;
    if (ret == adrDetected)
    {
        if (platform::windows)
        {
            AddIncludeDir(m_MasterPath + sep + _T("avr\\include"));
            AddLibDir(m_MasterPath + sep + _T("avr\\lib"));
            m_ExtraPaths.Add(m_MasterPath + sep + _T("utils") + sep + _T("bin")); // for make
        }
        else
        {
            AddIncludeDir(m_MasterPath + sep + _T("include"));
            AddLibDir(m_MasterPath + sep + _T("lib"));
        }
    }

m_MasterPath is /usr, because the executables are in /usr/bin as nearly in all cases on linux.
That's the cause, why I did not see them until I installed the compiler.
« Last Edit: August 12, 2011, 01:53:06 pm by jens »

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Avr-gcc project on x86_64 and gnu/stubs-32.h file
« Reply #19 on: August 11, 2011, 03:22:16 pm »
Seems the autodetection fails, see for the details: CompilerGNUAVR::AutoDetectInstallationDir()

http://svn.berlios.de/wsvn/codeblocks/trunk/src/plugins/compilergcc/compilerGNUAVR.cpp?peg=7359

Seems like the m_MasterPath is not set correctly.

m_MasterPath is set by :
Code
    if (platform::windows)
    {
      ....
    }
    else // if platform::linux
        m_MasterPath = _T("/usr");

But what is the usefulness of adding this include path ?
Code
AddIncludeDir(m_MasterPath + sep + _T("include"));
As posted before: master path is set correctly, but the search-dirs are not (and most likely not needed).

Offline Difool

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Avr-gcc project on x86_64 and gnu/stubs-32.h file
« Reply #20 on: August 11, 2011, 03:40:04 pm »
Yes, so the AutoDetectInstallationDir() function seems to be useless and even undesirable. (It remains to be confirmed for Windows).
Should I open a ticket on the bugtracker for this ?
« Last Edit: August 11, 2011, 03:42:03 pm by Difool »