How do I compile a 64-bit program on SPARC??

Hi,

wcslen(), strlen() returns size_t.
On 64-bit platform i want to use int like

str length is 10.

int len = wcslen(str);

On 64-bit what should I need to do if i wants the length in int. Because getting error as "Conversion of 64 bit type value to "int" causes truncation".
if i will use size_t instead of int like
size_t len = wcslen(str);

Then it is feasible. Should I do casting like:

int len = (int) wcslen(str);

which is better to use?

on 64-bit platforms, size_t is probably 64 bits, while int is probably 32 (not always the case though, and is sometimes compiler or compiler-setting specific. Anyway, you should use

size_t len = wcslen(str);

To test to see how long each is, do:

#include <stdio.h>
main (int c, char **v) { 
printf("int length is %d\nsize_t length is %d\n",sizeof(int), sizeof(size_t));
}

Hi,

I have written code like this :

On 32-bit -
typedef unisgned long DWORD;
string length is 50;
DWORD len = wcslen(string);

But on 64-bit getting porting error -Conversion of 64 bit type value to "int" causes truncation

I made changes into the code like:
#ifdef _LP64
typedef unisgned int DWORD;
#else
typedef unisgned long DWORD;
#endif

Still it is giving error like "Conversion of 64 bit type value to "unsigned" causes truncation"

instead of int - unsigned is given in error.

Any pointers will be helpful.

Again, The problem with casting signed int into unsigned int is that this discards the "sign" bit (it's a tad bit more complicated than that). For some reason, size_t appears to be signed, and therefore can be negative. You cannot convert a negative number of any size into a bigger integer that is non-negative. (It can be done, but you risk "losing information"). So either ignore the warning, or make size_t unsigned, or make DWORD signed.

I have '.c' files. I wanted to build this for 64-bit platform.
I am using gcc to compile these .c files.
But if i use
gcc +w2 -D_REENTRANT -D_POSIX_C_SOURCE=199506L -D__EXTENSIONS__ -xarch=v9 -O2 -g -Wall -fno-strict-aliasing

To find out the warnings for truncation or porting.

It is giving me error as :
gcc: +w2: No such file or directory
gcc: language xarch=v9 not recognized

Can you please tell me the what is the other option can be used with gcc to build the code 64-bit compatible?

I am trying to use lint with .c files.
Let me know that if i am giving command like:

>> lint test.c

But test.c has included other user define header files. So How can I get reference to the header file while executing lint command.
I am getting error for header file as:
" cannot find include file"

How to specify the path of header file with the lint command?

Please respond to my query via private message.

I do not currently have lint on any of my systems. It is largely obsolete, in my opinion, by GCC's -Wall -pedantic. What does "man lint" tell you?

Hi,

Can you please tell me that suitable configuration option to build the 64-bit MySQL binary with the following OS, Compiler details?

OS : SunOS 5.8 Generic_117350-39 sun4u sparc SUNW,Ultra-250
Compiler : CC: Sun WorkShop 6 update 2 C++ 5.3 Patch 111685-09 2002/07/17
gcc version 3.2

I am trying to build source code mysql-4.0.13. I need 64-bit build binary of this version.

(1) upgrade to gcc 4.x. (2) Look at the configure options provided by MySQL. That should produce the proper compiler options. (3) If one of the types you change ultimately relates to a database operation, you may end up with corrupted data.

Got the solution for Lint query.

Wants to use "-I" option with lint to provide include file directory path.

>>>>>> lint -I dirname text.c

I am trying to build the 64-bit mysql code using following steps:

export PLATFORM="sparc64"
export PATH=$PATH:/usr/ccs/bin then

  1. CC=gcc CFLAGS="-O3 -m64 -fno-omit-frame-pointer" CXX=gcc CXXFLAGS="-O3 -m64
    -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti"

  2. ./configure --prefix=/usr/local/mysql
    --with-extra-charsets=complex --enable-thread-safe-client
    --enable-local-infile --with-named-z-libs=no
    --with-named-curses-libs=-lcurses --disable-shared

  3. gmake

After build if I do::
>> file a.o

It shows ELF 32-bit MSB relocatable SPARC Version 1 -- means 32-bit build.
For 64-bit build I have added -m64 option in step1.But still it is not build as 64-bit.
Any changes needed in makefile for doing 64-build? or What changes need to do for 64-bit other than this?

The linker is the key. Make sure your linker also expects to generate 64-bit code.

How do I get to know the ELF file type for archieve file?

Like :
>>>>> file test.o
it gives : ELF 32-bit MSB relocatable SPARC Version 1

But for archieve file it does not show any type.
It shows :
current ar archive, not a dynamic executable or shared object

ar t <archive>

shows you a list of the files in the archive. You can extract them with "ar x" I believe.

Can you please tell me ActivePerl-5.8.8.817 library are available for 64-bit Solaris or need to download source code and have to build it?

Can you please tell me about Oracle9i 64-bit libraries are available?
I saw on the link Oracle9i Software Downloads

But it is the link from where i will get the Oracle9i library?

Also for Sybase and ODBC is available for 64-bit support on Solaris?

Sybase CT-library are availble for download?

I have requirement of 64-bit libcs.so, libct.so, libintl.so,libtcl.so, libcomn.so libraries. Can you please tell me from where i will get or download these libraries?