Giter VIP home page Giter VIP logo

Comments (12)

urbanjost avatar urbanjost commented on June 11, 2024

Explicitly using the "F" value on the definition is correct, but actually using it on the command line is not doing what you expect; it should be left off on the command line; but that is not the problem. I cannot reproduce the behavior so far.

Something seems messed up in the dictionary, so I would normally ask you to run "./test .... -usage", but it looks like the -usage switch might not work either; so can you run this program instead?

 program show
use M_CLI2, only : set_args, lget, rget, sget, igets
use M_CLI2, only : print_dictionary
use M_CLI2, only : args, remaining, unnamed 

implicit none
   call set_args('-l F')
   print *, "lget", lget('l')
   call print_dictionary('Dictionary')
   print *,'ARGS'
   write(*,"('[',a,']')")args
   print *,'REMAINING'
   write(*,"('[',a,']')")remaining
   print *,'UNNAMED'
   write(*,"('[',a,']')")unnamed
end program show

Are you using the latest version of M_CLI2 or a specific version? (ie. is there a tag in the fpm.toml file for M_CLI2, assuming you are building via fpm?)

Had you used M_CLI2 on BSD before? I hope a recent change did not break something.
I meant to just make a "trivial" change to the code style, as I tend to almost always use ".eq.,.lt.,...." and wanted to change it to "==, <, ..."; still passed my QA and the CD/CI tests that are automatically triggered by a "git push" but I do not have a BSD platform in the list (maybe there is one available now); and do not have up on my own machine right now.

from m_cli2.

semarie avatar semarie commented on June 11, 2024

I am using M_CLI2 ea6bbff (it is the wanted version for building fpm 0.7.0).

My original problem was to build fpm on x86, so I don't have fpm to build M_CLI2. I am using M_CLI2/src/Makefile to build the test program (I added it with examples).

It is the first time that M_CLI2 is tried. I don't know if previous version was working or not. It could also been a compiler codegen bug, as we don't have so many compiled fortran programs in OpenBSD).

My original problem is we (at OpenBSD) recently ported fpm to ports infrastructure (packaged third parties programs). I did the work on x86_64, and once commited, it is also build on others architectures. But while building on x86, it failed, and it looks like that arguments were corrupted (below, it is an extract of build log, I simplified it a bit):

# build the bootstrap (stage0)
cd /pobj/fpm-0.7.0/build-i386/stage0
/usr/bin/env FPM_FC="gfortran"  FPM_FFLAGS="-O2 "  FPM_CC="cc"  FPM_CFLAGS="-O2 -pipe  "  FPM_CXX="c++"
FPM_CXXFLAGS="-O2 -pipe  "  FPM_LDFLAGS=""  gfortran -O2  -o "/pobj/fpm-0.7.0/build-i386/stage0/fpm" "/pobj/fpm-0.7.0/fpm-0.7.0.F90"

# build fpm (stage1) using the bootstrap (stage0)
cd /pobj/fpm-0.7.0/fpm-0.7.0
/usr/bin/env FPM_FC="gfortran"  FPM_FFLAGS="-O2 "  FPM_CC="cc"  FPM_CFLAGS="-O2 -pipe  "  FPM_CXX="c++"  FPM_CXXFLAGS="-O2 -pipe  "  FPM_LDFLAGS="" "/pobj/fpm-0.7.0/build-i386/stage0/fpm" build  --profile release  --verbose
*get_anyarray_l* bad logical expression for verbose=RELEASE
*get_anyarray_l* bad logical expression for list=RELEASE
*get_anyarray_l* bad logical expression for show-model=RELEASE
*get_anyarray_l* bad logical expression for tests=RELEASE
*get_anyarray_l* bad logical expression for no-prune=RELEASE
[Error] Failed to change directory to 'release'
STOP 1
*** Error 1 in devel/fpm (Makefile:78 'do-build')

So I tried to reduce the problem to simpler reproducer.

With your program, I have the following output:

$ ./test .... -usage
 lget T
Dictionary
KEYWORD  SHORT PRESENT VALUE
version        F        [F    F]
usage          T        []

UNNAMED
000001[....  ]
 ARGS
