LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 06-02-2017, 10:01 AM   #1
abk4523
Member
 
Registered: Jun 2004
Distribution: RH8/Fedora Core 4
Posts: 139

Rep: Reputation: 15
Enet and gcc compiling


Sorry I'm lazy. I installed enet 1.3.13 and was trying to compile the host.c file but run into errors:

[bkeane@localhost enet-1.3.13]$ gcc -o host host.c `pkg-config --libs libenet`
Package libenet was not found in the pkg-config search path.
Perhaps you should add the directory containing `libenet.pc'
to the PKG_CONFIG_PATH environment variable

Does anyone know the gcc command to manually link enet and what files I need?
 
Old 06-02-2017, 10:52 AM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,856
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
Try this:
Code:
PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
pkg-config --cflags --libs libenet
Edit: You should find out if you actually installed libenet from source, or installed it from binary package, or didn't install at all.

Last edited by NevemTeve; 06-02-2017 at 10:59 AM.
 
Old 06-02-2017, 10:54 AM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
If you did
Code:
$ cd enet-1.3.13/ && ./configure && make
# make install
... then you get /usr/local/lib/pkgconfig/libenet.pc

Either copy libenet.pc to /usr/lib/pkgconfig/

Or do ..
Code:
$ export PKG_CONFIG_LIBDIR=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig/ \
&& gcc -o host host.c `pkg-config --libs libenet`
 
Old 06-02-2017, 10:57 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,804

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
if you have no libenet no gcc command can help you. Probably you need to install enet or enet related development package.
 
1 members found this post helpful.
Old 06-02-2017, 11:05 AM   #5
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,856
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
Yeah, I keep forgetting that distributors split packages into 'base' and 'devel' parts (sometime more), eg 'libenet7' and 'libenet-dev'
 
Old 06-02-2017, 11:16 AM   #6
norobro
Member
 
Registered: Feb 2006
Distribution: Debian Sid
Posts: 792

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
Quote:
Originally Posted by abk4523 View Post
... was trying to compile the host.c file ...
May I ask why you are trying to compile that file individually? It is part of the source code of the library.
https://github.com/lsalzman/enet/blob/master/host.c
 
1 members found this post helpful.
Old 06-02-2017, 12:10 PM   #7
abk4523
Member
 
Registered: Jun 2004
Distribution: RH8/Fedora Core 4
Posts: 139

Original Poster
Rep: Reputation: 15
I'm compiling the host.c program to verify the install. Is there a better way?
 
Old 06-02-2017, 12:17 PM   #8
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,804

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
look: I'm a bit confused, at this moment I have no idea what do you want to achieve.
First: what OS is it? What did you install exactly, and how (you told you installed enet 1.3.13)?
What is in your enet-1.3.13 directory? Why do you think host.c is a program? or What do you mean by that?
 
2 members found this post helpful.
Old 06-02-2017, 09:10 PM   #9
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
As others have said, it is really unclear what you are trying to accomplish.

Please try to restate your question and include:

* Your distro and version
* What, exactly you are trying to accomplish - you ultimate goal, not the goal of the gcc command

Pleas also see this page and the links at bottom thereof for guidance in asking a good and complete question, so that members here may better help you.
 
  


Reply



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
[SOLVED] Installing Enet and PhysFS 2.0.0? Maxaxle Linux - Newbie 1 08-10-2010 12:28 AM
How to selectively use GCC 3.4 -OR- GCC 4.1 in FC6 when compiling? rylan76 Fedora 2 11-21-2006 11:36 PM
Error compiling gcc 3.3.6 with 64bit gcc 4.0.3 cs-cam Linux - Software 0 04-22-2006 05:20 AM
Kernel compiling: gcc-3.3 is 586, should be gcc-3.3 386 Erik Plaggenmar Linux - Software 0 10-01-2004 11:38 AM
Various Compiling Errors (GCC compiling Openal, GUIlib, xmms-wma) gregorya Linux - Software 2 08-27-2004 05:03 AM

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

All times are GMT -5. The time now is 10:39 PM.

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