This is a multi-part message in MIME format.
--------------050404020004040600000608
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
I posted a query about this some time back and now I've been reminded it
never got resolved. Google just finds my original query here and
SunSolve is comatose yet again.
I can link w/ -m32 from a library, but not w/ -m64. The latter results
in failures to find the library members.
This is Solaris 10 U6 x86 w/ Studio 12 on an Ultra 20. Does anyone have
any suggestions? I searched SunSolve when I ran into this the first
time, but can't recall what I did after that.
Thanks,
Reg
Here's a console log and example code to demonstrate the problem:
==> console.log <==
sun_x86%rhb {156} make clean
rm -f *.o *.a tst_a tst_b
sun_x86%rhb {157} make CFLAGS=-m32
cc -m32 -c -o foo.o foo.c
cc -m32 -c -o bar.o bar.c
cc -m32 -o tst_a tst.c foo.o bar.o
ar crv libfoo.a foo.o bar.o
a - foo.o
a - bar.o
ranlib libfoo.a
cc -m32 -o tst_b tst.c libfoo.a
sun_x86%rhb {158} make clean
rm -f *.o *.a tst_a tst_b
sun_x86%rhb {159} make CFLAGS=-m64
cc -m64 -c -o foo.o foo.c
cc -m64 -c -o bar.o bar.c
cc -m64 -o tst_a tst.c foo.o bar.o
ar crv libfoo.a foo.o bar.o
a - foo.o
a - bar.o
ranlib libfoo.a
cc -m64 -o tst_b tst.c libfoo.a
Undefined first referenced
symbol in file
foo tst.o
ld: fatal: Symbol referencing errors. No output written to tst_b
make: *** [tst_b] Error 1
sun_x86%rhb {160} uname -a
SunOS u20 5.10 Generic_137112-02 i86pc i386 i86pc
sun_x86%rhb {161} isainfo -kv
64-bit amd64 kernel modules
sun_x86%rhb {162} cc -V
cc: Sun C 5.9 SunOS_i386 Patch 124868-05 2008/05/13
usage: cc [ options] files. Use 'cc -flags' for details
sun_x86%rhb {163} ld -V
ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.489
==> Makefile <==
all: tst_a tst_b
libfoo.a : foo.o bar.o
ar crv libfoo.a foo.o bar.o
ranlib libfoo.a
tst_a : tst.c foo.o bar.o
$(CC) $(CFLAGS) -o tst_a tst.c foo.o bar.o
tst_b : tst.o libfoo.a
$(CC) $(CFLAGS) -o tst_b tst.c libfoo.a
clean:
rm -f *.o *.a tst_a tst_b
==> bar.c <==
#include <stdio.h>
void bar(){
printf( "bar\n" );
}
==> foo.c <==
void foo( int n, float* a ){
int i;
for( i=0; i<n; i++ ){
a[i] *= a[i];
}
}
==> tst.c <==
#include <stdio.h>
void foo( int n ,float* a );
void bar( void );
int main(){
int i;
int n = 256;
float a[256];
for( i=0; i<n; i++ ){
a[i] = i;
}
printf( "%f \n" ,a[64] );
foo( n ,a );
printf( "%f \n" ,a[64] );
bar();
}
--------------050404020004040600000608
Content-Type: text/plain;
name="txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="txt"
==> console.log <==
sun_x86%rhb {156} make clean
rm -f *.o *.a tst_a tst_b
sun_x86%rhb {157} make CFLAGS=-m32
cc -m32 -c -o foo.o foo.c
cc -m32 -c -o bar.o bar.c
cc -m32 -o tst_a tst.c foo.o bar.o
ar crv libfoo.a foo.o bar.o
a - foo.o
a - bar.o
ranlib libfoo.a
cc -m32 -o tst_b tst.c libfoo.a
sun_x86%rhb {158} make clean
rm -f *.o *.a tst_a tst_b
sun_x86%rhb {159} make CFLAGS=-m64
cc -m64 -c -o foo.o foo.c
cc -m64 -c -o bar.o bar.c
cc -m64 -o tst_a tst.c foo.o bar.o
ar crv libfoo.a foo.o bar.o
a - foo.o
a - bar.o
ranlib libfoo.a
cc -m64 -o tst_b tst.c libfoo.a
Undefined first referenced
symbol in file
foo tst.o
ld: fatal: Symbol referencing errors. No output written to tst_b
make: *** [tst_b] Error 1
sun_x86%rhb {160} uname -a
SunOS u20 5.10 Generic_137112-02 i86pc i386 i86pc
sun_x86%rhb {161} isainfo -kv
64-bit amd64 kernel modules
sun_x86%rhb {162} cc -V
cc: Sun C 5.9 SunOS_i386 Patch 124868-05 2008/05/13
usage: cc [ options] files. Use 'cc -flags' for details
==> Makefile <==
all: tst_a tst_b
libfoo.a : foo.o bar.o
ar crv libfoo.a foo.o bar.o
ranlib libfoo.a
tst_a : tst.c foo.o bar.o
$(CC) $(CFLAGS) -o tst_a tst.c foo.o bar.o
tst_b : tst.o libfoo.a
$(CC) $(CFLAGS) -o tst_b tst.c libfoo.a
clean:
rm -f *.o *.a tst_a tst_b
==> bar.c <==
#include <stdio.h>
void bar(){
printf( "bar\n" );
}
==> foo.c <==
void foo( int n, float* a ){
int i;
for( i=0; i<n; i++ ){
a[i] *= a[i];
}
}
==> tst.c <==
#include <stdio.h>
void foo( int n ,float* a );
void bar( void );
int main(){
int i;
int n = 256;
float a[256];
for( i=0; i<n; i++ ){
a[i] = i;
}
printf( "%f \n" ,a[64] );
foo( n ,a );
printf( "%f \n" ,a[64] );
bar();
}
--------------050404020004040600000608--
|
|
0
|
|
|
|
Reply
|
Reginald
|
5/20/2009 9:52:28 PM |
|