LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-06-2007, 07:06 AM   #1
cybil001
Member
 
Registered: Jan 2007
Posts: 32

Rep: Reputation: 15
Exclamation make problem :(


hi.
i receive the following error when i m trying to reate the executable binary,using "make"

make
gcc -c -ggdb rsa.c
gcc -c -ggdb communication.c
communication.c: In function ‘btcomm’:
communication.c:130: error: called object ‘socket’ is not a function
communication.c: In function ‘apDecryptedRecv’:
communication.c:270: error: static declaration of ‘authorization’ follows non-static declaration
communication.c:42: error: previous declaration of ‘authorization’ was here
communication.c:408: error: expected declaration or statement at end of input
make: *** [communication.o] Error 1


i m a newbie!
tnx
 
Old 01-06-2007, 08:13 AM   #2
Samoth
Member
 
Registered: Apr 2005
Distribution: Exherbo
Posts: 474
Blog Entries: 1

Rep: Reputation: 32
It appears as if it is failing to load a header file. Did you see anything missing when you ran ./configure?
 
Old 01-13-2007, 02:46 PM   #3
cybil001
Member
 
Registered: Jan 2007
Posts: 32

Original Poster
Rep: Reputation: 15
Exclamation

well i tried to run ./configure but ir is giving an error:

bash: ./configure: No such file or directory

i read somewhere that it requires a configure file, which is not in that folder[i got this whole software from a friend].the other files included in the folder are a few header files, a few *.c files, a makefile,n a exe file.there is a readme file that says:

To create the executable binary, run:

make



The normal usage is:

zoned



The usage options is:

zoned -d 500 -p 1 (default use)



-d directory_size

-p procedure_type


wat to do


Last edited by cybil001; 01-13-2007 at 02:53 PM.
 
Old 01-13-2007, 03:12 PM   #4
slzckboy
Member
 
Registered: May 2005
Location: uk - Reading
Distribution: slackware 14.2 kernel 4.19.43
Posts: 462

Rep: Reputation: 30
i would lose the pink writing in your reply's

its really hard to read.I missed it the first time around.

Quote:
To create the executable binary, run:

make



The normal usage is:

zoned



The usage options is:

zoned -d 500 -p 1 (default use)



-d directory_size

-p procedure_type

looks like the software dosn't ship with a configure script.

Anyway,I would download the sources from whoever writes and maintains the software as there seems to be some problems here with this code!?

i.e double variable declarations and the calling of functions that have not been defined.
 
Old 01-14-2007, 03:47 AM   #5
cybil001
Member
 
Registered: Jan 2007
Posts: 32

Original Poster
Rep: Reputation: 15
Exclamation

hey sorry for font colour!!
anyways i m pasting the void function from the communication.c file[which is giving the first error].
tell me wat to do?????

[B]void* btcomm(void *bnode)

{

struct sockaddr_l2 rem_addr, loc_addr;

struct l2cap_options opts;

//socket type, asynnous packet is used, alternatively, uses int socktype = SOCK_DGRAM;

int socktype = SOCK_SEQPACKET;

bdaddr_t bdaddr;



//get address

HashNode *node = ((HashNode*) bnode);

char* ba = node->curr_bdaddr;

bdaddr_t *remote_addr = strtoba((char*)ba); //bdadd_t is the type used to store BT address.



//default mtu

int imtu = 672;

int omtu = 0;

unsigned short psm;

psm = 171;



//receive buffer is the highes maximum trasger unit. We are amiming to transfer one MTU

//at the maximum to increase performance.

unsigned char rbuf[672];





int s, opt,status;



int encryptionRand[1];



// define the role of this communication

//int master =0 ;

//int auth=0;

//int encrypt = 0;

opt=0;

//if (master)

// opt |= L2CAP_LM_MASTER;

//if (encrypt)

// opt |= L2CAP_LM_ENCRYPT;

// if (auth)

// opt |= L2CAP_LM_AUTH;





//prepare socket for communication

if( (s = socket(PF_BLUETOOTH, socktype, BTPROTO_L2CAP)) < 0 ) {

printf("Error: Can't create socket. %s(%d)\n", strerror(errno), errno);



close(s);

dec_thread();

changeCommStatus(1, node);

return ;

}



//using memset to allocate memory the size of sockaddr_l2

memset(&loc_addr, 0, sizeof(loc_addr));

loc_addr.l2_family = AF_BLUETOOTH;

bacpy(&bdaddr, BDADDR_ANY);



printf("The address connect from :\t%s \n", batostr(&loc_addr.l2_bdaddr) );

if( bind(s, (struct sockaddr *) &loc_addr, sizeof(loc_addr)) < 0 ) {

printf("Error:Can't bind socket. %s(%d)\n", strerror(errno), errno);

dec_thread();

changeCommStatus(1, node);

close(s);

return ;

}



// Get default options, and use the struct l2cap_option as output

opt = sizeof(opts);

if( getsockopt(s, SOL_L2CAP, L2CAP_OPTIONS, &opts, &opt) < 0 ) {

//syslog(LOG_ERR, "Can't get default L2CAP options. %s(%d)", strerror(errno), errno);

printf("Can't get option. %s(%d)\n", strerror(errno), errno);

changeCommStatus(1, node);

dec_thread();

close(s);

return;

}



// Set new options, from previous get opt, insert max input, and min output trasfer unit

opts.omtu = omtu;

opts.imtu = imtu;

if( setsockopt(s, SOL_L2CAP, L2CAP_OPTIONS, &opts, opt) < 0 ) {

printf("Can't set option. %s(%d)\n", strerror(errno), errno);

changeCommStatus(1, node);

dec_thread();

close(s);

return;

}



int time=5;



setsockopt(s, SOCK_SEQPACKET, SO_RCVTIMEO,&time,sizeof(time) );

memset(&rem_addr, 0, sizeof(rem_addr));

rem_addr.l2_family = AF_BLUETOOTH;



//required to swap the address for remote addr

baswap(&rem_addr.l2_bdaddr, remote_addr);

printf("The address to connect is:\t%s \n", batostr(&rem_addr.l2_bdaddr));

rem_addr.l2_psm = htobs(psm);





//handshaking to determine whether we are talking to a zoneIT enabled phone

if (handshake(s,rem_addr,node,encryptionRand)>0){

//when error

return;

}



if(authorization(s,rem_addr,node,encryptionRand)>0){

//when error

return;

}



//initiate

//when all is successful

close(s);

dec_thread();

changeCommStatus(0, node);

printf("No of threads is %i",threads_running);



return ;



}





//method used to change the state of a bluetooth device inside the directory

void changeCommStatus(int stat, HashNode* node){

lock_directory();

node->comm_status=stat;

node->last_detected=scan_count;

unlock_directory();

return;



}



//the handshaking procedure. involves the exchange of pre-defined strings.

int handshake(int s, struct sockaddr_l2 rem_addr, HashNode* node,int* encryptionRand){



unsigned char AP_INIT[24] = "BTA_INIT_AP_CHALLANGE\0";

unsigned char PHONE_INIT_RESP[25] = "BTA_INIT_PHONE_RESPONSE\0";



unsigned char rbuf[672];



the RED line is giving the error???

Last edited by cybil001; 01-14-2007 at 03:54 AM.
 
Old 01-14-2007, 05:44 AM   #6
slzckboy
Member
 
Registered: May 2005
Location: uk - Reading
Distribution: slackware 14.2 kernel 4.19.43
Posts: 462

Rep: Reputation: 30
Quote:
communication.c:130: error: called object 'socket' is not a function

at the top of communication.c

put

#include sys/socket.h
#include sys/types.h
 
Old 01-14-2007, 12:41 PM   #7
cybil001
Member
 
Registered: Jan 2007
Posts: 32

Original Poster
Rep: Reputation: 15
Exclamation

same error!!

 
Old 01-14-2007, 01:09 PM   #8
slzckboy
Member
 
Registered: May 2005
Location: uk - Reading
Distribution: slackware 14.2 kernel 4.19.43
Posts: 462

Rep: Reputation: 30
type

"man socket"
on the command line on your system.

what header files are related to the function in the synopsis section?

should be something like
Code:
SYNOPSIS
       #include <sys/types.h>
       #include <sys/socket.h>

       int socket(int domain, int type, int protocol);
what software package is this that you are trying to build???
 
Old 01-15-2007, 06:56 AM   #9
cybil001
Member
 
Registered: Jan 2007
Posts: 32

Original Poster
Rep: Reputation: 15
Exclamation

ya..it shows...
SYNOPSIS
#include <sys/types.h>
#include <sys/socket.h>

int socket(int domain, int type, int protocol);


is there some prob wid the compiler or libraries or ????

well this software is a kind of access point or server for mobiles n using bluetooth[bluez]


Last edited by cybil001; 01-15-2007 at 06:58 AM.
 
Old 01-16-2007, 12:25 PM   #10
slzckboy
Member
 
Registered: May 2005
Location: uk - Reading
Distribution: slackware 14.2 kernel 4.19.43
Posts: 462

Rep: Reputation: 30
strange...
Do you hve the /usr/include/sys/socket.h file on your system?

Without seeing all the code/files it going to be kinda hard to trouble shoot this.

well written software should have stuff like double declarations in them.

Thats the sort of thing that should be picked up on while developing.

Did your friend test this b4 he/she gave it to you?
 
Old 01-16-2007, 12:57 PM   #11
cybil001
Member
 
Registered: Jan 2007
Posts: 32

Original Poster
Rep: Reputation: 15
Exclamation

ya, the socket.h file is also over there.

well this prog ran on my friends pc.the prob is that he is not available now,otherwise i would not hav troubled u ppl!

my friend was using mandrake 9.1 n i m using FC5...does this has something to do with linux distributions???

should i paste the whole code over here or upload it somewhere??
 
Old 01-16-2007, 01:30 PM   #12
slzckboy
Member
 
Registered: May 2005
Location: uk - Reading
Distribution: slackware 14.2 kernel 4.19.43
Posts: 462

Rep: Reputation: 30
if there's alot of it then it would probably be best if you could upload all of the files somewhere.
The Makefile aswell.
I am curious to have a look...
 
Old 01-17-2007, 11:23 AM   #13
cybil001
Member
 
Registered: Jan 2007
Posts: 32

Original Poster
Rep: Reputation: 15
Exclamation

hey..i hav sent u the link!!
 
Old 01-22-2007, 06:05 PM   #14
slzckboy
Member
 
Registered: May 2005
Location: uk - Reading
Distribution: slackware 14.2 kernel 4.19.43
Posts: 462

Rep: Reputation: 30
hey..

I haven't 4gotten u.
This couldn't have compiled for you friends machine in its current state.?!!!

I got the same errors as you when I compiled this.

I have cleaned up a few typo's in the code so that it now compiles albeit with warnings.

However upon running the prog it crashes with a segmentation fault !?!

I'm going to bed now,so I will take another look at this 2morrow.
 
Old 01-26-2007, 01:44 AM   #15
pasteNoctem
Member
 
Registered: Apr 2006
Location: Athens Greece
Distribution: Kubuntu
Posts: 35

Rep: Reputation: 15
i was thinking if it might be a linker error with some specific libraries... not sure though
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Make Trouble linking some fortran code Make file problem? any ideas? TheBrick Linux - General 0 05-17-2006 11:21 AM
make xconf;make gconf problem Soqool Linux - Newbie 3 06-12-2005 12:00 PM
Problem with Configure, Make, Make Install n8tgc Linux - Newbie 2 07-13-2004 03:16 PM
make clean, make dep problem carscht Linux - Newbie 2 02-21-2004 10:32 AM
make dep,make clean,make bzImage problem Babba Linux - Newbie 2 01-08-2003 03:49 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration