Bitcoin Forum
April 24, 2024, 06:38:17 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [SOLVED] compile adlutil with gcc on Ubuntu 16.04.3 LTS  (Read 123 times)
Banzak (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile WWW
December 12, 2017, 05:19:47 PM
Last edit: December 12, 2017, 08:01:58 PM by Banzak
 #1

Hello,

I am stuck with compiling the adlutil from the adl_sdk_V10.2 package.

I am running:
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.3 LTS
Release:        16.04
Codename:       xenial

the gcc version is:
  • gcc (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 2016060

I already installed:
  • the AMD-APP-SDK-3.0
  • the amdgpu-pro-17.40.492261

the Claymore DualMiner 10.2 is running fine since 1 week.

When I am trying to compile the adlutil with the following command:
Code:
sudo gcc main.c -o adlutil -DLINUX -ldl -I ../include/

I get the following error:
Code:
main.c: In function ‘GetValue’:
main.c:815:17: warning: format ‘%d’ expects argument of type ‘int *’, but argument 4 has type ‘int’ [-Wformat=]
  fscanf_s( file,"%32s %d\n", sField, 33, iValue);
                 ^
main.c:815:17: warning: too many arguments for format [-Wformat-extra-args]
main.c: In function ‘GetHex’:
main.c:828:17: warning: format ‘%X’ expects argument of type ‘unsigned int *’, but argument 4 has type ‘int’ [-Wformat=]
  fscanf_s( file,"%32s %X\n", sField, 33, iValue);
                 ^
main.c:828:17: warning: too many arguments for format [-Wformat-extra-args]
main.c: In function ‘GetFloat’:
main.c:841:17: warning: format ‘%f’ expects argument of type ‘float *’, but argument 4 has type ‘int’ [-Wformat=]
  fscanf_s( file,"%32s %f\n", sField, 33, fValue);
                 ^
main.c:841:17: warning: too many arguments for format [-Wformat-extra-args]

How do I fix that, or what I am missing?

Thank you for your help!

Regards,
Banzak



1713940697
Hero Member
*
Offline Offline

Posts: 1713940697

View Profile Personal Message (Offline)

Ignore
1713940697
Reply with quote  #2

1713940697
Report to moderator
The forum was founded in 2009 by Satoshi and Sirius. It replaced a SourceForge forum.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
Banzak (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile WWW
December 12, 2017, 08:01:37 PM
 #2

I solved it finally myself, there is an error in the main.c in the adlutil directory.

Here is the fix for others, go to line 819, there you will find the functions: GetValue(), GetHex() and GetFloat().

Old code to replace

Code:
int GetValue(  char * name, int * iValue, int line )
{
char sField[ 256 ];
fscanf_s( file,"%32s %d\n", sField, 33, iValue);
if ( 0 == strcmp( sField, name ) )
return ADL_OK;
else
{
sprintf_s( err, sErr, "Expected     : %s \nActual       : %s \nIn line      : %d", name, sField, line );
return ADL_ERR;
}
}

int GetHex(  char * name, int * iValue, int line )
{
char sField[ 256 ];
fscanf_s( file,"%32s %X\n", sField, 33, iValue);
if ( 0 == strcmp( sField, name ) )
return ADL_OK;
else
{
sprintf_s( err, sErr, "Expected     : %s \nActual       : %s \nIn line      : %d", name, sField, line );
return ADL_ERR;
}
}

int GetFloat(  char * name, float * fValue, int line )
{
char sField[ 256 ];
fscanf_s( file,"%32s %f\n", sField, 33, fValue);
if ( 0 == strcmp( sField, name ) )
return ADL_OK;
else
{
sprintf_s( err,  sErr, "Expected     : %s \nActual       : %s \nIn line      : %d", name, sField, line );
return ADL_ERR;
}
}

with that:
Code:
int GetValue(  char * name, int * iValue, int line )
{
char sField[ 256 ];
fscanf_s( file,"%32s %d\n", sField, iValue);
if ( 0 == strcmp( sField, name ) )
return ADL_OK;
else
{
sprintf_s( err, sErr, "Expected     : %s \nActual       : %s \nIn line      : %d", name, sField, line );
return ADL_ERR;
}
}

int GetHex(  char * name, int * iValue, int line )
{
char sField[ 256 ];
fscanf_s( file,"%32s %X\n", sField, iValue);
if ( 0 == strcmp( sField, name ) )
return ADL_OK;
else
{
sprintf_s( err, sErr, "Expected     : %s \nActual       : %s \nIn line      : %d", name, sField, line );
return ADL_ERR;
}
}

int GetFloat(  char * name, float * fValue, int line )
{
char sField[ 256 ];
fscanf_s( file,"%32s %f\n", sField, fValue);
if ( 0 == strcmp( sField, name ) )
return ADL_OK;
else
{
sprintf_s( err,  sErr, "Expected     : %s \nActual       : %s \nIn line      : %d", name, sField, line );
return ADL_ERR;
}
}

Explaination:

the error was in the function:
Code:
fscanf_s( file,"%32s %d\n", sField, 33, iValue);
you have to remove te third argument in all the functions, after that it should compile the adlutil.

Regards,
Banzak
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!