I want to compile a source code but I have trouble in compile.
cc -O2 -Olimit 2000 -g -migrate -assume -Zp1 noaligned_objects ...
cc: error: 2000: No such file or directory
cc: error: noaligned_objects: No such file or directory
cc: error: unrecognized command line option ‘-migrate’
cc: error: unrecognized command line option ‘-assume’
cc: error: unrecognized command line option ‘-Zp1’
Start with compiling it with no system-specific flags (i.e. by using gcc possibly with -I, -L, and -l flags and nothing else). If the program in question is portable enough, then it will be a matter of getting all dependencies available for it.
Once you are able to build it, see if it runs as expected (ignore performance). If it doesn't, that would be a good time to look at the flags you used on DEC to see if it requires any special treatment when building. This is where you either make the program portable or try to get the equivalent behavior using gcc on the target architecture of your choice.
Finally, once the program builds and runs, that would be a good time to see if you want to use any optimization flags (hint: you don't have to. If it runs fine, leave it the way it is).
Related
I'm attempting to build Perl 5.32.1 on an hpia11.31 system and am getting what appear to be failures in regex evaluations. For instance, make_patchnum.pl fails because a regex intended to pull the filename from a heredoc instead returns the entire heredoc as the filename:
./miniperl -Ilib make_patchnum.pl
Failed to open for write './lib/Config_git.pl' is generated by make_patchnum.pl
# DO NOT EDIT DIRECTLY - edit make_patchnum.pl instead
######################################################################
$Config::Git_Data=<<'ENDOFGIT';
git_commit_id=''
git_describe=''
git_branch=''
git_uncommitted_changes=''
git_commit_id_title='':File name too long at make_patchnum.pl line 84.
Manually getting past that, configpm exhibits the same issue: regex evaluations to extract variable headers fail in 5.32.1 where they succeed in 5.28.1. Example:
Expected a Configure variable header, instead we got:
_exe (Unix.U):
This variable defines the extension used for executable files.
DJGPP, Cygwin and OS/2 use '.exe'. Stratus VOS uses '.pm'.
On operating systems which do not require a specific extension
for executable files, this variable is empty.
I assume this is using the regexec.c built earlier in the build process, although I don't know that for certain. Tne regexec.c build reports some warnings, but they seem in line with warnings reported against 5.28.1: I don't see anything here that suggests it doesn't work.
Here's the build command for regexec.c:
cc -c -DPERL_CORE -D_POSIX_C_SOURCE=199506L -D_REENTRANT \
-Ae -Wp,-H150000 -D_HPUX_SOURCE -Wl,+vnocompatwarnings +DD64 \
-D_INCLUDE__STDC_A1_SOURCE -I/usr/local/include -D_LARGEFILE_SOURCE \
-D_FILE_OFFSET_BITS=64 +O2 +Onolimit regexec.c
Any ideas why the regex parser might behave differently on HP-UX from other platforms? I've successfully built 5.32.1 for x86 Linux, plinux, zlinux, rs6000, and Solaris, so this seems specific to HP-UX.
EDIT: compiler info
bash-4.0$ /opt/aCC/bin/cc --version
cc: HP C/aC++ B3910B A.06.20 [May 13 2008]
Which compiler is your cc?
You require the ANSI-C compiler to be able to build perl on HP-UX
$ cc --version
cc: HP C/aC++ B3910B A.06.28.02 [Mar 09 2016]
$ cc -V
cc: HP C/aC++ B3910B A.06.28.02 [Mar 09 2016]
I'm trying to compile Valgring3.16.1 with aarch64-linux-gnu-gcc (for xilinx zynq-mp board)
the ./configure stage passed ok.
when I run:
make CC= ..... /bin/aarch64-linux-gnu-gcc
I got this error:
aarch64-linux-gnu-gcc: error: unrecognized command line option '-m64'
How can I fix it?
any help will be appreciated,
Tzipi Kluska
If you need to change compiler or flags, you should do that when you run configure, not when you run make. Otherwise configure sees and detects a different environment than what you get with make.
The docs have the answer you ask for.
-m64 is available for other architectures than AArch64.
If you need the "Machine-Dependent Options" you should read AArch64 options.
I am trying to compile arduino code under codeblocks with avr-gnu compiler. I was getting this error:
avr-ld.exe unrecognized emulation mode: mcu=atmega328p.
Supported emulations:avr2 avr1 avr25 avr3 avr31 avr35 avr4 avr5 avr51 avr6 avrxmega1 avrxmega2 avrxmega3 avrxmega4 avrxmega5 avrxmega6 avrxmega7 avrtiny
I found this page: https://gcc.gnu.org/onlinedocs/gcc/AVR-Options.html which suggests that it should be linked under avr5 sim mode, so I added -mmcu=avr5 to linker options. Now I am getting:
avr-ld.exe unrecognized emulation mode: mcu=avr5
Supported emulations:avr2 avr1 avr25 avr3 avr31 avr35 avr4 avr5 avr51 avr6 avrxmega1 avrxmega2 avrxmega3 avrxmega4 avrxmega5 avrxmega6 avrxmega7 avrtiny
How is avr5 unrecognized if it is supported?o0
I tried few different toolchains from few different years but it seems that linker cant interpret this emulation mode correctly. Newer toolchains had support for 328p but still somehow dont work. I also tried creating CodeBlocks project dedicated for Arduino but the difference is that it passes -mmcu=atmega328p itself and still doesnt work on this or newer toolchains.
Update:
There is something that I am totally missing here. I changed linker to a standard x86 32 ld.exe from Mingw and passed -mmcu=i386pe and I am getting the similar error:
ld.exe unrecognized emulation mode: mcu=i386pe
Supported emulations:i386pe
So this only leads to my lack of understanding of mechanisms how the linker emulation mode is selected/configured.
In almost any case, you do not want to call the linker (ld resp. avr-ld) by hand!
Use avr-gcc to link your programs!
Notice that avr-gcc is not a compiler by itself, it's just a driver program that calls sub-programs like compiler proper (cc1 for C, cc1plus for C++, lto1 for LTO-compiled byte-code), assembler and linker depending on command-line options and input files provided on the command line.
avr-gcc knows how to provide the respective tools with appropriate command line options like: emulation, libraries, paths for includes and libraries, startup-code, sub-options, etc.
In order to see which tools are called by avr-gcc, add the -v option. For example, for a compile command as simple as
> avr-gcc -v main.c -mmcu=atmega328p -save-temps
You'll see somethinh like (here for avr-gcc v8.5.0):
...
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-specs=device-specs/specs-atmega328p' '-mmcu=avr5'
$AVRGCC_HOME/bin/../libexec/gcc/avr/8.5.0/collect2 <many options> -plugin-opt=-pass-through=-latmega328p -mavr5 -Tdata 0x800100 $AVRGCC_HOME/bin/../lib/gcc/avr/8.5.0/../../../../avr/lib/avr5/crtatmega328p.o -L$AVRGCC_HOME/bin/../lib/gcc/avr/8.5.0/avr5 -L$AVRGCC_HOME/bin/../lib/gcc/avr/8.5.0/../../../../avr/lib/avr5 -L$AVRGCC_HOME/bin/../lib/gcc/avr/8.5.0 -L$AVRGCC_HOME/bin/../lib/gcc -L$AVRGCC_HOME/bin/../lib/gcc/avr/8.5.0/../../../../avr/lib main.o --start-group -lgcc -lm -lc -latmega328p --end-group
collect2 is just some other tool that wraps the call to ld. If you want to see the real thing, use avr-gcc ... -v -Wl,-v.
The correct emulation for the linker is worked out by the device-specific spec file device-specs/specs-atmega328p located at ./lib/gcc/avr/$version in the compiler's install directory. The specs "language" is a means to describe option mappings; in particular the bits that are responsible for mapping `-mmcu=atmega328p' to the right emulation are
*link_arch:
%{mmcu=*:-m%*}
...
*self_spec:
%{!mmcu=avr*: %<mmcu=* -mmcu=avr5} %<mshort-calls %<msp8
self_spec removes -mmcu=* from the command line and sets -mmcu=avr5 which is the core family ATmega328P belongs to. Then as part of the linker invocation, link_arch maps -mmcu=avr5 to -mavr5 which is the linker emulation to be used.
Perhaps a very trivial question:
I need to compile a program as 64-bit (earlier makefile written to compile it as 32-bit).
I saw the option -m32 appearing in command line parameters with each file compilation. So, I modified the makefile to get rid of -m32 in OPTFLAG, but again when the program compiles, I still see -m32 showing up and binaries are still 32-bit. Does this m32 come from somewhere else as well?
-m32 can only be coming from somewhere in your makefiles, you'll have to track it down (use a recursive grep) and remove it.
When I am able to force -m64, I get "CPU you selected does not support x86-64 instruction set".Any clues?. uname -a gives x86_64
That error means there is an option like -march=i686 in the makefiles, which is not valid for 64-bit compilation, try removing that too.
If you can't remove it (try harder!) then adding -march=x86-64 after it on the command line will specify a generic 64-bit CPU type.
If the software you are trying to build is autotools-based, this should do the trick:
./configure "CFLAGS=-m64" "CXXFLAGS=-m64" "LDFLAGS=-m64" && make
Or, for just a plain Makefile:
env CFLAGS=-m64 CXXFLAGS=-m64 LDFLAGS=-m64 make
If you are using CMake, you can add m64 compile options by this:
add_compile_options(-m64)
I am trying to compile a rather large project with Borland C++ Builder 5.5. The project compiles in the IDE, but is much too slow. However, when I compile with the command line I get an ambiguity error that was not present in the IDE:
Error E2015 Project.h 536: Ambiguity between 'TTreeNode' and 'Comctrls::TTreeNode'
My command line arguments are as follows:
d:\PROGRA~1\Borland\CBUILD~1\bin..\BIN\bcc32 -Od -Vx -Ve -X- -r- -a8 -5 -b- -d -k -vi -c -tW -tWM -w-par -I[really big list of include files] -nQ:\output [really big list of files to compile]
This command is generated by make.exe.
I believe the problem lies in the fact the command line compiler and the IDE compiler are different. The command line appears to be more strict about ambiguity whereas the IDE flags it only as a warning. In light of this, I guess some projects simply can't be built with the command line tools even if they build in the IDE.