LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-20-2015, 10:18 PM   #1
vavventuri
LQ Newbie
 
Registered: Mar 2015
Posts: 2

Rep: Reputation: Disabled
I'm new to linux....questions compiling a small source code


Hi Everybody.....
I'm new to this site and new to Linux ( Ubuntu 12.04) generally. I am an old goat mechanical engineer with years of electronic instrumentation design experience. I am connecting several of my old HP digital oscilloscopes and logic analyzers to a Ubuntu box via GPIB (ieee 488) interface. I have the interface working well using the open source ( Sourceforge) "Linux-GPIB" kernel module. I can remotely control the instruments using "Linux-GPIB"'s "ibterm" terminal utility. However "ibterm" doesn't provide a means to do a scope screen dump to a file. A guy on EEBLOG published a short C language 30 line source code to perfome this function. Unfortunately it isn't a package with makefile.am, makefile .in, configure etc which I understand I could compile using the typical ./config, make, checkinstall procedure. It is just the c source code text. Soooo.....do I use gcc directly? If so, how do I run gcc in a manner to be able to uninstall all the various files it will make? Or ?? What is the procedure for automake in this situation ? Or....? I'm kind of lost. Your suggestions would be helpful.
Cheers.
Alan Jacobs
Green Bay, Wisconsin USA
 
Old 03-20-2015, 11:06 PM   #2
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware
Posts: 6,827
Blog Entries: 7

Rep: Reputation: Disabled
Hi & Welcome to Linux Questions!

Quote:
how do I run gcc in a manner to be able to uninstall all the various files it will make
I'm not sure how you would do that because GCC looks in several different places for headers.
And since it doesn't have a make file I think that you would have to make one. (not my area of expertise)
http://www.cs.swarthmore.edu/~newhal...makefiles.html

-:-I think your going to need an experienced member very good with GCC and C++.-:-

http://commandlinefanatic.com/cgi-bi...article=art026

Autoconfig and Automake
http://mij.oltrelinux.com/devel/autoconf-automake/
 
Old 03-20-2015, 11:11 PM   #3
manu-tm
Member
 
Registered: May 2008
Location: France
Distribution: Ubuntu, Debian
Posts: 343

Rep: Reputation: 43
Without seeing/knowing more about the code, it's difficult to say. Anyways, if it's only 30 lines of C in one source file, you could just use gcc directly. The most basic form is:
Code:
gcc -o BINARY SOURCE_FILE.c
(Although you'll *very likely* need to provide more options.)

Makefiles and autotools stuff is useful with bigger projects, probably not for 30 lines of code , IMO. Anyways, isn't there more info on the blog you mentioned?

And why do you think one source file will produce many binaries?

Last edited by manu-tm; 03-20-2015 at 11:43 PM.
 
Old 03-21-2015, 01:21 AM   #4
vavventuri
LQ Newbie
 
Registered: Mar 2015
Posts: 2

Original Poster
Rep: Reputation: Disabled
thank you

Thank you both Ztcoracat and manu-tm. Here is the original thread on the EEVBlog forum where a guy named EVLab poses the question how to dump a screen image from a Tektronix oscilloscope to a file via GPIB. Here is the link: [URL="http://www.eevblog.com/forum/testgear/tek-tds-hardcopy-gpib-c/"]. Interestingly, he himself found the answer to his own question....and wrote the C code....posted the code but no instructions how to compile it. His code and a sample oscilloscope screen dump from his Tektronix is toward the bottom of the thread.

manu-tm: I think I will just try gcc. Since I am relatively new to the Linux file structure I don't have a good feel for why various files are placed in / lib or /sbin or /bin or /etc or ???? I assumed the few includes and dependencies might propigate files to variety of places.....I'm showing my ignorance. At least crashing an OS isn't like arcing a 480V test probe !!!

Thanks much guys.
 
Old 03-21-2015, 09:59 AM   #5
manu-tm
Member
 
Registered: May 2008
Location: France
Distribution: Ubuntu, Debian
Posts: 343

Rep: Reputation: 43
From the link you provided, it should be something like:
Code:
gcc -Wall -Wextra -o hardcopy-gen hardcopy-gen.c -I<GPIB header files dir> -l<GBIP lib exact name>
These flags enable many useful compile warnings:
Code:
-Wall -Wextra
And this is how gcc locates required header files and libraries:
Code:
-I<GPIB header files dir> -l<GBIP lib exact name>
But I really can't say more because I know about nothing about GPIB or how it is installed on your box. Wasn't there some documentation installed along?

Anyways, you can first try:
Code:
gcc -Wall -Wextra -o hardcopy-gen hardcopy-gen.c
and see what you get.

Last edited by manu-tm; 03-21-2015 at 10:08 AM.
 
Old 03-21-2015, 01:25 PM   #6
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Posts: 4,493

Rep: Reputation: 636Reputation: 636Reputation: 636Reputation: 636Reputation: 636Reputation: 636
The URL you provide only takes me to a general page on that web site. Searching for "tek tds hardcopy" doesn't produce a source file.

Since the source is only 30 lines can you post it here? (Use code tags)

Basically you can follow manu-tm's guidelines. If you see compile errors (most likely non defined functions) try to locate in which library those functions are defined, and include that library on the command line.

About uninstalling etc: gcc will produce one executable. You can put that executable wherever you want, even in your home dir. Call it with /home/yourname/application_name. Gcc does not put files anywhere, it just puts the executable where you say it should put it. The current dir by default. You can move the executable to any other place to use it system wide, like /opt or /usr/local/bin

Generally executable files are placed in /bin. Files only for use by root are placed in /sbin. Distros might differ on this. Your own files in /usr/bin or /usr/local/bin. /etc is used for configuration files. /lib and /usr/lib for system libraries and third party libraries. Google knows some documents which describe the standard Linux directory structure. But that is not required to know for what you are doing now, just nice to read.

jlinkels
 
  


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
[SOLVED] error with “pmem.c” compiling linux source code for android preetb123 Linux - Mobile 2 03-20-2011 06:40 PM


All times are GMT -5. The time now is 04:48 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration