Using devenv to pass preprocessor variables to Intel Fortran compiler - command-line

I'm using VS 2008 with Intel(R) Fortran Compiler version 10.1.025.
To build my solution I'm using a batch file with the following syntax:
devenv /rebuild "Release|Win32" "c:...\solution.sln" /Project "ProjectName_InTheSolution"
Using the configuration "Release|Win32" I specify, in VS ProjectProperties->Fortran->Proprocessor->Preprocessor Definitions the value "test".
Inside my code I'm testing if the "test" variable is define which is working everything correctly.
Any one know any way to change the "Preprocessor Definitions" of the fortran compiler using the command line ? I want to add also the value "commandLine" so would be "test;commandline" in the "Preprocessor Definitions".
Some notes:
1) I have to use the devenv.exe
2) I don't want to change neither the source code or the project file prior the compilation
3) I can use environment variable to pass option (if there is any way, I try the CL but didn't work)
Thanks in advance
Thanks for your answer but maybe I didn't understand completely your solution, but this is what I tried:
1)I change the "Additional Options" (AO) to /Dtest and:
1.1) If I compile from the Visual Studio or Command Line the check "!DEC$ IF DEFINED (test)" is true
2)I changed the AO to "$(DEFINE)" and:
2.1) From Visual Studio I see warnings: "command line warning #10161: unrecognized source type '$(DEFINE)'; object file assumed ifort " and the check "!DEC$ IF DEFINED (test)" is false
2.2) I add the Define variable to "User environment variables", same error from 2.1
3) I change the AO to "/D$(DEFINE)" I got an error "Bad syntax, '=' expected while processing '#$(define)' fortcom "
4) I change the AO to "$(DEFINE)" and SET DEFINE=/test, and didn't work either, the "!DEC$ IF DEFINED (test)" is false
#cup I think I need to understand a little better your solution, if you please could give me an additional information about your solution would be very appreciated.
What I'm trying to do is this:
program main
integer:: ii
!DEC$ IF DEFINED (test)
ii = 72
!DEC$ ENDIF
!DEC$ IF DEFINED (test2)
ii = 80
!DEC$ ENDIF
print *, "this is up to column ", ii
end
Now I want to control from the command line which part of code will be compiled, doing something like this:
1) from the command line: set define=test
2) devenv elephant.sln /build
3) run debug/elephant.exe -> get "72"
4) from the command line: set define=test2
5) devenv elephant.sln /build
6) run debug/elephant.exe -> get "80"
This is possible ?
Thanks in advance,
rui

Try this
1) Create the following F77 program
program main
integer:: ii
! ,-- column 73
ii = 72 +8
print *, "this is up to column ", ii
end
2) Create a solution for the above program, say elephant.sln
If you just build and run, it should display "this is up to column 72"
3) Pop up project properties, under Fortran/Command Line, add $(DEFINES) in the Additional Options Box.
4) Save and exit
5) set DEFINES=/extend_source:72
6) devenv elephant.sln /build
7) run debug/elephant.exe - you should get 72
8) set DEFINES=/extend_source:80
9) devenv elephant.sln /build
10) run debug/elephant.exe - you should get 80.
11) If you wish to add more /D options, stick it in the DEFINES environment variable.
Basically don't use preprocessor defines - just dump your settings into the DEFINES environment variable and it will be picked up by the Additional Options.

Related

Configure ac code fails to detect libXI presence

I am currently executing the configure script of gtk. It tests for the presence of XInput, and it stops the execution with the error message:"configure: error: *** XInput2 extension not found. Check 'config.log' for more details.
Looking at config.log, it says "configure:23050: error: *** XInput2 extension not found. Check 'config.log' for more details."
So, the same except for the line number.
Then I decided to look at configure.ac. There I found the full Xi detection test that it is:
if $PKG_CONFIG --exists "xi" ; then
X_PACKAGES="$X_PACKAGES xi"
GTK_PACKAGES_FOR_X="$GTK_PACKAGES_FOR_X xi"
AC_CHECK_HEADER(X11/extensions/XInput2.h,
have_xinput2=yes
AC_DEFINE(XINPUT_2, 1, [Define to 1 if XInput 2.0 is available]))
gtk_save_LIBS="$LIBS"
LIBS="$LIBS -lXi"
# Note that we also check that the XIScrollClassInfo struct is defined,
# because at least Ubuntu Oneiric seems to have XIAllowTouchEvents(), but not the XIScrollClassInfo struct.
AC_CHECK_FUNC([XIAllowTouchEvents],
[AC_CHECK_MEMBER([XIScrollClassInfo.number],
have_xinput2_2=yes
AC_DEFINE(XINPUT_2_2, 1, [Define to 1 if XInput 2.2 is available]),
have_xinput2_2=no,
[[#include <X11/extensions/XInput2.h>]])])
LIBS="$gtk_save_LIBS"
if test "x$have_xinput2_2" = "xyes"; then
X_EXTENSIONS="$X_EXTENSIONS XI2.2"
else
X_EXTENSIONS="$X_EXTENSIONS XI2"
fi
fi
AS_IF([test "x$have_xinput2" != "xyes"],
[AC_MSG_ERROR([*** XInput2 extension not found. Check 'config.log' for more details.])])
I am no expert about setting configure.ac, but I thought that this line: "if $PKG_CONFIG --exists "xi" ; then" would be satisfied by this parameter that I pass to configure:
PKG_CONFIG_PATH=:/media/34GB/Arquivos-de-Programas-Linux/xorg/Xi-1.5.0/lib/pkgconfig/
Also this line:
AC_CHECK_HEADER(X11/extensions/XInput2.h,
have_xinput2=yes
AC_DEFINE(XINPUT_2, 1, [Define to 1 if XInput 2.0 is available]))
could not have been satisfied by this parameter that I pass to configure?
CPPFLAGS=-I/media/34GB/Arquivos-de-Programas-Linux/xorg/Xi-1.5.0/include/
I am a bit lost as to why it doesn't detect nothing.
A curious point that I read in the documentation is that there is a parameter called: --disable-xinput.
Well I am passing it to configure and it obviously didn't disable the test. So I would appreciate any suggestions about how to change the test to try to figure out what is wrong with it (or with my system)
Solution found
If I replace:
if $PKG_CONFIG --exists "xi" ; then
on configure.ac, by:
if $PKG_CONFIG --print-errors --exists "xi" ; then
and then execute autoconf, it will generate a new configure based on this "new" configure.ac that will print all the required libraries that should be passed to configure.
First it was the .pc file of libXi, then the pc. file of Inputproto (that I had to download and install) an so on. I also really had to add libXi's include dir to CPPFLAGS, so it could find XInput2.h.
My final configure command was:
LD_LIBRARY_PATH=/media/34GB/Arquivos-de-Programas-Linux/Glib-2.41.2/lib/ CPPFLAGS="-I/media/34GB/Arquivos-de-Programas-Linux/xorg/X11-1.4.4/include/ -I/media/34GB/Arquivos-de-Programas-Linux/xorg/Xorgproto-2018.1/include/ -I/media/34GB/Arquivos-de-Programas-Linux/xorg/Xi-1.5.0/include/" LDFLAGS="-L/media/34GB/Arquivos-de-Programas-Linux/xorg/X11-1.4.4/lib/" ./configure --prefix=/media/34GB/Arquivos-de-Programas-Linux/Gtk+-3.4.0 PKG_CONFIG_PATH=/media/34GB/Arquivos-de-Programas-Linux/Glib-2.41.2/lib/pkgconfig/:/media/34GB/Arquivos-de-Programas-Linux/Atk-2.15.4/lib/pkgconfig/:/media/34GB/Arquivos-de-Programas-Linux/Pango-1.30.0/lib/pkgconfig/:/media/34GB/Arquivos-de-Programas-Linux/Cairo-1.10.0/lib/pkgconfig/:/media/34GB/Arquivos-de-Programas-Linux/Gdk-pixbuf-2.30.0/lib/pkgconfig/:/media/34GB/Arquivos-de-Programas-Linux/Pixman-0.18.4/lib/pkgconfig/:/media/34GB/Arquivos-de-Programas-Linux/Fontconfig-2.8.0/lib/pkgconfig/:/media/34GB/Arquivos-de-Programas-Linux/Freetype-2.2.1/lib/pkgconfig/:/media/34GB/Arquivos-de-Programas-Linux/Png-1.2.14/lib/pkgconfig/:/media/34GB/Arquivos-de-Programas-Linux/xorg/Xi-1.5.0/lib/pkgconfig/:/media/34GB/Arquivos-de-Programas-Linux/xorg/Inputproto-1.5.0/lib/pkgconfig/:/media/34GB/Arquivos-de-Programas-Linux/xorg/X11-1.4.4/lib/pkgconfig/:/media/34GB/Arquivos-de-Programas-Linux/xorg/Xorgproto-2018.1/share/pkgconfig/:/media/34GB/Arquivos-de-Programas-Linux/xorg/Xcb-1.4/lib/pkgconfig/:/media/34GB/Arquivos-de-Programas-Linux/xorg/Pthread-stubs-0.1/lib/pkgconfig/:/media/34GB/Arquivos-de-Programas-Linux/xorg/Xau-1.0.0/lib/pkgconfig/:/media/34GB/Arquivos-de-Programas-Linux/xorg/Xext-1.1.1/lib/pkgconfig/

T24 routine - compilation error - No component defined. $PACKAGE is mandatory?

Below is the sample code
SUBROUTINE HELLO.WORLD
*-----------------------------------------------------------------------------
*
*-----------------------------------------------------------------------------
* Modification History :
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
CRT "HELLO WORLD"
END
Compilation error;
01/01/2019 16:26:03 Compiling HELLO.WORLD... ERROR
Error : (line 12) HELLO.WORLD.b, No component defined. $PACKAGE is mandatory !
Compilation completed for 1 file(s). 1 error
01/01/2019 16:26:03 Compiling HELLO.WORLD... ERROR
Error : (line 12) HELLO.WORLD.b, No component defined. $PACKAGE is mandatory !
Compilation completed for 1 file(s). 1 error
I have setup (during toggle tafj project nature option in design studio);
The TAFJ_HOME correctly.
T24lib directory under "Known Libraries" section.
Java folder : ....\ProjectName-models\java.
Class folder : ....\ProjectName-models\classes.
Thank you
To switch off this check for tCompile, set these properties in tafj.properties:
temn.tafj.compiler.internal.development=false
temn.tafj.compiler.component.strict.mode=false
However, to follow the "best practice way" you should have the $PACKAGE statement, then your JBC code will be compiled into a proper Java Package and put inside a JAR file. Note that before that you should do "New-->T24Component Folder Structure" in T24 Design Studio. This will create the XX.componentname.component file where you can define the subroutines. This "XX.Local.component" has to be compiled first:
component XX.Local
# Component Isolation Definition
metamodelVersion 1.6
# -------------------------------------------------
public method helloWorld ()
{
jBC: HELLO.WORLD
}
Then you can reference the $PACKAGE in the subroutine like this:
$PACKAGE XX.Local
SUBROUTINE HELLO.WORLD
CRT 'Hello, World!'
RETURN
END
The component can also be created manually without Design Studio. You should not use the Dunce Cap (see this: https://en.wikipedia.org/wiki/Dunce) unless you have a good reason.
For R19 Right Click on project navigate to Properties->TAFJ->Compiler->Uncheck Maintain validation code.
Right click on project source folder and click “Put on / Take off the Dunce cap”. Compile again.
It's a subroutine , it needs a RETURN statement

Disable critic for an entire file - Parse::RecDescent precompiled parser & PerlCritic/Tidyall

I'm trying to remove an error from my sanity-checking [when I push code to my git repo, there's a hook that checks the code with perltidy & critic... using tidyall as the handler.]
The specific issue I have is with a pre-compiled Grammar Parser.... and this is not something I want to dive in & fix (sorry - that's outside my comfort zone)
If I add a simple ## no critic to the start of the file, then
perlcritic path/to/class/file.pm
comes back
path/to/class/file.pm source OK
however
tidyall --check-only -r .
comes back with
perlcritic /tmp/Code-TidyAll-Frb0/path/to/class/file.pm failed
exited with 2 - output was:
Unrestricted '## no critic' annotation at line 6, column 1. (Miscellanea::ProhibitUnrestrictedNoCritic, severity 3)
I know I can fix this in the tidyall.ini file:
[PerlCritic lib]
select = **/*.{pm}
ignore = **/class/file.pm
.... however I feel there should be a cleaner solution.
(or, why doesn't tidyall critique the same as critic?)
why doesn't tidyall critique the same as critic?
A simple perlcritic on the command line defaults to severity 5, unless you've configured something different in your ~/.perlcriticrc. The rule ProhibitUnrestrictedNoCritic defaults to severity 3, so your tidyall is running Perl::Critic with at least severity 3. As per its documentation, you can change that via something like this in the tidyall.ini:
[PerlCritic]
argv = -severity 4
And then tidyall's checks should be the same as a perlcritic -4 from the command line. (Unless you've configured custom severity levels in your .perlcriticrc.)
Update: As per your comment, you want to check everything at the "brutal" level. In that case, you can create a perlcriticrc file containing the line [-Miscellanea::ProhibitUnrestrictedNoCritic] which will disable that policy, and then point perlcritic at that file by adding the command-line argument --profile /path/to/custom/perlcriticrc.

%include centos kickstart unable to open input kickstart file

Hi would like to have multiple kickstart files which use a central kickstart file for the bulk of the install and a second file for the small differences. I'm building DVDs for distribution.
The first ks contains small config and has a %include line which points to a common ks file which should do most of the work.
I'm having trouble with %include line.
Fist of all have I understood what %include is for?
Second I think I have the syntax wrong because when I boot I get the following error message:
unable to open input kickstart file: Could not open/read file:///mnt/sysimage/media/dvd/ks/common.cfg
I am installing from a DVD what is the correct path or syntax to the files stored in a sub directory called /ks/ of the DVD's root?
I have tried the following:
%include /mnt/sysimage/media/dvd/ks/common.cfg
%include cdrom:/ks/common.cfg
Does anyone have any working examples?
Thanks in advance for your support
I eventually found part of the answer
%include /mnt/stage2/ks/common.cfg
The dvd is mounted as stage2
However I now get an error message saying it cant read the file
%%include
I can see the file and less it if I hit ctrl + alt + F1
Does anyone have a working simple example of how this should be written?
Open your isolinux/isolinux.cfg from the OS and give the ks file path as below . You can enter your kick start option in boot: prompt of dvd
label 1
kernel vmlinuz
append initrd=initrd.img nofb skipddc lang= devfs=nomount ramdisk_size=8192 ks=cdrom:/option1.cfg 1
label 2
kernel vmlinuz
append initrd=initrd.img nofb skipddc lang= devfs=nomount ramdisk_size=8192 ks=cdrom:/option2 2
label 3
kernel vmlinuz
append initrd=initrd.img nofb skipddc lang= devfs=nomount ramdisk_size=8192 ks=cdrom:/option3.cfg 3
Then edit /isolinux/boot.msg and add the enter the below details
Select installation:
1) option 1
2) option 2
3) option 3

OpenCobol & PostgreSQL on Windows with Visual Studio

I'm currently facing a problem with this team of 4.
Using binaries I downloaded on kiska's site. I'm able to compile cobol to C and run it with cobcrun or compile it to an executable. However I can 't get opencobol to find the postgres commands.
Here is the strat of my cobol script :
identification division.
program-id. pgcob.
data division.
working-storage section.
01 pgconn usage pointer.
01 pgres usage pointer.
01 resptr usage pointer.
01 resstr pic x(80) based.
01 result usage binary-long.
01 answer pic x(80).
procedure division.
display "Before connect:" pgconn end-display
call "PQconnectdb" using
by reference "dbname = postgres" & x"00"
by reference "host = 10.37.180.146" & "00"
returning pgconn
end-call
...
the call PQconnectdb fail with module ont found : PQconnectdb
I noticed that if i rename the libpq.dll the error message change to can't find entry point. So at least I'm sure it can get my dll.
After digging into the code of the call method of the libcob library. I found it it was possible to pre load some dll using an environment variable COB_PRE_LOAD but sitll no results.
Here is what look the script to compile the cobol :
call "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\vcvarsamd64.bat"
set COB_CONFIG_DIR=C:\OpenCobol\config
set COB_COPY_DIR=C:\OpenCobol\Copy
set COB_LIBS=%COB_LIBS% c:\OpenCobol\libpq.lib
set COB_LIBRARY_PATH=C:\OpenCobol\bin
set COB_PRE_LOAD=C:\OpenCobol\libpq.dll
#echo on
cobc -info
cobc -free -o pgcob -L:"C:\OpenCobol" -llibpq.lib test_cobol\postgres.cob
call cobcrun pgcob
I don't see anything missing, I'm using the 64-bit binaries from kiska's site and use the 64-bit cl.exe from Visual Studio, Postgres is a 64 bit version too (checked with dependencyChecker).
I even tryed to compile the generated C from Visual Studio, same result, but I may miss something, I'm pretty rotten in C and never really had to manage DLL or use Visual Studio.
What am I missing ?
COB_PRE_LOAD doesn't take any path or extension, see the short documentation for the available runtime configurations. I guess
set COB_LIBRARY_PATH=C:\OpenCobol\bin;C:\OpenCobol
set COB_PRE_LOAD=libpq
Will work. You can omit the C:\OpenCobol\bin if you did not placed any additional executables there.
If it doesn't work (even if it does) I'd try to get the C functions resolved at compile time. Either use
CALL STATIC "PQconnectdb" using ...
or an appropriate CALL-CONVENTION or leave the program as-is and use
cobc -free -o pgcob -L"C:\OpenCobol" -llibpq -K PQconnectdb test_cobol\postgres.cob
From cobc --help:
-K generate CALL to <entry> as static
In general: the binaries from kiska.net are quite outdated. I highly suggest getting newer ones from the official download site or ideally build them on your own from source, see the documentation for building GnuCOBOL with VisualStudio.