LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   STRANGE: Newly Compiled GCC 4.4.4 on Solaris sparc gives problem with -m32/-m64 flags (https://www.linuxquestions.org/questions/linux-newbie-8/strange-newly-compiled-gcc-4-4-4-on-solaris-sparc-gives-problem-with-m32-m64-flags-4175419374/)

d_shanke 07-30-2012 09:22 AM

STRANGE: 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)
#############################################################
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.
#############################################################
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

acid_kewpie 07-30-2012 09:52 AM

Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.


All times are GMT -5. The time now is 12:29 AM.