I am a newbie in GCC and Linux. I have been using Visual Studio for almost all course projects, so when switching to GCC and Linux, I feel so suffering, especially when compiling some projects and it complains for some errors.
I think I should do something to get rid of this annoying situation. But I don't know how to get some materials, maybe on linkers, on GCC flags, on libraries, could somebody kind enough pointing out what should I study or pay attention?
Thank you very much
GCC user manual has to be your first reference..and you can get its online/pdf versions here..
There is lots of online documentation for the GNU tools:
Online GCC documentation
Online LD documentation
Online GLIBC documentation
Linux manpages and infopages are one of the most important resources, and one of the most confusing for Windows users (SCNR: because it is fairly good, complete and useful documentation that comes for free and pre-installed on the system). You can reach them via the command-line man and info commands combined with the program, e.g.
man gcc
man fopen
info gcc
Sometimes, you need to install an extra -doc package for the man or the info pages. The gcc manual, for example, is available as an info page.
The second thing you need to learn is to look at the documentation of the right tool. Visual Studio performed the jobs of at least a dozen UNIX programs, so read the motivation section of the documentation and try to understand what program does what job. That is: You usually need an editor (vim), a compiler (gcc), a linker (ld), and archive indexer (ranlib) and a debugger (gdb) in your toolchain under Linux, even though you needn't call all of these by hand.
In addition, you should know about the autotools (autoconf and automake) and libtool because they make your job a lot easier.
I'm not sure to understand what is painful for you. Is it the understanding of Linux system libraries, or is it just that it is painful to develop software on Linux, because you didn't caught how experimented Linux developers work, on a day by day or even minute by minute basis?
Related
In this documentation HP Fortran doc, the OPEN statement accept SHARED and READONLY options.
In this documentation Standard Fortran 2008 doc, the OPEN statement dosn't accept SHARED or READONLY options.
Since I'm using gfortran comes with gcc 4.4.7 to compile a Fortran source file on Linux,I used a ruse to get around half the problem. I used
OPEN(...,ACTION=READ,...) instead of READONLY.
But can't find an other ruse (:)) to replace SHARED Option. (Like Something=Shared).
Anyone have a ruse to get arround that?
Those IO extensions (SHARED, READONLY, etc) as well as other extensions, as would be available with DEC based Fortran should be available in GCC/gFortran via the "-fdec" and related compiler switches.
However, I found some confusion in the online GCC docs. Apparently, some older versions of gFortran (and in particular g77) may require the compiler to have been built with the libf2c element, and there may be differences on Unix (c.f. Win etc).
It is not clear exactly which versions of gFortran accept this. For example, under Windows, with GCC/gFortran 6.x, it would not recognise the "-fdec" switch.
Apparently, GCC/gFortran v7.x have all that working, but v7 is still in "development mode" ... are you feeling lucky :-) ?
Also, some references give dire warnings about reliance on "extensions".
Here are some pages of interest:
https://gcc.gnu.org/wiki/GFortran/News
https://gcc.gnu.org/onlinedocs/gfortran/Extended-I_002fO-specifiers.html
https://gcc.gnu.org/onlinedocs/gfortran/Option-Summary.html
https://gcc.gnu.org/onlinedocs/gfortran/Fortran-Dialect-Options.html
The last link seems particularly "dire" on the subject.
Hoping for a bit of insight here. I have source code for one of our projects, with no documentation on how to compile, and all people who wrote it having left :) We have an issue in it and lucky moi has been tasked to investigate.
Currently I'm trying to build on AIX, the makefile keeps on complaining with either
make: 1254-055 Dependency line needs colon or double colon operator.
or
make: 1254-057 Shell command needs a leading tab.
The CPP options seem to be xlc options, and the software has been compiled many times before. The makefile contains control characters from windows in it and does have tabs against some of the entries but not all the shell commands.
Any thoughts on what could be the issue running make on the code? I haven't installed GNU make as of yet, could this solve the issues?
Classic SysV make is much more picky about formatting than gnumake is, never mind the feature set is much more restricted. I don't even bother writing "classic" compatible Makefiles anymore - too painful.
Even though we use the native compilers (xlc) on AIX, we still use gmake as our dependency/build tool.
I recommend installing a managed copy of gmake, downloadable from a couple sources:
Direct from IBM thru the AIX/Linux toolbox.
As an RPM from here.
From Bull here.
As lpp packages from pware here.
Good luck!
I think you might need to use gmake even on AIX. The original make may not be working as expected. The Windows control character may or may not matter (usually does not), but can be edited out on vi.
With C++ sources, in my company :
On AIX, we use make (and xlC_r compiler).
On AS400, we use gmake (and ixlc compiler). Because make exists, but is PASE only.
gmake was certainly found on some old website... there are many other GNU programs on our iSeries. I haven't found any trace of it beside the PGM.
I was wondering is there a free Windows version of GCC.
I know there is minigw and something else but I don't know how to use them.
Sorry if this should be on SU.
The main choices are either MinGW or CygWin.
CygWin is a more complete UNIX-like environment than MinGW as it offers quite a lot of tools over and above development stuff. Even to the point of a full X-Windows server so you can develop software that'll run on both UNIX-like systems and Windows.
The installer is good but I would suggest installing everything even if you think you don't need it. Disk space is cheap and I've had problems in the past trying to get stuff going on partial installs (whether 1.7, or even earlier, fixes this, I don't know - I always do full installs).
However, it relies on the CygWin UNIX emulation DLL which, if I remember rightly, has restrictions for non-free software.
MinGW is more concentrated on the development tools. It generates native Windows applications rather than running under a emulation DLL like CygWin.
It used to be difficult to install with having to do MinGW, MSYS and others separately but it's come a long since then and has an easy graphical installer.
I believe it can do graphical applications using native Windows calls rather than via X-Windows, since it just links to the normal Windows runtimes.
If you want to know how to use either of them, you really have to look through the docs found at those links I provided - check the Documentation link on the left for MinGW (particularly Getting started) or the CygWin FAQ.
As for GUIs for development, I've never used one for CygWin - I'm old enough that I remember mark sense cards so I'm not scared of the command line interface :-).
I used Eclipse with CDT running over MinGW and wasn't that impressed although admittedly that was an early version. Don't get me wrong Eclipse is a brilliant tool and we use it for both Java and Linux/C development, I just had a lot of troubles with Eclipse/CDT under Windows.
Code::Blocks, on the other hand, was absolutely brilliant but you should check them all out to see which one suits you best. As I said, the last time I looked was about five years ago, an eternity in the IT world.
I am a bit late, but since the question may still arise...
gcc for Windows (including Ada, C, C++ and Fortran compilers) can be obtained from MinGW-builds on SourceForge: http://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/
As of august 2013, there are 32 and 64 bits versions of gcc-4.8.1.
I am a complete newbie to the ARM world. I need to be able to write C code, compile it, and then download into an ARM emulator, and execute. I need to use the GCC 4.1.2 compiler for the C code compilation.
Can anybody point me in the correct directions for the following issues?
What tool chain to use?
What emulator to use?
Are there tutorials or guides on setting up the tool chain?
building a gcc cross compiler yourself is pretty easy. the gcc library and the C library and other things not so much, an embedded library and such a little harder. Depends on how embedded you want to get. I have little use for gcclib or a c library so roll your own works great for me.
After many years of doing this, perhaps it is an age thing, I now just go get the code sourcery tools. the lite version works great. yagarto, devkitarm, winarm or something like that (the site with a zillion examples) all work fine. emdebian also has a good pre-built toolchain. a number of these places if not all have info on how they built their toolchains from gnu sources.
You asked about gcc, but bear in mind that llvm is a strong competitor, and as far as cross compiling goes, since it always cross compiles, it is a far easier cross compiler to download and build and get working than gcc. the recent version is now producing code (for arm) that competes with gcc for performance. gcc is in no way a leader in performance, other compilers I have used run circles around it, but it has been improving with each release (well the 3.x versions sometimes produce better code than the 4.x versions, but you need 4.x for the newer cores and thumb2). even if you go with gcc, try the stable release of llvm from time to time.
qemu is a good emulator, depending on what you are doing the gba emulator virtual gameboy advance is good. There are a couple of nds emulators too. GDB and other places have what appear to be ARMs own armulator. I found it hard to extract and use, so I wrote my own, but being lazy only implemented the thumb instruction set, I called mine the thumbulator. easy to use. Far easier than qemu and armulator to add peripherals to and watch and debug your code. ymmv.
Hmmm I posted a similar answer for someone recently. Google: arm verilog and at umich you will find a file isc.tgz in which is an arm10 behavioural (as in you cannot make a chip from it therefore you can find verilog on the net) model. Which for someone wanting to learn an instruction set, watching your code execute at the gate level is about as good as it gets. Be careful, like a drug, you can get addicted then have a hard time when you go back to silicon where you have relatively zero visibility into your code while it is executing. Somewhere in stackoverflow I posted the steps involved to get that arm10 model and another file or two to turn it into an arm emulator using icarus verilog. gtkwave is a good and free tool for examining the wave (vcd) files.
Above all else you will need the ARM ARM. (The ARM Architectural Reference Manual). Just google it and find it on ARM's web site. There is pseudo code for each instruction teaching you what they do. Use the thumbulator or armulator or others if you need to understand more (mame has an arm core in it too). I make no guarantees that the thumbulator is 100% debugged or accurate, I took some common programs and compared their output to silicon both arm and non-arm to debug the core.
Toolchain you can use Yagarto http://www.yagarto.de/
Emulator you can use Proteus ISIS http://www.labcenter.com/index.cfm
(There is a demo version)
and tutorials, well, google them =)
Good luck!
Is there a version of GNU Make, or GNU Make compatible application, which supports distributed builds on Win32?
We currently have a large project using gnu makefiles. We use the Win32 version of GMake to build. Our build environment supports parallel builds without a problem, and we'd like to try and perform a distributed build if possible.
Any ideas?
distcc is the grand-father of doing this, though I'm not sure it would be easy to get running on win32. cygwin might make this possible.
I'd try Cygwin but the performance might be poor because of the emulation layer.
I hope I've understood Your problem properely, but
You can use:
Cygwin
or
mingw
MinGw is a complete port of GNU binutils for windows.
ElectricAccelerator from Electric Cloud does exactly this. It's a parallel, distributed replacement for gmake and nmake. If your build problem is bad enough and you have some budget to spend on a solution, you should check it out:
ElectricAccelerator home page
Disclaimer: I'm the tech lead for the Accelerator team at Electric Cloud.