bigloo scheme "make test" fails for pthreads - makefile

I am trying to build from the bigloo scheme's latest source 3.8a on a Linux Mint 12 (lisa), which is Ubuntu 11 (Oneric) derivative:
Here is my "configure":
./configure --enable-pthread --enable-fthread --enable-ssl --enable-sqlite --enable-web --enable-multimedia --enable-mail --enable-calendar --enable-pkgcomp --enable-pkglib --enable-gstreamer --enable-text --enable-srfi1 --enable-srfi27 --enable-crypto --enable-openpgp --enable-phone --enable-alsa --enable-mpg123 --enable-csv --jvm=yes
** Configuration summary **
Release features:
release number.............. 3.8a
supported backends.......... native:yes JVM:yes
default backend............. native
additional APIs............. pthread fthread sqlite web multimedia mail calendar pkgcomp pkglib text srfi1 srfi27 packrat crypto openpgp phone mpg123 csv
native threads support...... yes
openssl support............. no
sqlite support.............. sqltiny + sqlite
dynamic libraries support... yes
Bee configuration:
bee support................. partial
emacs....................... emacs
emacs brand................. emacs23
Implementation details:
tuning...................... standard
cc.......................... gcc
gc.......................... custom (bigloogc-3.8a, v731)
Java version................ 1.3
bignum support.............. gmp (5.0.1)
Directories where Bigloo will be installed:
binaries.................... /usr/local/bin
libraries................... /usr/local/lib
files directory............. bigloo/3.8a
standard zip................ /usr/local/lib/bigloo/3.8a
standard dll................ /usr/local/lib/bigloo/3.8a
manual pages................ /usr/local/man/man1
info documentation.......... /usr/local/info
lisp files..................
temporary build dir......... /tmp
The "make" succeeds; however "make test" fails for pthread
*** pthread **********
make[2]: Entering directory `/home/liew/Downloads/bigloo3.8a/api/pthread/recette'
/home/liew/Downloads/bigloo3.8a/bin/bigloo -c -call/cc -O3 -fcfa-arithmetic -q recette.scm -o recette.o
/home/liew/Downloads/bigloo3.8a/bin/bigloo -O3 -fcfa-arithmetic -q recette.o -o recette
/usr/bin/ld: recette: hidden symbol `pthread_atfork' in /usr/lib/i386-linux-gnu/libpthread_nonshared.a(pthread_atfork.oS) is referenced by DSO
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
make[2]: *** [recette] Error 1
make[2]: Leaving directory `/home/liew/Downloads/bigloo3.8a/api/pthread/recette'
make[1]: *** [c-test] Error 1
make[1]: Leaving directory `/home/liew/Downloads/bigloo3.8a'
make: *** [test] Error 2
According to this excellent post about this pthread issue, we need to rearrange the command line parameters while linking pthread library. However, I was unable to find the required Makefile code - probably because it relies on the Makefile default that links the library in a certain way.
Any help will be appreciated.

The problem is probably fixed in newer versions of bigloo.

Related

gcc/gfortran 11 cannot find headers/libraries in default locations

After upgrading python 3.8.6 to 3.9.10 using homebrew, my Cython extensions no longer without explicitly adding /usr/local/include (for my Intel MacBook) or /opt/homebrew/include to the include_dirs of my extension.
My setup.py.in:
import os, sys
from numpy.distutils.core import setup, Extension
from Cython.Build import cythonize
link_arguments = []
extra_include_dirs = []
if (sys.platform == 'darwin'):
link_arguments.append("-Wl,-rpath")
link_arguments.append("-Wl,#loader_path/")
if os.path.exists('/opt/homebrew/'):
extra_include_dirs.append("/opt/homebrew/include/")
else:
extra_include_dirs.append("/usr/local/include/")
else:
link_arguments.append("-Wl,-rpath=${CMAKE_SOURCE_DIR}/lib/")
pynwp_extension = Extension(
name="pynwp",
sources=["${CMAKE_CURRENT_SOURCE_DIR}/lambert.f90", "${CMAKE_CURRENT_SOURCE_DIR}/pynwp.f90", "${CMAKE_CURRENT_SOURCE_DIR}/readAtmosphereGen.f90", "${CMAKE_CURRENT_SOURCE_DIR}/ptogrot.f", "${CMAKE_CURRENT_SOURCE_DIR}/bilin1.f", "${CMAKE_CURRENT_SOURCE_DIR}/fl2pres_f.f","${CMAKE_CURRENT_SOURCE_DIR}/message.c","${CMAKE_CURRENT_SOURCE_DIR}/gridWindDirCorrection.F"],
libraries=["HirlamUtils_fPIC", "eccodes_f90", "jasper"],
library_dirs=["${PROJECT_BINARY_DIR}", "${CMAKE_SOURCE_DIR}/build${CMAKE_BUILD_TYPE}/src/libHirlamUtils/", "/opt/homebrew/lib/"],
extra_link_args = link_arguments,
include_dirs=["${CMAKE_SOURCE_DIR}/include", "/usr/lib64/gfortran/modules/",
"${CMAKE_SOURCE_DIR}/build${CMAKE_BUILD_TYPE}"] + extra_include_dirs,
extra_f90_compile_args=["-DLINUX", "-DIS_LITTLE_ENDIAN", "-DUSEWALLTIME", "-DHAS_BLAS", "-DHAS_LAPACK", "-DGRIB32", "-DTIMING", "-DPREC32", "-fno-whole-file", "-g", "-fbounds-check"]
#compiler_directives={'language_level' : "3"}
)
setup(name="pynwp",
author="me",
author_email="me!me.com",
version="1.0.1",
description="Python wrapper for pynwp",
package_dir={"": "${CMAKE_CURRENT_SOURCE_DIR}"},
url="http://emaddc.eu",
license="MIT License",
ext_modules=[pynwp_extension]
)
In the file above, I have hardcoded the location (temporarily) of the homebrew library dir and added some functionality for the include dir based on /opt/homebrew being found. If I remove this from the file, compilation fails as eccodes.mod cannot be found, see the output when I run the command generate by python/CMake manually:
buildDebug git:(master) ✗ /opt/homebrew/bin/gfortran -Wall -g -fno-second-underscore -fPIC -O3 -funroll-loops -I<project_dir>//include -I/usr/lib64/gfortran/modules/ -I<project_dir>//buildDebug -Ibuild/src.macosx-12-arm64-3.9/build/src.macosx-12-arm64-3.9 -I/opt/homebrew/lib/python3.9/site-packages/numpy/core/include -Ibuild/src.macosx-12-arm64-3.9/numpy/distutils/include -I/opt/homebrew/opt/python#3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c -c <project_dir>//src/pynwp/readAtmosphereGen.f90 -o build/temp.macosx-12-arm64-3.9<project_dir>//src/pynwp/readAtmosphereGen.o -DLINUX -DIS_LITTLE_ENDIAN -DUSEWALLTIME -DHAS_BLAS -DHAS_LAPACK -DGRIB32 -DTIMING -DPREC32 -fno-whole-file -g -fbounds-check
f951: Warning: Nonexistent include directory '/usr/lib64/gfortran/modules/' [-Wmissing-include-dirs]
f951: Warning: Nonexistent include directory 'build/src.macosx-12-arm64-3.9/build/src.macosx-12-arm64-3.9' [-Wmissing-include-dirs]
f951: Warning: Nonexistent include directory 'build/src.macosx-12-arm64-3.9/numpy/distutils/include' [-Wmissing-include-dirs]
<project_dir>//src/pynwp/readAtmosphereGen.f90:3:7:
3 | use eccodes
| 1
Fatal Error: Cannot open module file 'eccodes.mod' for reading at (1): No such file or directory
compilation terminated.
This extension is part of a larger project that is build using CMake. When running the gfortran command manually, the same errors indicating that eccodes.mod cannot be found. The file is however located on a default location on the gfortran/gcc search path:
locate eccodes.mod
/opt/homebrew/Cellar/eccodes/2.24.2/include/eccodes.mod
/opt/homebrew/include/eccodes.mod
And the search path for gfortran:
gfortran -E -Wp,-v -
#include <...> search starts here:
/opt/homebrew/include
/opt/homebrew/Cellar/gcc/11.2.0_3/bin/../lib/gcc/11/gcc/aarch64-apple-darwin21/11/include
/opt/homebrew/Cellar/gcc/11.2.0_3/bin/../lib/gcc/11/gcc/aarch64-apple-darwin21/11/include-fixed
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks
End of search list.
Another project uses gcc/ld and has a similar problem. I need to explicitly add LINK_DIRECTORIES(/opt/homebrew/lib) to CMakeList.txt in order for gcc to find the eccodes library. Without that, I get:
gcc-11: warning: this compiler does not support X86 (arch flags ignored)
ld: library not found for -leccodes
collect2: error: ld returned 1 exit status
make[2]: *** [src/smoothModeS-v51/smoothModeS-v51.x] Error 1
make[1]: *** [src/smoothModeS-v51/CMakeFiles/smoothModeS-v51.x.dir/all] Error 2
make: *** [all] Error 2
Adding the paths to CPATH and LIBRARY_PATH had no effect.
This method works but seems hard to maintain. What am I missing and what has changed that gfortran/gcc no longer search in the default paths for but libraries and headers/modules?
EDIT
Just found that the standalone executable that uses similar code as the python extension and also uses eccodes has a similar issue. If I do not include INCLUDE_DIRECTORIES(/opt/homebrew/include) in CMakeLists.txt , I get:
cd <project_dir>/buildDebug/src/collocEHS && /opt/homebrew/bin/gfortran -I<project_dir>/buildDebug -I<project_dir>/include -I<project_dir>/src/readASTERIX2 -I<project_dir>/src/geomag70_linux -I<project_dir>/src/libDTG -fallow-argument-mismatch -ffpe-trap=invalid,zero,overflow -DPREC32 -DLINUX -DIS_LITTLE_ENDIAN -DUSEWALLTIME -DHAS_BLAS -DHAS_LAPACK -DGRIB32 -DTIMING -ffixed-line-length-none -g -fcheck=all -Wall -fcheck=bounds -O0 -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk -c <project_dir>/src/pynwp/readAtmosphereGen.f90 -o CMakeFiles/collocEHSv2.dir/__/pynwp/readAtmosphereGen.f90.o
<project_dir>/src/pynwp/readAtmosphereGen.f90:3:7:
3 | use eccodes
| 1
Fatal Error: Cannot open module file 'eccodes.mod' for reading at (1): No such file or directory
compilation terminated.
make[2]: *** [src/collocEHS/CMakeFiles/collocEHSv2.dir/__/pynwp/readAtmosphereGen.f90.o] Error 1
make[1]: *** [src/collocEHS/CMakeFiles/collocEHSv2.dir/all] Error 2
make: *** [all] Error 2
So I guess the problem is unrelated to python but more with gcc/gfortran (gcc version 11.2.0 (Homebrew GCC 11.2.0_3).
EDIT 2
A reboot of the laptop fixed the issue with the python extension build and setup.py requiring additional directories. For normal builds using CMake, I still require the extra INCLUDE_DIRECTORIES and LINK_DIRECTORIES order for gcc/gfortran to find libraries installed by brew in /opt/homebrew (or /usr/local for intel MacBook).
As per homebrew devs, this is desired behaviour: /opt/homebrew and /usr/local are "special" directories to be manually added in e.g., CMake projects. This is explained in my bug report on home-brew's GitHub, see https://github.com/Homebrew/homebrew-core/issues/95561.
I haven't been able to confirm this with documentation.

Compiling GDAL/OGR with MinGW on Windows

I've been trying to link the GDAL library to qt-creator this last week, but have been having problems compiling the library in order to correctly link it.
I am getting this error
libtool: link: g++ .libs/gdalinfo_bin.o -o .libs/gdalinfo.exe -L/local64/lib /c/gdal-2.1.0/.libs/libgdal.a -lodbc32 -lodbccp32 -lz -lpthread -lws2_32
C:/MinGW/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/lib/../lib/libiconv.a(localcharset.o):localcharset.c:(.text+0x8): undefined reference to `__imp_GetACP'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [gdalinfo.exe] Error 1
make[1]: Leaving directory `/c/gdal-2.1.0/apps'
make: *** [apps-target] Error 2
After having so many problems with the compiler, I am unsure whether this is a problem with setup or whether I need to reconfigure something in the gdal library for windows/mingw consumption.
Can anyone help me with this?
EDIT: This may causing the problem, although I am unsure how to fix it
*** Warning: linker path does not have real file for library -lz.
*** I have the capability to make that library automatically link in when
*** you link to this library. But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because I did check the linker path looking for a file starting
*** with libz and none of the candidates passed a file format test
*** using a file magic. Last file checked: C:/MinGW/mingw64/x86_64-w64-mingw32/lib/libz.a
*** The inter-library dependencies that have been dropped here will be
*** automatically added whenever a program is linked with this library
*** or is declared to -dlopen it.
*** Since this library must not contain undefined symbols,
*** because either the platform does not support them or
*** it was explicitly requested with -no-undefined,
*** libtool will only create a static version of it.
Previous attempt lead me to believe that I needed the MinGW-64 version which was not designated by the GDAL instructions, so I used this tutorial to modify MinGW for 64 bit libraries
I would strongly suggest moving your development toolset to use MSYS2 and its package manager. It includes a ton of precompiled libraries, such as GDAL, so you don't have to spend time on trying to get those to compile.
Had the same problem. Solved it by by:
compiling ZLib,
placing zlib1.dll in MinGW/bin,
placing libz.a and libz.dll.a in MinGW/lib.

compiling gcc - cannot find output from flex; giving up

I am trying to compile gcc-4.9RC or gcc-4.8.2 on Debian (6 or 7).
There is flex 2.5.35 installed and I even compiled my own flex 2.5.39.
I confirmed it generates a yy.c output from a simple .l file.
Also I learned at gcc documentation, that flex shouldn't be necessary when compiling from a release (which the gcc-4.8.2 is).
Nevertheless I always get this in some internal configure after running make:
checking for bison... bison -y
checking for flex... flex
checking lex output file root... configure: error: cannot find output from flex; giving up
make[2]: *** [configure-stage1-gmp] Error 1
make[2]: Leaving directory `***/gcc-bin-8'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `***/gcc-bin-8'
make: *** [all] Error 2
It is configured with:
../gcc-4.8.2/configure --enable-languages=c,c++,fortran --with-cloog --prefix=/home/***/gcc-4.8.2
I have no idea what should I try more.
This error is generated whilst building gmp (a pre-requisite of gcc). It's a known bug in gmp present in 4.8.3 Ref :gmp bug. If you ran contrib/download_prerequisites, you would get gmp 4.8.3 by default. Workaround is to edit gmp-4.8.3/configure.in & gmp-4.8.3/configure and change
M4=m4-not-required
for
M4=m4

What is the issue with Ubuntu (12.10) and GCC 4.7/4.8?

Since several versions of GCC and Ubuntu I am experiencing annoying issues with paths and naming of several header and object files that are necessary for the installation of GCC.
Description: After installing ubuntu (e.g. in my case 12.04) and installing all prerequisites of the gcc, I run the following commands:
sudo mkdir /usr/local/stow/gcc-4.8.0
./configure --prefix /usr/local/stow/gcc-4.8.0
make
sudo make install
For the sake of completeness, the rest of the installation procedure:
cd /usr/local/stow
sudo stow -t /usr/local/ gcc-4.8.0
gcc -v
However, this simple and proper way of installing gcc has some issues during the 'make' step with the following error messages:
1.) The problem with 'stubs.h'
/usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory
which can be fixed with the following commands added to ~/.bashrc:
if [ -z "$CPATH"]; then
export CPATH="/usr/include/i386-linux-gnu"
else
export CPATH=$CPATH:"/usr/include/i386-linux-gnu"
fi
2.) The problem with 'crti.o', 'crtn.o', and 'crt1.o'
/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: cannot find crtn.o: No such file or directory
/usr/bin/ld: cannot find crt1.o: No such file or directory
which can be fixed with the very ugly solution:
sudo ln -s /usr/lib/i386-linux-gnu/crti.o /usr/lib/i386-linux-gnu/crtn.o /usr/lib/i386-linux-gnu/crt1.o /usr/lib
since - and I don't know why - the following commands do not solve the problem during linking steps of 'sudo make install'
if [ -z "$LIBRARY_PATH"]; then
export LIBRARY_PATH="/usr/lib/${multiarch}"
else
export LIBRARY_PATH=$LIBRARY_PATH:"/usr/lib/${multiarch}"
fi
if [ -z "$LD_LIBRARY_PATH"]; then
export LD_LIBRARY_PATH="/usr/lib/${multiarch}"
else
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"/usr/lib/${multiarch}"
fi
(With these solutions I could compile GCC-4.7.2 on Ubuntu 12.04. - I have still issues compiling GCC-4.8.0 on Ubuntu 12.04, but that's different topic.)
My questions are: Does anybody know the reason/background that we have these issues? Does anybody know a proper solution? (With "proper solution" I mean a solution that does not require setting environment variables or symbolic linking libraries to different directories. To me these kind of changes are ugly, since they require changes to the system that one may not be able to trace back or redo.)
In the root folder of your GCC source execute ./contrib/download_prerequisites script.
These are the issues i encountered while compiling GCC 4.8.0 on Ubuntu 12.04 with solutions.
This might help you.
Compilation guide for compiling GCC 4.8 on ubuntu 12.04
ERROR 1
configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations. Source code for these libraries can be found at
their respective hosting sites as well as at
ftp://gcc.gnu.org/pub/gcc/infrastructure/. See also
http://gcc.gnu.org/install/prerequisites.html for additional info. If
you obtained GMP, MPFR and/or MPC from a vendor distribution package,
make sure that you have installed both the libraries and the header
files. They may be located in separate packages.
SOLUTION
Download and install gmp version >=4.3.2 package because mpc needs higher version
download the source code from gmplib.org
compile the source code and install
while compiling gmp see ERROR 2 for help
Installed gmp version 5.1.1
Download and install mpfr package
Installed mpfr version 3.1.2
Download and install mpc package
Installed mpc version 1.0
Download the packages from
http://ftp.gnu.org
ERROR 2
Error while compiling gmp library
checking for suitable m4... configure: error: No usable m4 in $PATH or /usr/5bin
SOLUTION
sudo apt-get install m4
http://ubuntuforums.org/showthread.php?t=850491
ERROR 3
Cannot find g++ compiler
I got this error because I installed the OS recently and had not installed the compilers.
SOLUTION
sudo apt-get install build-essential
This installs all the standard build essential software
ERROR 4
checking for i686-pc-linux-gnu-gcc... /home/suhastheju/projects/gcc/gcc-4.8.0/host-i686-pc-linux-gnu/gcc/xgcc -B/home/suhastheju/projects/gcc/gcc-4.8.0/host-i686-pc-linux-gnu/gcc/ -B/usr/local/i686-pc-linux-gnu/bin/ -B/usr/local/i686-pc-linux-gnu/lib/ -isystem /usr/local/i686-pc-linux-gnu/include -isystem /usr/local/i686-pc-linux-gnu/sys-include
checking for suffix of object files... configure: error: in `/home/suhastheju/projects/gcc/gcc-4.8.0/i686-pc-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[2]: *** [configure-stage1-target-libgcc] Error 1
make[2]: Leaving directory `/home/suhastheju/projects/gcc/gcc-4.8.0'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/suhastheju/projects/gcc/gcc-4.8.0'
make: *** [all] Error 2
SOLUTION
Though gcc documentation specify , that , we can provide the path of gmp
and mpfr installtion through –with-gmp and –with-mpfr flag ,
but unfortunately , i tried to give the path but it didnt work.
I am not in position to say final word about , this , whether it is a bug
in build script or something else , but bellow is the solution of the problem.
while building , add gmp and mpfr installation path in LD_LIBRARY_PATH environment
variable. Do as follows
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
If you have the libraries in different path, add the path where libraries are present
ERROR 5
libbackend.a(tree-vect-data-refs.o):tree-vect-data-refs.c:(.text+0x87da): more undefined references to `vector_type_mode(tree_node const*)' follow
collect2: error: ld returned 1 exit status
make[3]: *** [cc1] Error 1
make[3]: Leaving directory `/home/suhastheju/projects/gcc/gcc-4.8.0/host-i686-pc-linux-gnu/gcc'
make[2]: *** [all-stage2-gcc] Error 2
make[2]: Leaving directory `/home/suhastheju/projects/gcc/gcc-4.8.0'
make[1]: *** [stage2-bubble] Error 2
make[1]: Leaving directory `/home/suhastheju/projects/gcc/gcc-4.8.0'
make: *** [all] Error 2
SOLUTION
recompiled the source code from begining, It worked magically
make clean all
ERROR 6
/home/suhastheju/projects/gcc/gcc-4.8.0/host-i686-pc-linux-gnu/gcc/../.././gcc/gcov.c:416: undefined reference to `gcc_init_libintl()'
collect2: ld returned 1 exit status
make[3]: *** [gcov] Error 1
make[3]: Leaving directory `/home/suhastheju/projects/gcc/gcc-4.8.0/host-i686-pc-linux-gnu/gcc'
SOLUTION
Added -I/usr/include

CMake/GCC "unrecognized option" on Mac OS X

I'm trying to create a project as a shared library in OS X using CMake 2.8 and gcc 4.6 (from macports). When CMake gets to the point of linking my library into a .dylib, I get the following error from gcc:
g++ -dynamiclib -headerpad_max_install_names -o libmycoollibrary.dylib etc...
g++: error: unrecognized option '-h'
make[2]: *** [libnrtCore.dylib] Error 1
make[1]: *** [CMakeFiles/nrtCore.dir/all] Error 2
make: *** [all] Error 2
This -headerpad_max_install_names seems to be the problem, but I've never seen it before. Does anyone know how to either get CMake to not include this option, or to get GCC to accept this option?
You can re-build cmake to fix this -- it's apparently generating code for the XCode / Darwin version of g++ (a special version of 4.2), which accepts a number of non-standard linker flags.
Just change the Modules/Platform/Darwin*.cmake files and re-build. The culprit lines look like this:
SET(CMAKE_CXX_LINK_FLAGS "-Wl,-search_paths_first -headerpad_max_install_names")

Resources