Author Topic: CB 10.05 unusable under MAC OSX 10.6.4. - Workaround for GCC4.4 under 8.05?  (Read 16262 times)

Offline er

  • Multiple posting newcomer
  • *
  • Posts: 34
Here's the report:

http://developer.berlios.de/bugs/?func=detailbug&bug_id=17435&group_id=5358

For example, the keyboard types with the Command key. The space bar is unresponsive etc.

The older version of CB (8.05) works fine, but I need GCC 4.4, which is available under 10.05.

Any suggestion, please?



Code::Blocks 10.05/ Mac OS X 10.6.4/GCC

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7589
    • My Best Post
Here's the report:

http://developer.berlios.de/bugs/?func=detailbug&bug_id=17435&group_id=5358

For example, the keyboard types with the Command key. The space bar is unresponsive etc.

The older version of CB (8.05) works fine, but I need GCC 4.4, which is available under 10.05.

Any suggestion, please?



Use CB 8.02 if it works; and, Code::Blocks 10.05 does not.
Code::Blocks is NOT a Compiler.
Install the Compiler you want; then setup Code::Blocks to use the Compiler you want.

Note: The above works for Windows; I have no reason it won't work for OSX.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255

Offline er

  • Multiple posting newcomer
  • *
  • Posts: 34
Thanks it worked.

Another problem : is it worth a bug report?. In
 open > project
Clicking on Open does not close the pop up window. Clicking on Cancel shuts it, though.

Code::Blocks 10.05/ Mac OS X 10.6.4/GCC

Offline er

  • Multiple posting newcomer
  • *
  • Posts: 34

Use CB 8.02 if it works; and, Code::Blocks 10.05 does not.
Code::Blocks is NOT a Compiler.

Yes, I know CB is and IDE, but it comes with a pre-installed compiler, right?


Install the Compiler you want;


How do you install GCC4.4 on Mac OSX?


then setup Code::Blocks to use the Compiler you want.


How? I looked at Settings > Compiler and debugger. I see there's a scroll for choosing a compiler, but there are some compilers on my machine that do not show. For example, I have installed via Fink, /sw/bin/gcc-4. How do I parametrize CodeClocks to "know" of this compiler.

Thanks to the reply below, I probably will be able to go ahead with CCG 10.0, but the questions above are still of interest to me, for future reference. Thanks.
Code::Blocks 10.05/ Mac OS X 10.6.4/GCC

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7589
    • My Best Post
See http://wiki.codeblocks.org/index.php?title=Installing_a_supported_compiler#Compiler-neutral_setup_steps

If the Compiler Name you want already has a Valid Path that differs from what you want.

Copy the Compiler giving it a new name and change the toolchain path to the correct path.

Tim S.
« Last Edit: August 17, 2010, 12:47:38 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline er

  • Multiple posting newcomer
  • *
  • Posts: 34
See http://wiki.codeblocks.org/index.php?title=Installing_a_supported_compiler#Compiler-neutral_setup_steps

If the Compiler Name you want already has a Valid Path that differs from what you want.

Copy the Compiler giving it a new name and change the toolchain path to the correct path.

Tim S.

Thanks. This has worked with compiler gcc4.4 that I installed with fink. Specifically, in

Settings > Compiler > Toolchain

I replaced C-compiler by by gcc-4 and the C++ compiler by g++-4. Since make, ar and gdb were left out by the fink install, rather than replace the "compiler's installation directory" with the new one, /sw/bin, I put the latter under Additional Pathname.

And yes, I was able to use C++0x with the flat -std=c++0x. Let's see if it works upon exhaustive use.
Code::Blocks 10.05/ Mac OS X 10.6.4/GCC

Offline er

  • Multiple posting newcomer
  • *
  • Posts: 34
Hi,

I'm retracing my steps, above, and stumble upon this problem:

||warning: in obj/.../libs/assign/v2/src/main.o, file was built for i386 which is not the architecture being linked (x86_64)|
||=== Build finished: 0 errors, 1 warnings ===|

Any suggestion for troubleshooting? Thanks.
Code::Blocks 10.05/ Mac OS X 10.6.4/GCC

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7589
    • My Best Post
Hi,

I'm retracing my steps, above, and stumble upon this problem:

||warning: in obj/.../libs/assign/v2/src/main.o, file was built for i386 which is not the architecture being linked (x86_64)|
||=== Build finished: 0 errors, 1 warnings ===|

Any suggestion for troubleshooting? Thanks.


Find the Compiler or Linker Option needed to specify the machine/instruction set.
Put the right option in the project extra compiler or linker area.

Tim S.
« Last Edit: November 11, 2010, 09:31:24 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline er

  • Multiple posting newcomer
  • *
  • Posts: 34
Thanks. I guess you mean this

http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html

?

In Build Options > Compiler Settings > Compiler Flags there is a flag for i386, but not x86_64...

I tried -march=core2 which seemed like a related match, but no change : the same warning.

Still stuck.

 
Code::Blocks 10.05/ Mac OS X 10.6.4/GCC

Offline er

  • Multiple posting newcomer
  • *
  • Posts: 34
Re: CB 10.05 unusable under MAC OSX 10.6.4. - Workaround for GCC4.4 under 8.05?
« Reply #10 on: November 11, 2010, 09:41:45 pm »
As a comparison,

1- Under XCode/GCC4.2, I can choose the architecture betw ppc, i386 and X86_64, using a scroll down menu. I tried the last two and they compile fine.
2- I only encountered the above warning by trying to compile with GCC4.4, which was the original topic of this thread, and which had worked a while ago. Using
the default settings (GCC4.2), there is no such warning.

Thanks in advance.
Code::Blocks 10.05/ Mac OS X 10.6.4/GCC

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7589
    • My Best Post
Re: CB 10.05 unusable under MAC OSX 10.6.4. - Workaround for GCC4.4 under 8.05?
« Reply #11 on: November 12, 2010, 12:57:02 am »
Turn ON Full Compiler Logging and find an expert on your Compiler to look at the full rebuild log.

http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline er

  • Multiple posting newcomer
  • *
  • Posts: 34
Re: CB 10.05 unusable under MAC OSX 10.6.4. - Workaround for GCC4.4 under 8.05?
« Reply #12 on: November 12, 2010, 05:19:28 am »
Thanks, but

by following the instructions in the link, under "Compiler logging" there are 3 options:

Full command line
Task description (default)
No logging

that all produce the same build message and nothing more:

warning: in obj/Debug/main.o, file was built for i386 which is not the architecture being linked (x86_64).

and I'm  tyring to compile

int main()
{
    //using namespace boost;
    return 0;

}
Code::Blocks 10.05/ Mac OS X 10.6.4/GCC

Offline er

  • Multiple posting newcomer
  • *
  • Posts: 34
Re: CB 10.05 unusable under MAC OSX 10.6.4. - Workaround for GCC4.4 under 8.05?
« Reply #13 on: November 12, 2010, 05:23:26 am »
Well, this seems to be a problem that is common with porting to mac, and gcc4.4 is ported, in this case:

http://lists.macosforge.org/pipermail/macports-users/2010-May/020124.html

Will look there and update here if I find anything conclusive.

Weird though, as I'm just repeating some steps that I figured out in this thread and that had worked.
Code::Blocks 10.05/ Mac OS X 10.6.4/GCC

Offline er

  • Multiple posting newcomer
  • *
  • Posts: 34
Re: CB 10.05 unusable under MAC OSX 10.6.4. - Workaround for GCC4.4 under 8.05?
« Reply #14 on: November 12, 2010, 08:19:41 pm »
Update : there is no problem in building the same program from the command line, .e.g

/sw/bin/g++-4 -o helloworld main.cpp

and it executes as it should...
Code::Blocks 10.05/ Mac OS X 10.6.4/GCC

Offline er

  • Multiple posting newcomer
  • *
  • Posts: 34
Re: CB 10.05 unusable under MAC OSX 10.6.4. - Workaround for GCC4.4 under 8.05?
« Reply #15 on: November 12, 2010, 08:26:33 pm »
And if I revert to the default compiler, GCC4.2, rather than the ported GCC4.4, and a check the i386 compiler flag, I get,

"error : CPU you selected does not support x86-64 instruction set",

which seems consistent with the error I get under GCC4.4...
Code::Blocks 10.05/ Mac OS X 10.6.4/GCC

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7589
    • My Best Post
Re: CB 10.05 unusable under MAC OSX 10.6.4. - Workaround for GCC4.4 under 8.05?
« Reply #16 on: November 12, 2010, 08:50:33 pm »
Update : there is no problem in building the same program from the command line, .e.g

/sw/bin/g++-4 -o helloworld main.cpp

and it executes as it should...

And if you looked at the Full Compiler log you would be able to say something is different.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline er

  • Multiple posting newcomer
  • *
  • Posts: 34
Re: CB 10.05 unusable under MAC OSX 10.6.4. - Workaround for GCC4.4 under 8.05?
« Reply #17 on: November 12, 2010, 09:01:55 pm »
Thanks.

As I've mentioned, I have set Compiler logging to Full Command Line. I guess this is what you meant?

In the Build log, this is what I get:


-------------- Build: Debug in cpp_0x ---------------

g++  -o bin/Debug/cpp_0x obj/Debug/main.o   
ld: warning: in obj/Debug/main.o, file was built for i386 which is not the architecture being linked (x86_64)
Undefined symbols:
  "_main", referenced from:
      start in crt1.10.6.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 1 warnings
Code::Blocks 10.05/ Mac OS X 10.6.4/GCC

Offline er

  • Multiple posting newcomer
  • *
  • Posts: 34
Re: CB 10.05 unusable under MAC OSX 10.6.4. - Workaround for GCC4.4 under 8.05?
« Reply #18 on: November 12, 2010, 09:07:08 pm »
And this is what the staff from Fink tells me :

"You're on a 32-bit Fink  (according to the link, unless you changed
something) and for some reason the CodeBlocks IDE appears to be linking
64-bit stuff as well, and the two don't mix.

We see similar errors when packages try to build as 64-bit by default
and try to link 32-bit libraries.  This normally happens because the
Xcode compilers default to 64-bit mode.

gcc4.4 hasn't changed since your prior message, and we haven't had any
other reports of altered behavior.  I'm inclined to think that something
has changed in Codeblocks.  Is this the _same_ version that used to work
for you?"

I think I'm using the same version of CB, though.

Code::Blocks 10.05/ Mac OS X 10.6.4/GCC

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7589
    • My Best Post
Re: CB 10.05 unusable under MAC OSX 10.6.4. - Workaround for GCC4.4 under 8.05?
« Reply #19 on: November 12, 2010, 10:14:18 pm »
You need to do a re-build so the compiler command is seen in the build log!

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline er

  • Multiple posting newcomer
  • *
  • Posts: 34
Re: CB 10.05 unusable under MAC OSX 10.6.4. - Workaround for GCC4.4 under 8.05?
« Reply #20 on: November 12, 2010, 11:01:17 pm »
Thanks,

This is the Build log after a rebuild:


-------------- Clean: Debug in cpp_0x ---------------

Cleaned "cpp_0x - Debug"

-------------- Build: Debug in cpp_0x ---------------

g++-4 -Wall -fexceptions  -g    -I/usr/local/trunk  -c /Users/Me/dev/cpp/projects/cpp_0x/main.cpp -o obj/Debug/main.o
g++  -o bin/Debug/cpp_0x obj/Debug/main.o   
ld: warning: in obj/Debug/main.o, file was built for i386 which is not the architecture being linked (x86_64)
Undefined symbols:
  "_main", referenced from:
      start in crt1.10.6.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 1 warnings


For comparison, this is the Build log, after re-setting the compiler settings to the default, and rebuilding:

-------------- Clean: Debug in cpp_0x ---------------

Cleaned "cpp_0x - Debug"

-------------- Build: Debug in cpp_0x ---------------

Compiling: main.cpp
Linking console executable: bin/Debug/cpp_0x
Output size is 8.76 KB
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings
 
Code::Blocks 10.05/ Mac OS X 10.6.4/GCC

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7589
    • My Best Post
Re: CB 10.05 unusable under MAC OSX 10.6.4. - Workaround for GCC4.4 under 8.05?
« Reply #21 on: November 13, 2010, 01:39:24 am »
Why are you mixing two separate commands; please change them to match. Either use  "g++-4" or "g++" Not both.
Check the c++ Compiler and the linker command under compiler tool chain.

Please Turn ON Full Compiler Logging for Comparison to default settings.

For comparison, this is the Build log, after re-setting the compiler settings to the default, and rebuilding:

-------------- Clean: Debug in cpp_0x ---------------

Cleaned "cpp_0x - Debug"

-------------- Build: Debug in cpp_0x ---------------

Compiling: main.cpp
Linking console executable: bin/Debug/cpp_0x
Output size is 8.76 KB
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings
 


Tim S.
« Last Edit: November 13, 2010, 01:53:19 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline er

  • Multiple posting newcomer
  • *
  • Posts: 34
Compiler settings for GCC4.4 (Fink)
« Reply #22 on: November 15, 2010, 06:29:58 pm »

"Why are you mixing two separate commands; please change them to match. Either use  "g++-4" or "g++" Not both."

Indeed. This should be the set up

Compiler's installation dir : Auto-detect
Other paths : the path to the non-default compiler, in my case /sw/bin

C compiler : gcc-4
C++ compiler : g++-4
Linker for dynamic libs : g++-4

I had forgotten the last one.

One last question : how do I save the Settings (such as Search directorie)? Saving the project or the workspace does not suffice. If I close and restart CB, the changes are not kept.
Code::Blocks 10.05/ Mac OS X 10.6.4/GCC

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7589
    • My Best Post
Re: Compiler settings for GCC4.4 (Fink)
« Reply #23 on: November 15, 2010, 10:15:44 pm »
I had forgotten the last one.

One last question : how do I save the Settings (such as Search directorie)? Saving the project or the workspace does not suffice. If I close and restart CB, the changes are not kept.

Note: Try doing the search directories changes and then use "save all projects" or/and "save projects" before doing the below steps.

Note: Also, Try doing "project save as"; if it works, it means likely you do not have permission or file is read-only.

If Code::Blocks does not crash on shut-down it should save the setting in the project.
Try turning off/disabling all the plug-ins except for the Compiler Plug-in.
Shut down Code::Blocks.
Re-Open Code::Blocks are all the plug-ins except for the Compiler Plug-in disabled?
If yes, open project and change search directories.
Shut down Code::Blocks.
Re-Open Code::Blocks are all the changes to search directories still there?
If yes, try the turning on the Plugins you use one at a time to figure out which needs to be off to save the project changes.


Tim S.
« Last Edit: November 15, 2010, 10:20:54 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org