Newly Compiled GCC 4.4.4 on Solaris sparc gives problem with -m32/-m64 flags


 
Thread Tools Search this Thread
Operating Systems Solaris Newly Compiled GCC 4.4.4 on Solaris sparc gives problem with -m32/-m64 flags
# 1  
Old 07-31-2012
Newly Compiled GCC 4.4.4 on Solaris sparc gives problem with -m32/-m64 flags

Hello experts,

This issue has kept me busy all day long. It started off with openssl compilation which was giving linking error with following message:
/usr/local/bin/ld: target elf32-sparc not found
collect2: ld returned 1 exit status

I tried every step possible thing that I could think of but was not able to resolve the issue. Although I came to know that specifying -m32/-m64 flag with my newly built gcc has started reporting this issue. I have tried to provide all neccessary details below including the test program which when I try to compile gives the same issue.
Note: I am using GNU binaries(bintuils 2.21)
Code:
#############################################################
bash-3.2# uname -a
SunOS CSAPI-DEV-SOL3 5.10 Generic_147440-01 sun4u sparc SUNW,Sun-Fire-V240
#############################################################
bash-3.2# gcc -v
Using built-in specs.
Target: sparc-sun-solaris2.10
Configured with: ../gcc-4.4.4/configure --prefix=/usr/local/gcc-4.4.4  --program-suffix=-4.4.4 --enable-threads=posix --enable-shared  --enable-languages=c,c++ --with-gnu-as --with-as=/usr/local/bin/as  --with-gnu-ld --with-ld=/usr/local/bin/ld
Thread model: posix
gcc version 4.4.4 (GCC)
#############################################################
Content of test.cpp
#include <iostream>
int main()
{
std::cout<< "hello world\n";
}
#############################################################
/******* COMPILATION OUTPUT *******************/
bash-3.2# gcc -o test1 test.cpp -m32 -mcpu=ultrasparc -lstdc++
/usr/local/bin/ld: target elf32-sparc not found
collect2: ld returned 1 exit status
#############################################################

If I remove the -m32/-m64 flag output file is successfully generated.
#############################################################
Code:
bash-3.2# file test1
test1: ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, dynamically linked, not stripped

#############################################################
Could anyone please help me figure out why I am seeing this behavior. I have literally pulled my hair so much that my forehead has started to ache. :-(

Thanks,
damz
Moderator's Comments:
Mod Comment please use code tags, it helps us read your post

Last edited by jim mcnamara; 07-31-2012 at 09:38 AM..
# 2  
Old 08-09-2012
gcc.gnu.org/bugzilla/show_bug.cgi?id=54155
This User Gave Thanks to d_shanke For This Post:
# 3  
Old 08-09-2012
Thank you for following up. It's appreciated.

Regards,
Alister
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Local variable in a C function is not getting created in stack when its compiled with GCC

Hi, I am working in UEFI EDK2 Bios source. We created a platform related new package in the EDK2 source. I find a strange issue with the platform related code we added. When I did source level debugging I noticed the local variable in a C function is not getting created in stack when its... (6 Replies)
Discussion started by: Divya R
6 Replies

2. Solaris

Unrecognized option: sparc-sun-Solaris2.10/bin/as: unrecognized option `-m32'

Hi, I installed some packages required by an app built with python. But when I try python setup.py install, I get the following error: /opt/csw/lib/gcc/sparc-sun-solaris2.10/5.2.0/../../../../sparc-sun-solaris2.10/bin/as: unrecognized option `-m32' Could anyone tell me what's wrong... (4 Replies)
Discussion started by: Kimkun
4 Replies

3. Programming

Using ANSI color codes in gcc compiled program

I have put some yellow color codes and works well. I call the funstion using print_usage(stderr, 0); I would like to know if there is any way, to store the ansi color codes in variables and then call them inside fprintf. Or have a format followed by the strings I want to output. ... (5 Replies)
Discussion started by: kristinu
5 Replies

4. UNIX for Dummies Questions & Answers

can I emulate solaris/sparc on virtualbox? Or other emulator to run solaris for sparc in my win7 PC?

Hi Gurus can I emulate solaris/sparc on virtualbox? Or other emulator to run solaris for sparc in my win7 PC? regards, Israel. (9 Replies)
Discussion started by: iga3725
9 Replies

5. Solaris

SUN SPARC rebooting problem, after Solaris 10 installation

Hi All, I had install the solaris 10 into the SUNFIRE V890 server, after installed, it keep rebooting. I wish to enter the OK mode again, and install back the Solaris 10. i had try the "break" button and "stop+A" button, but all fail. kindly advice... (4 Replies)
Discussion started by: SmartAntz
4 Replies

6. Solaris

Problem compiling Samba 3.5.1 on Solaris 10 with gcc (3.4.6)

I'm getting this error when 'Linking shared library bin/libtalloc.so.2'... anyone know what's up here? Using CFLAGS = -O -I. -I/source/samba-3.5.1/source3 -I/source/samba-3.5.1/source3/../lib/popt -I/source/samba-3.5.1/source3/iniparser/src -Iinclude -I./include -I. -I. -I./../lib/replace... (6 Replies)
Discussion started by: son_t
6 Replies

7. Programming

Header file compilation using gcc in Sparc Solaris

I am facing problem while migrating the c++ code from Linux to Solaris. In linux the code is absolutly compiled fine with GCC compiler but when i am using the same in Solaris it coomplains bash-3.1$ gcc LibSip.h gcc: Compilation of header file requested The same command is working fine in... (2 Replies)
Discussion started by: mrupesh74
2 Replies

8. UNIX for Dummies Questions & Answers

Script to automatically reboot to newly compiled kernel with fallback

Hi, I'm new here. Just started playing around with kernel compilation. I need a little bit of advice. I'm trying to do a bash script to automatically compile a kernel package and reboot to that new kernel by default, with fallback to the old kernel. So far, I'm getting stuck at the part... (0 Replies)
Discussion started by: tridus_08
0 Replies

9. Solaris

gcc problem on Solaris

I just installed gcc from the latest package at sunfreeware.com using pkgadd. I write a simple 'Hello World!' program to test it. I try to compile it and I get this error: rockstar# gcc hello.c -o hello ld.so.1: gcc: fatal: libiconv.so.2: open failed: No such file or directory Killed I... (0 Replies)
Discussion started by: Bradj47
0 Replies

10. Linux

gcc compiled executable not working across x86_64 linux platforms

Hi I compiled a hello world program on two different 64-bit Linux machines, named quimby and node0331. When I compile on quimby and run on node0331 I get a "Floating exception (core dumped)" error. But if I do it in reverse, things work fine. Here's my compilation on quimby: $ uname -a... (3 Replies)
Discussion started by: same1290
3 Replies
Login or Register to Ask a Question