You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
The code compiles perfectly in Linux (Ubuntu 20.04.2 LTS 64), but it fails when trying to compile it for Android. Your help is highly appreciated
When comparing configure results (linux vs android) these are the main differences:
checking for GNU libc compatible malloc... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible realloc... yes
checking for working strtod... yes
checking for pow... yes
checking for GNU libc compatible malloc... no
checking for stdlib.h... (cached) yes
checking for GNU libc compatible realloc... no
checking for working strtod... no
checking for pow... no
checking for pow in -lm... yes
make's output is hereafter:
Making all in src
make[1]: Entering directory '/home/hery/dev/iphreeqc-3.7.0-15749/output/src'
CXX CSelectedOutput.lo
CXX IPhreeqc.lo
CXX IPhreeqc_interface_F.lo
CXX IPhreeqcLib.lo
CXX phreeqcpp/cvdense.lo
CXX phreeqcpp/cvode.lo
../../src/phreeqcpp/cvdense.cpp:76:9: warning: 'malloc' macro redefined [-Wmacro-redefined]
#define malloc PHRQ_malloc
^<command line>:31:9: note: previous definition is here
#define malloc rpl_malloc
^
CXX phreeqcpp/cxxKinetics.lo
1 warning generated.
../../src/phreeqcpp/cvode.cpp:77:9: warning: 'malloc' macro redefined [-Wmacro-redefined]
#define malloc MACHENV_MALLOC PHRQ_malloc
^<command line>:31:9: note: previous definition is here
#define malloc rpl_malloc
^
1 warning generated.
CXX phreeqcpp/cxxMix.lo
CXX phreeqcpp/dense.lo
CXX phreeqcpp/Dictionary.lo
CXX phreeqcpp/dumper.lo
CXX phreeqcpp/Exchange.lo
CXX phreeqcpp/ExchComp.lo
CXX phreeqcpp/GasComp.lo
CXX phreeqcpp/gases.lo
CXX phreeqcpp/GasPhase.lo
CXX phreeqcpp/input.lo
CXX phreeqcpp/integrate.lo
CXX phreeqcpp/inverse.lo
../../src/phreeqcpp/inverse.cpp:5109:9: warning: result of comparison of constant -1 with expression of type 'char' is always true [-Wtautological-constant-out-of-range-compare]
if (c != EOF && c != '\n' && i != MAX_LINE)
~ ^ ~~~../../src/phreeqcpp/inverse.cpp:5133:9: warning: result of comparison of constant -1 with expression of type 'char' is always false [-Wtautological-constant-out-of-range-compare]
if (c == EOF)
~ ^ ~~~
CXX phreeqcpp/ISolution.lo
CXX phreeqcpp/ISolutionComp.lo
CXX phreeqcpp/isotopes.lo
2 warnings generated.
CXX phreeqcpp/kinetics.lo
CXX phreeqcpp/KineticsComp.lo
CXX phreeqcpp/mainsubs.lo
CXX phreeqcpp/model.lo
CXX phreeqcpp/NameDouble.lo
../../src/phreeqcpp/model.cpp:3126:8: error: no member named 'isfinite' in namespace 'std'; did you mean 'finite'?
if (!PHR_ISFINITE((double) delta[i]))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~../../src/phreeqcpp/Phreeqc.h:1839:29: note: expanded from macro 'PHR_ISFINITE'
# define PHR_ISFINITE(x) std::isfinite(x)
^~~~~/home/hery/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/math.h:373:5: note: 'finite' declared here
int finite(double __x) __attribute_const__;
^../../src/phreeqcpp/model.cpp:3321:8: error: no member named 'isfinite' in namespace 'std'; did you mean 'finite'?
if (!PHR_ISFINITE((double) delta[i]))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~../../src/phreeqcpp/Phreeqc.h:1839:29: note: expanded from macro 'PHR_ISFINITE'
# define PHR_ISFINITE(x) std::isfinite(x)
^~~~~/home/hery/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/math.h:373:5: note: 'finite' declared here
int finite(double __x) __attribute_const__;
^../../src/phreeqcpp/model.cpp:4755:10: error: no member named 'isfinite' in namespace 'std'; did you mean 'finite'?
if (!PHR_ISFINITE((double) f))
^~~~~~~~~~~~~~~~~~~~~~~~../../src/phreeqcpp/Phreeqc.h:1839:29: note: expanded from macro 'PHR_ISFINITE'
# define PHR_ISFINITE(x) std::isfinite(x)
^~~~~/home/hery/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/math.h:373:5: note: 'finite' declared here
int finite(double __x) __attribute_const__;
^../../src/phreeqcpp/model.cpp:4812:12: error: no member named 'isfinite' in namespace 'std'; did you mean 'finite'?
if (PHR_ISFINITE((double) d1) /*&& d1 < 5.0*/)
^~~~~~~~~~~~~~~~~~~~~~~~~../../src/phreeqcpp/Phreeqc.h:1839:29: note: expanded from macro 'PHR_ISFINITE'
# define PHR_ISFINITE(x) std::isfinite(x)
^~~~~/home/hery/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/math.h:373:5: note: 'finite' declared here
int finite(double __x) __attribute_const__;
^../../src/phreeqcpp/model.cpp:5479:10: error: no member named 'isfinite' in namespace 'std'; did you mean 'finite'?
if (!PHR_ISFINITE(my_array[(size_t)j * (count_unknowns + 1) + (size_t)i]))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~../../src/phreeqcpp/Phreeqc.h:1839:29: note: expanded from macro 'PHR_ISFINITE'
# define PHR_ISFINITE(x) std::isfinite(x)
^~~~~/home/hery/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/math.h:373:5: note: 'finite' declared here
int finite(double __x) __attribute_const__;
^
5 errors generated.
make[1]: *** [Makefile:983: phreeqcpp/model.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/home/hery/dev/iphreeqc/output/src'
make: *** [Makefile:401: all-recursive] Error 1
The text was updated successfully, but these errors were encountered:
I've managed to cross-compile the code with the following workarounds. But still the two first compiling warnings are shown in arm platforms (aarch64 and armv7a). For x86 (x86_64 and i686) no warnings were shown. I understand that affect the proper execution of the code. Still your help is needed.
adding #include below #include <math.h>, in src/phreeqcpp/Phreeqc.h. Courtesy of Botje ([https://stackoverflow.com/questions/68100973/failing-to-cross-compile-c-library-with-android-ndk/68113060#68113060])
overcome MALLOC/REALLOC errors with export ac_cv_func_malloc_0_nonnull=yes and export ac_cv_func_realloc_0_nonnull=yes
Hello,
The code compiles perfectly in Linux (Ubuntu 20.04.2 LTS 64), but it fails when trying to compile it for Android.
Your help is highly appreciated
I used this procedure:
When comparing configure results (linux vs android) these are the main differences:
make's output is hereafter:
The text was updated successfully, but these errors were encountered: