-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Compilation issues. New to F2003/8, JSON #231
Comments
How are you building? I don't think we distribute a makefile, the supported installation methods I'm aware of are via CMake, or install.sh which requires FoBiS.py (which requires python). Also which gfortran are you using and which OS and which version of JSON-Fortran. There may be legitimate issues, I'm not doubting you, but I would like to gather more info and see what happens if you try installing via a supported means. Oh, btw if you're on Mac OS X you can get it through the Homebrew package manager and it may be in a Linux package manager, not sure. |
Thanks for the response! The json-fortran-master.zip file I downloaded from Github shows Date Modified of 10/28/2016. Enclosed is my Makefile. Thanks again for your response. #$preamble
# A simple hand-made makefile for a package including applications
# built from Fortran 90 sources, taking into account the usual
# dependency cases.
# This makefile works with the GNU make command, the one find on
# GNU/Linux systems and often called gmake on non-GNU systems, if you
# are using an old style make command, please see the file
# Makefile_oldstyle provided with the package.
# The compiler
FC = gfortran
# flags for debugging or for maximum performance, comment as necessary
FCFLAGS = -g -fbounds-check
FCFLAGS = -O2
# flags forall (e.g. look for system .mod files, required in gfortran)
FCFLAGS += -I/usr/include
# For right now, build everything here (don't use library)
LIBS =
MODS =
# List of executables to be built within the package
PROGRAMS = JSONmp
# "make" builds all
all: $(PROGRAMS)
json_parameters.o: json_kinds.o
json_string_utilities.o: json_parameters.o
json_value_module.o: json_kinds.o json_parameters.o json_string_utilities.o
JSONmp.o: json_value_module.o json_file_module.o json_module.o
JSONmp: json_kinds.o json_parameters.o json_string_utilities.o json_value_module.o json_file_module.o json_module.o
# General rule for building prog from prog.o; $^ (GNU extension) is
# used in order to list additional object files on which the
# executable depends
%: %.o
$(FC) $(FCFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(MODS)
# General rules for building prog.o from prog.f90 or prog.F90; $< is
# used in order to list only the first prerequisite (the source file)
# and not the additional prerequisites such as module or include files
%.o: %.f90
$(FC) $(FCFLAGS) -c $< $(LIBS) $(MODS)
%.o: %.F90
$(FC) $(FCFLAGS) -c $< $(LIBS) $(MODS)
# Utility targets
clean:
rm -f *.o *.mod *.MOD |
Can you give me the output of Also have you tried one of the official releases? |
$ gfortran --version No, I wasn't aware of an official release. I'll check into it. Thanks! |
Thanks again. I just downloaded json-fortran-5.1.0. So far I have the same 1st issue:
|
I don't use Make, so I can't answer any question about it. However, your code has several issues. The json-fortran code doesn't need any modifications to do what you want. You can't call the private routines, you have to use the public ones in the program testJSON
! You only have to use this (note that we are renaming the json_IK variable)
use json_module, IK=>json_IK
implicit none
! declare local variables
type(json_file) :: json
integer :: i
character(len=24) :: filename
character(len=:), allocatable :: name
type(json_value), pointer :: pJval, pJval_c
type(json_core) :: jCore
integer(kind=IK) :: var_type
integer(kind=IK) :: n_children
call json%initialize(compact_reals=.true.)
! open a *.json file.
write(*,*) 'Enter JSON filename:'
read(*,*) filename
call json%load_file(filename=filename)
!print to the console for verification
call json%print_file()
! get the json_core and the root json_value for the call to json_info etc.
call json%get_core(jCore)
call json%get(pJval)
! Try out a few thigs
call jCore%info(pJval, var_type, n_children, name)
write(*,*) n_children, 'children found for ', name
do i=1, n_children
call jCore%get_child(pJval, i, pJval_c)
call jCore%info(pJval_c, var_type, n_children, name)
write(*,*) n_children, 'children found for ', name
enddo
call json%destroy()
end program testJSON
For example, |
Thank you Jacob I think my real issue is with understanding how FORD presents the documentation, as I still don't really know where to look for the actual API (public functions/interfaces). I found (for example) where 'info' was documented, but now only because I was looking for it. The public interfaces seem to be buried on the same long page that also has all the private functions etc, so I feel like I am looking for a needle in a haystack when I don't even know what the needle looks like. I guess I show my real ignorance in saying that but I don't mind. Is there anyplace that has just the public interfaces? Thanks again! |
We at least had a discussion about including only public functions for the release documentation (and I'm traveling today and have been corresponding from my phone--why I didn't dig into your code and come to the realization Jacob did) but I don't remember what we decided. Are you looking at the online documentation or locally built documentation? |
Perhaps the following changes should be made:
@towtruck1 do you think that would be a step in the right direction for clarifying end user API? @jacobwilliams: thoughts? |
Thanks! |
@zbeekman I agree with all this! |
@towtruck1 if you can build the documentation locally, then you can delete the line with
deleting that line (private) and rebuilding the documentation will only show publicly visible documentation. Should we close this issue and open a new one to track the documentation changes. |
Thanks. I'll give it a go. And I'll close this issue & let you open a new one to track the documentation changes. |
Hello
I've been doing non-modern FORTRAN for years, but am new to OOF (2003, 2008) and also new to JSON, so your patience is appreciated. I created a simple test program and immediately ran into compilation problems. The trouble is, I don't know if I am doing something wrong, or if there is a bug in the code.
Issue 1:
$ make
gfortran -O2 -I/usr/include -c json_kinds.F90
gfortran -O2 -I/usr/include -c json_parameters.F90
gfortran -O2 -I/usr/include -c json_string_utilities.F90
gfortran -O2 -I/usr/include -c json_value_module.F90
gfortran -O2 -I/usr/include -c json_file_module.F90
gfortran -O2 -I/usr/include -c json_module.F90
gfortran -O2 -I/usr/include -c JSONmp.F90
JSONmp.F90:39:35:
Error: ‘get_json_core_in_file’ at (1) is not a member of the ‘json_file’ structure
make: *** [Makefile:63: JSONmp.o] Error 1
I "fixed" this by making a change in json_file_module.F90
added:
procedure :: get_json_core_in_file
after:
procedure :: set_json_core_in_file
Issue 2:
$ make
gfortran -O2 -I/usr/include -c json_kinds.F90
gfortran -O2 -I/usr/include -c json_parameters.F90
gfortran -O2 -I/usr/include -c json_string_utilities.F90
gfortran -O2 -I/usr/include -c json_value_module.F90
gfortran -O2 -I/usr/include -c json_file_module.F90
gfortran -O2 -I/usr/include -c json_module.F90
gfortran -O2 -I/usr/include -c JSONmp.F90
gfortran -O2 -I/usr/include -o JSONmp JSONmp.o json_kinds.o json_parameters.o json_string_utilities.o json_value_module.o json_file_module.o json_module.o
JSONmp.o:JSONmp.F90:(.text+0x428): undefined reference to
json_info_' JSONmp.o:JSONmp.F90:(.text+0x428): relocation truncated to fit: R_X86_64_PC32 against undefined symbol
json_info_'JSONmp.o:JSONmp.F90:(.text+0x4cb): undefined reference to
json_value_get_by_index_' JSONmp.o:JSONmp.F90:(.text+0x4cb): relocation truncated to fit: R_X86_64_PC32 against undefined symbol
json_value_get_by_index_'JSONmp.o:JSONmp.F90:(.text+0x4ed): undefined reference to
json_info_' JSONmp.o:JSONmp.F90:(.text+0x4ed): relocation truncated to fit: R_X86_64_PC32 against undefined symbol
json_info_'collect2: error: ld returned 1 exit status
make: *** [Makefile:54: JSONmp] Error 1
I "fixed" this one by making a change in json_value_module.F90
commented out (line ~24):
!private
My test code (JSONmp.F90, below) compiled fine & gave me the result I expected after I made the changes enumerated above. If anyone would take a few moments to set me straight, I would appreciate it. Thanks!
The text was updated successfully, but these errors were encountered: