Compiling legacy fortran 77 code on a MAC with gfortran: %LOC() causing problems? - gfortran

I am working on compiling legacy Fortran 77 code on a Mac OS X 10.8.4 using gfortran 4.6.2. The gfortran was installed from http://gcc.gnu.org/wiki/GFortranBinaries#MacOS site.
According to the gcc.gnu.org wiki for GFortran, Release 4.2 includes this:
"The DEC extensions %VAL, %LOC and %REF are now supported."
I am getting the error below when I compile:
IPL(I) = %LOC(R8D(INITX(I)+1))
1
Error: Invalid character in name at (1)
Is there a workaround?

It seems that the new intrinsic LOC can be used instead:
The LOC() intrinsic works the same way as the %LOC() construct
http://gcc.gnu.org/onlinedocs/gfortran/LOC.html

Related

I'm getting an error "Undefined symbols for architecture x86_64" and can't find the error in compilation

This is what my files look like
My main function is here
I compiled it using the following command:
g++ -std=c++17 main.cpp linkedList.cpp -o main
on MacOS 10.14 using the latest gcc compiler as of 2018.
It looks like the definitions for your template are not visible to the compiler when it is instantiated. You need to move the definitions from linkedList.cpp into the header file, linkedList.hpp.
(Note that C++17 support is still experimental in GCC.)

XlC flag qhalt issue

I'm using xlC 13.1.5 and CMake 3.5. When I try to compile an MPI package using CMake, I get the following error:
/opt/ibm/xlC/13.1.5/bin/.orig/xlc_r: warning: 1501-269 fpic is not supported on this Operating System platform. Option fpic will be ignored.
error: 1540-5203 Unrecognized value "e" specified with option "halt".
1 error generated.
I read it is a bug of this compiler version, that adding qhalt flag with "e" option is not supported. Is there a workaround to solve the problem? At the moment I can't change compiler version.
-qhalt=e is from an older compiler version, only -qhalt=w is supported on 13.1.5
When I try it I get a warning instead of an error
xlC -qhalt=w -c b1.cpp
xlC -qhalt=e -c b1.cpp
warning: 1540-5203 Unrecognized value "e" specified with option "halt".
1 warning generated.``
I'm assuming the option is in the makefile for your project which might be setup for the older xlC releases that accept the option. Can you update it in the makefile?
-qhalt=w just get's transformed to -Werror and sent to clang on 13.1.5

How to build DCMTK 3.6.1 libs for iOS?

I followed Russes' instructions found at http://forum.dcmtk.org/viewtopic.php?f=3&t=3047&start=15
With a fresh copy of his "afab" git branch, I built Xcode project for x86 arch with the command line:
cmake -DIOS_PLATFORM=SIMULATOR64 -G Xcode ../dcmtk.public
or for arm arch with:
cmake -DIOS_PLATFORM=OS -G Xcode ../dcmtk.public
However, my Xcode project can't be successfully built because of, at least, the following errors:
List of Xcode errors on ofchrenc.cc file (for eg. "No class named Implementation in OFCharacterEncoding")
The compilation with Unix makefiles gives the same errors in my case:
Scanning dependencies of target ofstd
0% Building CXX object ofstd/libsrc/CMakeFiles/ofstd.dir/ofchrenc.cc.o
dcmtk.public/ofstd/libsrc/ofchrenc.cc:518:28: error: no class named 'Implementation' in 'OFCharacterEncoding'
class OFCharacterEncoding::Implementation {};
dcmtk.public/ofstd/libsrc/ofchrenc.cc:556:31: error: out-of-line definition of 'getLocaleEncoding' does not match any declaration in
'OFCharacterEncoding'
OFString OFCharacterEncoding::getLocaleEncoding()
/usr/local/include/dcmtk/ofstd/ofchrenc.h:97:21: note: member declaration does not match because it is const qualified
const OFString &getLocaleEncoding() const;
[...]
dcmtk.public/ofstd/libsrc/ofchrenc.cc:644:34: error: out-of-line definition of 'setConversionFlags' does not match any declaration in
'OFCharacterEncoding'
OFCondition OFCharacterEncoding::setConversionFlags(const unsigned flags)
19 errors generated.
make 2: ofstd/libsrc/CMakeFiles/ofstd.dir/ofchrenc.cc.o Error 1
make 1: ofstd/libsrc/CMakeFiles/ofstd.dir/all Error 2
make: [all] Error 2
I don't understand what is wrong in my configuration:
MacOs Sierra 10.12.2
Xcode 8.2
CMake 3.7.1 (I have the same issue previously with 3.5.2 version)
GNU Make 3.81 (for Unix makefiles compilation)
Apple LLVM version 8.0.0.8000042
Darwin version of host: 16.3.0
Building for minimum iOS version: 10.2 (SDK version: 10.2)
I'm not sure about the first error message but
/usr/local/include/dcmtk/ofstd/ofchrenc.h:97:21: note: member
declaration does not match because it is const qualified const
OFString &getLocaleEncoding() const;
seems to indicate that you are mixing an old version of "ofchrenc.h" (stored in "/usr/local/...") with a more recent version of "ofchrenc.cc" (stored in your working directory).

Building OpenCV with CUDA support Error on transpose.cu

