I'm new to linux....questions compiling a small source code
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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++.-:-
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?
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 !!!
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?
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.