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 08-06-2010, 04:38 AM   #1
linuxmandrake
Member
 
Registered: Sep 2004
Distribution: debian sarge 64bit (AMD)
Posts: 709

Rep: Reputation: 30
Compiling libusb c++ program to run without it's dependencies


Hi
I've built a piece of hardware that communicates using usb. I was wondering could I make a libusb based program run on it's own without gcc/ libusb
 
Old 08-06-2010, 04:46 AM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by linuxmandrake View Post
Hi
I've built a piece of hardware that communicates using usb. I was wondering could I make a libusb based program run on it's own without gcc/ libusb

Suppose I run, say, 'cp src_file dst_file' - does the 'cp' program need 'gcc' to run ?

If yes - how ? If no, how is your program different ?
 
Old 08-06-2010, 06:04 AM   #3
linuxmandrake
Member
 
Registered: Sep 2004
Distribution: debian sarge 64bit (AMD)
Posts: 709

Original Poster
Rep: Reputation: 30
but I don't need to cp files. I'm simply using libusb
 
Old 08-06-2010, 06:34 AM   #4
wje_lq
Member
 
Registered: Sep 2007
Location: Mariposa
Distribution: FreeBSD,Debian wheezy
Posts: 811

Rep: Reputation: 179Reputation: 179
Quote:
Originally Posted by linuxmandrake View Post
I've built a piece of hardware that communicates using usb. I was wondering could I make a libusb based program run on it's own without gcc/ libusb
Using libusb means you don't have to worry about low-level usb programming details yourself. The most straightforward way to avoid using libusb itself is to look at the source code for libusb and steal whatever you need from it and put it into your own source code.

Of course, if you decide to do that and you distribute your compiled program to others in any way, you'll have to license it under the GPL (with all that this implies), or we'll come after you.
 
Old 08-06-2010, 06:34 AM   #5
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by linuxmandrake View Post
but I don't need to cp files. I'm simply using libusb
No software library works by itself, it works being linked to a program.

But when a library is linked to a program, why/what for do you need a compiler ('gcc' in this case) ?
 
Old 08-06-2010, 07:46 AM   #6
linuxmandrake
Member
 
Registered: Sep 2004
Distribution: debian sarge 64bit (AMD)
Posts: 709

Original Poster
Rep: Reputation: 30
that's fair enough I'll research into the GPL since I've never had to work with it.
 
Old 08-06-2010, 08:03 AM   #7
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by linuxmandrake View Post
that's fair enough I'll research into the GPL since I've never had to work with it.
And what does the license (GPL) have to do with the issue ?
 
Old 08-06-2010, 08:39 AM   #8
linuxmandrake
Member
 
Registered: Sep 2004
Distribution: debian sarge 64bit (AMD)
Posts: 709

Original Poster
Rep: Reputation: 30
read wje_lq post.
 
Old 08-06-2010, 08:41 AM   #9
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,225

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Just distribute your program as statically linked binary. Google for "gcc" and "static linking."

Last edited by dugan; 08-06-2010 at 08:44 AM.
 
Old 08-06-2010, 09:56 AM   #10
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by linuxmandrake View Post
read wje_lq post.
You asked a question about library and compiler usage, and not distribution.

GPL mandates the way code is distributed - if you do not distribute the code containing GPL'ed components, e.g. use at home or at work (but not ship to customers/other companies) you can do with GPL'ed whatever you like:

http://www.gnu.org/licenses/gpl-faq.html ->
http://www.gnu.org/licenses/gpl-faq....alDistribution
.
 
Old 08-06-2010, 08:09 PM   #11
wje_lq
Member
 
Registered: Sep 2007
Location: Mariposa
Distribution: FreeBSD,Debian wheezy
Posts: 811

Rep: Reputation: 179Reputation: 179
Quote:
Originally Posted by Sergei Steshenko View Post
GPL mandates the way code is distributed - if you do not distribute the code containing GPL'ed components, e.g. use at home or at work (but not ship to customers/other companies) you can do with GPL'ed whatever you like
Exactly. But this thread has already visited that point, when I talked about swiping code from libusb:
Quote:
Originally Posted by wje_lq View Post
Of course, if you decide to do that and you distribute your compiled program to others in any way, you'll have to license it under the GPL (with all that this implies), or we'll come after 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
Config for libusb wont run brianZA Red Hat 2 01-03-2007 02:41 AM
compiling/install libusb O(V)eGA_l2el) Fedora 2 05-13-2005 11:19 AM
Compiling a program OK -> how do I run it? dumb_nooby Linux - Newbie 3 11-25-2004 03:24 PM
hpoj and libusb compiling problems jonman364 Linux - Software 1 11-09-2004 04:38 PM
compiling kino, gtk test program cant run vance Linux - Software 1 06-02-2003 04:36 AM

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

All times are GMT -5. The time now is 09:35 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