[
 REMAINING
[]
 UNNAMED
[....  ]

from m_cli2.

urbanjost avatar urbanjost commented on June 11, 2024

That gives a hint; makes me want to look at the procedures that preprocess the command line for subcommands and response files and nulls versus spaces in strings. I tried a CD/CI setup for github for OpenBSD but it did not work right, currently do not have enough room to a full install of OpenBSD so will probably have to boot off a stick to get a nice test
environment. The output should have looked like this, so short names are wrong, strings have duplicates, etc. That version of M_CLI2 has been around for a while on a lot of platforms, so a bit surprised so far. Looking at your compiler options as well, as those are different than any particular build I did. Thanks for all the details, that helps a lot; but unless I get lucky I probably need to stand up an OS (it is on my short list anyway). It would be useful to know if you use a standalone build like

wget https://raw.githubusercontent.com/urbanjost/index/main/bootstrap/fpm.F90
gfortran fpm.F90 -o fpm_test

that would eliminate a few variables. Great to see fpm being added to the bundle.

 lget . KEYWORD  SHORT PRESENT VALUE
version     v  F        [F]
verbose     V  F        [F]
usage       u  F        [F]
l           l  F        [F]
help        h  F        [F]

UNNAMED
000001[...]
 ARGS
[
 REMAINING
[]
 UNNAMED
[...]

from m_cli2.

semarie avatar semarie commented on June 11, 2024

I am unsure that github supports OpenBSD as CD/CI.

Regarding installing OpenBSD for testing, it should be relatively simple under qemu, with some tricks:

  • use i386 (it failed on this architecture, but run fine under amd64)
    • i386 architecture is x86 under Linux, and amd64 is x86_64
  • once base system installed, install a package for get gfortran
    • as root: pkg_add g95%8
    • it will install gfortran 8.4.0 (package named g95, the %8 is for selectionning 8 serie without asking)
    • please note that the binary is named egfortran (as all gcc stuff from packages is prefixed with e)
  • optionally, if you want some development tools: pkg_add git gmake wget

The standalone build, built fine but run badly... (it is somehow what the port was doing):

$ ftp -o fpm.F90 'https://raw.githubusercontent.com/urbanjost/index/main/bootstrap/fpm.F90'
Requesting https://raw.githubusercontent.com/urbanjost/index/main/bootstrap/fpm.F90
100% |*********************************************************************************************|   966 KB    00:01    
989750 bytes received in 1.54 seconds (625.70 KB/s)
$ egfortran fpm.F90 -o fpm_test
$ ./fpm_test                                                                                             
*get_anyarray_l* expected one value found 3
$ ./fpm_test -h   

 build [--compiler COMPILER_NAME] [--profile PROF] [--flag FFLAGS] [--list]
       [--tests] [--no-prune]
 help [NAME(s)]
 new NAME [[--lib|--src] [--app] [--test] [--example]]|
          [--full|--bare][--backfill]
 update [NAME(s)] [--fetch-only] [--clean] [--verbose]
 list [--list]
 run  [[--target] NAME(s) [--example] [--profile PROF] [--flag FFLAGS] [--all]
      [--runner "CMD"] [--compiler COMPILER_NAME] [--list] [-- ARGS]
 test [[--target] NAME(s)] [--profile PROF] [--flag FFLAGS] [--runner "CMD"]
      [--list] [--compiler COMPILER_NAME] [-- ARGS]
 install [--profile PROF] [--flag FFLAGS] [--no-rebuild] [--prefix PATH]
         [options]
 clean [--skip] [--all]

$ git clone https://github.com/urbanjost/M_CLI2                                             
Cloning into 'M_CLI2'...
remote: Enumerating objects: 7382, done.
remote: Counting objects: 100% (520/520), done.
remote: Compressing objects: 100% (314/314), done.
remote: Total 7382 (delta 331), reused 330 (delta 196), pack-reused 6862
Receiving objects: 100% (7382/7382), 29.16 MiB | 709.00 KiB/s, done.
Resolving deltas: 100% (3831/3831), done.
Updating files: 100% (1363/1363), done.
$ cd M_CLI2
$ ../fpm_test build                                                                               
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="GFORTRAN"
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* expected one value found 26
$ ../fpm_test build --compiler egfortran
*get_anyarray_l* bad logical expression for verbose=EGFORTRAN
*get_anyarray_l* bad logical expression for list=EGFORTRAN
*get_anyarray_l* bad logical expression for show-model=EGFORTRAN
*get_anyarray_l* bad logical expression for tests=EGFORTRAN
*get_anyarray_l* bad logical expression for no-prune=EGFORTRAN
[Error] Failed to change directory to 'egfortran'
STOP 1
$ FPM_FC=egfortran ../fpm_test build                     
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="EGFORTRAN"
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* bad logical expression for verbose="
*get_anyarray_l* expected one value found 26
$

from m_cli2.

urbanjost avatar urbanjost commented on June 11, 2024

Long story, but finally have a machine up and running and can reproduce the problem. Due to time constraints will probably not till tomorrow that I get a good look at it; but plan to have a workaround soon; in a clone; and then push a PR and get gfortran bugzilla report in, I suspect.

from m_cli2.

urbanjost avatar urbanjost commented on June 11, 2024

there is a line that says "maxtry=int(log....". It should be NINT(), not INT(). Makes a difference when 32-bit instead of 64-bit

from m_cli2.

urbanjost avatar urbanjost commented on June 11, 2024

I updated the github project M_CLI2 and put in a Pull Request for fpm to change the fpm.toml file to use the new version of M_CLI2, and it passed the built-in CD/CI tests; and has passed all the basic tests in my OpenBSD instance. Thanks for the help on qemu. I updated that one line on the bootstrap version from my ID; the bleeding-edge single-file on the fpm site should be updated too although I have not tested it yet (will soon). So not sure how long it will be to be in a released version of fpm, as it has to be reviewed and approved, etc. But you should be able to build from my clone or the bootstrap version to test it out.

from m_cli2.

semarie avatar semarie commented on June 11, 2024

I confirm that the fix work. Thanks for your work to find the problem.
I have backported it to the port of fpm in order to have a working fpm on all OpenBSD platforms.

from m_cli2.

urbanjost avatar urbanjost commented on June 11, 2024

Great. Note that there seems to be a problem with the NINT()
intrinsic on the i386 platform that has been discussed and
reported in gfortran ...

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107716

https://groups.google.com/g/comp.lang.fortran/c/cz2mml9WW7w

That a good number of packages build, such as from this site ...

Passed

 M_CLI2        M_color       M_list        M_time
 M_calculator  M_display     M_sort        M_uuid
 M_change      M_history     M_strings     orderpack

but getting

Program received signal SIGABRT: Process abort signal.

from several packages (mine and others). Three that produce
that on this site

 M_draw
 M_intrinsics
 fpm-search

This could be something as simple as my test platform does not
have much memory; still looking.

And not passing tests in several others that may be bugs in
the code on i386 platforms but might be additional compiler/system
issues.

And that a patching PR is in for fpm.

Will try to follow up on other packages and let you know if there is any change to fpm(1) itself that results. Odd that M_intrinsics does not build, but using the single-file build of

https://raw.githubusercontent.com/urbanjost/index/main/bootstrap/fman.F90

compiles with no issue (which if renamed "fpm-man" can be used with fpm(1) so you can do "fpm man atan2" or most any intrinsic and get a description of the intrinsic).

from m_cli2.

semarie avatar semarie commented on June 11, 2024

I did some tests, using OpenBSD i386 and gfortran 11.

  • M_draw : fail to build. it is expecting termio.h, which doesn't exist on OpenBSD.
  • M_intrinsics : build fine
  • fpm-search : build fine (after changing fpm.toml to use HEAD version of M_CLI2)

I needed to run fpm with: fpm build --flag '-static' to avoid an unrelated error at link time when using gfortran 11.

Using gfortran 8, I saw some errors like:

...
M_intrinsics.f90                       done.                                                                                 
main.f90                               done.                                                                                 
M_CLI2.F90                             done.                                                                                 
M_match.f90                            done.                                                                                 
M_strings.F90                          failed.                                                                               
[ 41%] Compiling...                                                                                                          
build/dependencies/M_strings/src/M_strings.F90:8854:35:                                                                      
                                                                                                                             
 real,parameter    :: XMAXREAL=real(huge(1))                                                                                 
                                   1                                                                                         
Warning: Change of value in conversion from 'INTEGER(4)' to 'REAL(4)' at (1) [-Wconversion]                                  
build/dependencies/M_strings/src/M_strings.F90:6711:50:                                                                      
                                                                                                                             
 integer                      :: matrix(0:len_trim(a), 0:len_trim(b))                                                        
                                                  1                                                                          
Error: Dummy argument 'a' not allowed in expression at (1)                                                                   
compilation terminated due to -fmax-errors=1.                                                                                
<ERROR> Compilation failed for object " build_dependencies_M_strings_src_M_strings.F90.o "                                   
<ERROR>stopping due to failed compilation                                                                                    
STOP 1                                                                                                                       

from m_cli2.

urbanjost avatar urbanjost commented on June 11, 2024

Thanks. Did not expect the testing. All makes sense (gfortran version 8 did not implement a feature that version 11 does for M_string, termio.h is something I have a fix for, others built ...). My test platforms probably have insufficient memory, possibly I am building in parallel which would conflate that, ...). I was immediately getting segfaults with no traceback. So looks good all things considered. I will make corresponding package changes to use the new M_CLI2, etc based on your findings. When I get a moment I should be able to confirm it was just my configurations' limitations and get versions of at least my packages all deployable with gfortran 11. Very encouraging. Not sure if including fpm-man and fpm-search is anything you desire to add to the fpm package, but feel free if so, and of course feel free not to as well. So for someone to use the package they will be able to do "pkg_add fpm"? Hoping you will announce the package on comp.lang.fortran, Fortran Discourse, ... (?)

from m_cli2.

semarie avatar semarie commented on June 11, 2024

Yes, pkg_add fpm is enough to install fpm on OpenBSD. It is already available on -current (which is the developpment HEAD and the upcoming 7.3 version).

the import of fpm inside OpenBSD has already be announced on Fortran Discourse. For comp.lang.fortran, I am reading it, but I don't have a setup to post, so feel free to announce it if you want.

regarding fpm-man or fpm-search, as we don't mix differents upstreams inside one package, it would be different packages.

from m_cli2.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.