Recently I am trying to build OpenCV with CUDA support, and I met problem while building the module cudaarithm.
OpenCV source: git cloned from : http://github.com/Itseez/opencv.git
OpenCV branch: master branch
OpenCV commit:
`commit 5466e321b8c8f97536002a357e5b7ff49a5d2bf9, on Tue Feb 10 12:17:11 2015 +0000`
CUDA version: CUDA 6.5
Hardware: MacBook Pro (13-inch, Mid 2010)
GPU: NVIDIA GeForce 320M 256 MB
OS Version: OS X Yosemite
Steps I used:
1. cd in OpenCVSource, then mkdir myrelease, and cd myrelease
2. cmake -DPLANTUML_JAR=/usr/local/Cellar/plantuml/8002 -D BUILD_DOCS=1 -DPYTHON2_LIBRARY=/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.dylib -DPYTHON2_INCLUDE_DIR=/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/include/python2.7 -DPYTHON3_LIBRARY=/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/libpython3.4m.dylib -DPYTHON3_INCLUDE_DIR=/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/include/python3.4m -D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -Wno-dev -DNVCC_FLAGS_EXTRA="-Xcompiler -stdlib=libstdc++; -Xlinker -stdlib=libstdc++" -DOPENCV_EXTRA_CXX_FLAGS=" -stdlib=libstdc++" -DOPENCV_EXTRA_EXE_LINKER_FLAGS="-stdlib=libstdc++" ..
3. make VERBOSE=1
Expect Result: Building success without error
Actual Result: when building OpenCVSource/modules/cudaarithm/src/cuda/transpose.cu, error happend like below:
/Users/Hawk/Documents/study/DIP/OpenCV/OpenCVSource/modules/cudaarithm/src/cuda/transpose.cu(61): *error: identifier "getInputMat" is undefined*
/Users/Hawk/Documents/study/DIP/OpenCV/OpenCVSource/modules/cudaarithm/src/cuda/transpose.cu(67): *error: identifier "getOutputMat" is undefined*
/Users/Hawk/Documents/study/DIP/OpenCV/OpenCVSource/modules/cudaarithm/src/cuda/transpose.cu(92): *error: identifier "syncOutput" is undefined*
Then what action I take:
check the code and I found these undefined symboles are defined in OpenCVSource/modules/core/include/opencv2/core/private.cuda.hpp
check the code and I confrim that the "transpose.cu" file include "opencv2/core/private.cuda.hpp"
check the building log, and I the confirm the private.cuda.hpp is in the search path of header file
cp "opencv2/core/private.cuda.hpp" as another file "opencv2/core/hawk.hpp", and then edit "transpose.cu" to include this new file, and I found
the "undifined symbole error" disapeared.
Although this is a workable workaround, I would like know whether the original OpenCV source cannot be compiled.
All, I think I found the problem cause.
Before I met such problem, I've already build and install OpenCV using older code from the git repo. So that there already have header files in my /usr/local/include/opencv2, especially there is /usr/local/include/opencv2/core/private.cuda.hpp.
However, it is an older one that doesn't define the symbols reporting undefined in above question. At the same time I found during the building nvcc have -I/usr/local/include in the command line, so that it use wrong private.cuda.hpp. As you know it should use the one in OpenCVSource, not the older installed one.
I think the solution is to gracefully remove the original installed OpenCV from my computer, then build again. I am trying and I will report later.

Compiling Qt for iOS (UIKit lighthouse)

I've been trying to compile Qt for iOS, but I've been having some crazy problems that noone else seems to be having (at least according to what I read in the past day).
I followed the instructions from this article:article url
I cloned a the latest Qt 4.8 from git: $ git clone git://gitorious.org/qt/qt.git
I made the qt-lighthouse-ios-simulator folder, cd to it.
I ran the long line of code from the article: $ ../qt/configure -qpa -xplatform qpa/macx-iphonesimulator-g++ -arch i386 -developer-build -release -opengl es2 -no-accessibility -no-qt3support -no-multimedia -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -static -nomake tools -nomake demos -nomake docs -nomake examples -nomake translations
opensource license
yes I accept the agreement
I get these errors:
In file included from /System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework/Headers/Accessibility.h:13,
from /System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework/Headers/HIServices.h:49,
from /System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:34,
from generators/mac/pbuilder_pbx.cpp:56:
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework/Headers/AXUIElement.h:65: error: CGCharCode has not been declared
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework/Headers/AXUIElement.h:65: error: CGKeyCode has not been declared
After struggling with this, searching here and there, and finding nothing useful (even nothing about what CGKeyCode or CGCharCode actually are, I decided to "hack" it and just added the definitions to pbuilder_pbx.cpp:
typedef u_int16_t CGCharCode; /* Character represented by event, if any */
typedef u_int16_t CGKeyCode; /* Virtual keycode for event */
Then another file couldn't compile, with the same errors. After adding them to a couple of files, I eventually added them to qcore_mac_p.h, then some files complained that they didn't know what u_int16_t was, so I added
typedef unsigned short u_int16_t; /* compile, god damn you!!! */
to the same header.
Now everything compiled but there was this linker error:
ld: in /System/Library/Frameworks//CoreGraphics.framework/CoreGraphics, missing required architecture x86_64 in file for architecture x86_64
Here's where I'm stuck. Any help?
Additional information:
gcc --version : i686-apple-darwin10-g++-4.2.1
iOS SDK: I have both 4.2 and 4.3
OS X version: 10.6.7
Xcode version (if it matters): 4.0.2
The problem somehow magically doesn't exist, when I tried the same thing on a different Mac with OS X 10.7.1
I have no idea how and why, but now qmake compiles and links.

Resources