Compilation of MAX_HS solver with IBM CPLEX - linux

i'm trying to get started with a max-sat solver named: MAX_HS.
The documentation is only a readme file, is not so much but it's clear what you have to do:
https://github.com/fbacchus/MaxHS
I've installed CPLEX library from IBM and configured the file as indicated in the documentation, but when I compile i'm getting an error, this is my terminal log:
\\install -d /usr/local/include/maxhs
install -d /usr/local/include/minisat
for dir in maxhs/core maxhs/ifaces maxhs/ds maxhs/utils; do \
install -d /usr/local/include/$dir ; \
done
for dir in minisat/mtl minisat/utils minisat/core minisat/simp; do \
install -d /usr/local/include/$dir ; \
done
for h in minisat/mtl/Alg.h minisat/mtl/Map.h minisat/mtl/Alloc.h minisat/mtl/Vec.h minisat/mtl/Rnd.h minisat/mtl/Sort.h minisat/mtl/IntMap.h minisat/mtl/Queue.h minisat/mtl/IntTypes.h minisat/mtl/Heap.h minisat/mtl/XAlloc.h minisat/core/SolverTypes.h minisat/core/Dimacs.h minisat/core/Solver.h minisat/utils/System.h minisat/utils/ParseUtils.h
minisat/utils/Options.h minisat/simp/SimpSolver.h ;
do \
install -m 644 $h /usr/local/include/$h ; \
done
for h in maxhs/core/Bvars.h maxhs/core/Dimacs.h maxhs/core/MaxSolverTypes.h maxhs/core/Assumptions.h maxhs/core/Wcnf.h maxhs/core/MaxSolver.h maxhs/ifaces/miniSatSolver.h maxhs/ifaces/GreedySolver.h maxhs/ifaces/Cplex.h maxhs/ifaces/greedySatSolver.h maxhs/ifaces/muser.h maxhs/ifaces/SatSolver.h maxhs/ds/Packed.h maxhs/utils/io.h maxhs/utils/Params.h maxhs/utils/hash.h ;
do \
install -m 644 $h /usr/local/include/$h ; \
done
install -d /usr/local/lib
install -m 644 build/release/lib/libmaxhs.a /usr/local/lib
Linking Binary: build/release/bin/maxhs
/opt/ibm/ILOG/CPLEX_Studio128/cplex/lib/x86-64_linux/static_pic/libcplex.a(mkl_memory_patched.o): In function `mkl_serv_set_memory_limit':
mkl_memory.c:(.text+0x5a9): undefined reference to `dlopen'
mkl_memory.c:(.text+0x5ca): undefined reference to `dlsym'
mkl_memory.c:(.text+0x618): undefined reference to `dlsym'
mkl_memory.c:(.text+0x62e): undefined reference to `dlsym'
mkl_memory.c:(.text+0x644): undefined reference to `dlsym'
mkl_memory.c:(.text+0x739): undefined reference to `dlerror'
mkl_memory.c:(.text+0x78c): undefined reference to `dlopen'
mkl_memory.c:(.text+0x840): undefined reference to `dlopen'
mkl_memory.c:(.text+0x856): undefined reference to `dlerror'
mkl_memory.c:(.text+0x91a): undefined reference to `dlopen'
mkl_memory.c:(.text+0x922): undefined reference to `dlerror'
mkl_memory.c:(.text+0x937): undefined reference to `dlsym'
mkl_memory.c:(.text+0x95a): undefined reference to `dlopen'
mkl_memory.c:(.text+0x962): undefined reference to `dlerror'
mkl_memory.c:(.text+0x972): undefined reference to `dlsym'
mkl_memory.c:(.text+0x98d): undefined reference to `dlerror'
...
...
...
64_linux/static_pic/libcplex.a(mkl_semaphore.o): In function `_Init_MKL_Loader':
mkl_semaphore.c:(.text+0x4ed): undefined reference to `dladdr'
/opt/ibm/ILOG/CPLEX_Studio128/cplex/lib/x86-64_linux/static_pic/libcplex.a(libc_is_static_interface.o): In function `mkl_serv_libc_is_static':
libc_is_static_interface.c:(.text+0x10): undefined reference to `dladdr'
/opt/ibm/ILOG/CPLEX_Studio128/cplex/lib/x86-64_linux/static_pic/libcplex.a(load_library_HOST.o): In function `mkl_ueaa_prv_load_backend_lib':
load_library.c:(.text+0x1cd): undefined reference to `dlopen'
load_library.c:(.text+0x1ef): undefined reference to `dlvsym'
load_library.c:(.text+0x218): undefined reference to `dlvsym'
load_library.c:(.text+0x241): undefined reference to `dlvsym'
load_library.c:(.text+0x26a): undefined reference to `dlvsym'
load_library.c:(.text+0x293): undefined reference to `dlvsym'
/opt/ibm/ILOG/CPLEX_Studio128/cplex/lib/x86-64_linux/static_pic/libcplex.a(load_library_HOST.o):load_library.c:(.text+0x2bc): more undefined references to `dlvsym' follow
/opt/ibm/ILOG/CPLEX_Studio128/cplex/lib/x86-64_linux/static_pic/libcplex.a(mkl_aa_fw_load_orsl_lite_lib_HOST.o): In function `mkl_aa_fw_load_orsl_lite_lib':
mkl_aa_fw_load_orsl_lite_lib.c:(.text+0xb9): undefined reference to `dlopen'
mkl_aa_fw_load_orsl_lite_lib.c:(.text+0xd4): undefined reference to `dlsym'
mkl_aa_fw_load_orsl_lite_lib.c:(.text+0xf2): undefined reference to `dlsym'
mkl_aa_fw_load_orsl_lite_lib.c:(.text+0x110): undefined reference to `dlsym'
mkl_aa_fw_load_orsl_lite_lib.c:(.text+0x12e): undefined reference to `dlsym'
collect2: error: ld returned 1 exit status
Makefile:155: recipe for target 'build/release/bin/maxhs' failed
make: *** [build/release/bin/maxhs] Error 1
Really don't know what can cause the error as the library are the official licensed IBM cplex library and the only setup is the one who assign the right path to the IBM library. I guess i've done correctly this step as when the path was wrong and no IBM library was found i was getting another error.
Any ideas?
Thank you!

With CPLEX 12.8 you have to link with the dynamic linker library. You can see this in the example makefiles shipped with CPLEX. Looking at the Makefile in the MaxHS git repository, you could try changing the following line (this has not been tested):
MAXHS_LDFLAGS = -Wall -lz -L$(CPLEXLIBDIR) -lcplex -lpthread
to:
MAXHS_LDFLAGS = -Wall -lz -L$(CPLEXLIBDIR) -lcplex -lpthread -ldl
If that works, you should consider creating an issue for the maintainers of MaxHS.
Alternately, you could install an older version of CPLEX (e.g., 12.7.1).

Related

Error while building hello cargo example from docs

I have installed rust using rustup with the x86_64-pc-windows-gnu option while keeping all other options default. My operating system is Windows 8.
I am following the rust documentation/book for cargo.
When I run cargo build, I get the following error:
Compiling hello_cargo v0.1.0 (G:\Rust\hello_cargo)
error: linking with `G:\MinGW\x86_64-8.1.0-release-win32-sjlj-rt_v6-rev0\mingw64\bin\gcc.exe` failed: exit code: 1
|
= note: "G:\\MinGW\\x86_64-8.1.0-release-win32-sjlj-rt_v6-rev0\\mingw64\\bin\\gcc.exe" "-fno-use-linker-plugin" "-Wl,--dynamicbase" "-Wl,--disable-auto-image-base" "-m64" "-Wl,--high-entropy-va" "C:\\Users\\Maxim\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsbegin.o" "C:\\Users\\Maxim\\AppData\\Local\\Temp\\rustcjeAAq5\\symbols.o" "G:\\Rust\\hello_cargo\\target\\debug\\deps\\hello_cargo-1b0993b62f78ade0.1njww76hwcxxqiw.rcgu.o" "G:\\Rust\\hello_cargo\\target\\debug\\deps\\hello_cargo-1b0993b62f78ade0.1qzf4kdnnpu2g9nz.rcgu.o" "G:\\Rust\\hello_cargo\\target\\debug\\deps\\hello_cargo-1b0993b62f78ade0.2alld89bz5d1j920.rcgu.o" "G:\\Rust\\hello_cargo\\target\\debug\\deps\\hello_cargo-1b0993b62f78ade0.3od230eh6b5djim5.rcgu.o" "G:\\Rust\\hello_cargo\\target\\debug\\deps\\hello_cargo-1b0993b62f78ade0.3s35zamnay9959j7.rcgu.o" "G:\\Rust\\hello_cargo\\target\\debug\\deps\\hello_cargo-1b0993b62f78ade0.438lj7xxeji9yib.rcgu.o" "G:\\Rust\\hello_cargo\\target\\debug\\deps\\hello_cargo-1b0993b62f78ade0.5fez5aubm3fvq89b.rcgu.o" "G:\\Rust\\hello_cargo\\target\\debug\\deps\\hello_cargo-1b0993b62f78ade0.qszjihs90c7exes.rcgu.o" "G:\\Rust\\hello_cargo\\target\\debug\\deps\\hello_cargo-1b0993b62f78ade0.2d9vyibnz5v64h8e.rcgu.o" "-L" "G:\\Rust\\hello_cargo\\target\\debug\\deps" "-L" "C:\\Users\\Maxim\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "-Wl,--start-group"
"-Wl,-Bstatic" "C:\\Users\\Maxim\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd-fefff10efd686913.rlib" "C:\\Users\\Maxim\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libpanic_unwind-9c45725c63c0d5ed.rlib" "C:\\Users\\Maxim\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libobject-5e1c5cd9ff1eb7cc.rlib" "C:\\Users\\Maxim\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libmemchr-b6bf783b1c783d10.rlib" "C:\\Users\\Maxim\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libaddr2line-2241249e06c7cb40.rlib" "C:\\Users\\Maxim\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libgimli-03f5272f7c5d2bd2.rlib" "C:\\Users\\Maxim\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_demangle-8def22be308808fe.rlib" "C:\\Users\\Maxim\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd_detect-8931bc6a2b527206.rlib" "C:\\Users\\Maxim\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libhashbrown-6e27c0716ec027b4.rlib" "C:\\Users\\Maxim\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libminiz_oxide-c5bbe248c77f2f0b.rlib" "C:\\Users\\Maxim\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libadler-9148e9af213d2829.rlib" "C:\\Users\\Maxim\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_std_workspace_alloc-47941ef50057df8b.rlib" "C:\\Users\\Maxim\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libunwind-66b0ea2785827b9a.rlib" "C:\\Users\\Maxim\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcfg_if-4b65aaa3f0b095f9.rlib" "C:\\Users\\Maxim\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liblibc-04a1f133ddb50e5e.rlib" "C:\\Users\\Maxim\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc-f67804e146a91ffe.rlib" "C:\\Users\\Maxim\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_std_workspace_core-a5cbd3ad9e3068dd.rlib" "C:\\Users\\Maxim\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcore-4bc25ea8e4535542.rlib" "-Wl,--end-group" "C:\\Users\\Maxim\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcompiler_builtins-ac0b598a973ccaf7.rlib" "-Wl,-Bdynamic" "-ladvapi32" "-luserenv" "-lkernel32" "-lws2_32"
"-lbcrypt" "-lgcc_eh" "-l:libpthread.a" "-lmsvcrt" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-luser32" "-lkernel32" "-Wl,--nxcompat" "-L" "C:\\Users\\Maxim\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "-o" "G:\\Rust\\hello_cargo\\target\\debug\\deps\\hello_cargo-1b0993b62f78ade0.exe" "-Wl,--gc-sections" "-no-pie" "-nodefaultlibs" "C:\\Users\\Maxim\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsend.o"
= note: G:\Rust\hello_cargo\target\debug\deps\hello_cargo-1b0993b62f78ade0.1qzf4kdnnpu2g9nz.rcgu.o: In function `std::sys_common::backtrace::__rust_begin_short_backtrace':
/rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52\library\std\src\sys_common/backtrace.rs:118: undefined reference to `_Unwind_Resume'
G:\Rust\hello_cargo\target\debug\deps\hello_cargo-1b0993b62f78ade0.3s35zamnay9959j7.rcgu.o: In function `core::ops::function::FnOnce::call_once':
/rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52\library\core\src\ops/function.rs:248: undefined reference to `_Unwind_Resume'
C:\Users\Maxim\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libstd-fefff10efd686913.rlib(std-fefff10efd686913.std.1d6b1f25-cgu.0.rcgu.o): In function `alloc::collections::btree::mem::replace':
/rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\alloc\src\collections\btree/mem.rs:(.text+0x241): undefined reference to `_Unwind_Resume'
C:\Users\Maxim\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libstd-fefff10efd686913.rlib(std-fefff10efd686913.std.1d6b1f25-cgu.0.rcgu.o): In function `<std::io::Write::write_fmt::Adapter<T> as core::fmt::Write>::write_str':
/rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\std\src\io/mod.rs:1664: undefined reference to `_Unwind_Resume'
C:\Users\Maxim\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libstd-fefff10efd686913.rlib(std-fefff10efd686913.std.1d6b1f25-cgu.0.rcgu.o): In function `<std::io::Write::write_fmt::Adapter<T> as core::fmt::Write>::write_str':
/rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\std\src\io/mod.rs:1664: undefined reference to `_Unwind_Resume'
C:\Users\Maxim\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libstd-fefff10efd686913.rlib(std-fefff10efd686913.std.1d6b1f25-cgu.0.rcgu.o):/rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\std\src\io/mod.rs:1664: more undefined references to `_Unwind_Resume' follow
C:\Users\Maxim\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libpanic_unwind-9c45725c63c0d5ed.rlib(panic_unwind-9c45725c63c0d5ed.panic_unwind.cb21c7dc-cgu.0.rcgu.o): In function `panic_unwind::real_imp::panic':
/rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\panic_unwind\src/gcc.rs:62: undefined reference to `_Unwind_RaiseException'
C:\Users\Maxim\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libpanic_unwind-9c45725c63c0d5ed.rlib(panic_unwind-9c45725c63c0d5ed.panic_unwind.cb21c7dc-cgu.0.rcgu.o): In function `alloc::boxed::Box<T>::new':
/rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\alloc\src/boxed.rs:(.text+0x418): undefined reference to `_Unwind_Resume'
C:\Users\Maxim\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libpanic_unwind-9c45725c63c0d5ed.rlib(panic_unwind-9c45725c63c0d5ed.panic_unwind.cb21c7dc-cgu.0.rcgu.o): In function `rust_eh_personality':
/rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\panic_unwind\src/gcc.rs:276: undefined reference to `_GCC_specific_handler'
C:\Users\Maxim\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libobject-5e1c5cd9ff1eb7cc.rlib(object-5e1c5cd9ff1eb7cc.object.c08054e5-cgu.0.rcgu.o):object.c08054e5-cg:(.text+0x1f95): undefined reference to `_Unwind_Resume'
C:\Users\Maxim\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libobject-5e1c5cd9ff1eb7cc.rlib(object-5e1c5cd9ff1eb7cc.object.c08054e5-cgu.0.rcgu.o):object.c08054e5-cg:(.text+0x2b12): undefined reference to `_Unwind_Resume'
C:\Users\Maxim\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libgimli-03f5272f7c5d2bd2.rlib(gimli-03f5272f7c5d2bd2.gimli.823974b0-cgu.0.rcgu.o):gimli.823974b0-cgu:(.text+0xc2e): undefined reference to `_Unwind_Resume'
C:\Users\Maxim\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libgimli-03f5272f7c5d2bd2.rlib(gimli-03f5272f7c5d2bd2.gimli.823974b0-cgu.0.rcgu.o):gimli.823974b0-cgu:(.text+0x2be7): undefined reference to `_Unwind_Resume'
C:\Users\Maxim\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libgimli-03f5272f7c5d2bd2.rlib(gimli-03f5272f7c5d2bd2.gimli.823974b0-cgu.0.rcgu.o):gimli.823974b0-cgu:(.text+0x2c76): undefined reference to `_Unwind_Resume'
C:\Users\Maxim\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libgimli-03f5272f7c5d2bd2.rlib(gimli-03f5272f7c5d2bd2.gimli.823974b0-cgu.0.rcgu.o):gimli.823974b0-cgu:(.text+0x2e1f): more undefined references to `_Unwind_Resume' follow
collect2.exe: error: ld returned 1 exit status
= help: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
= note: use the `-l` flag to specify native libraries to link
= note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)
I deleted and reinstalled rust but the results were the same.
I didn't find anything useful on google. Any help would be greatly appreciated.

undefined reference to dss_ functions

I am new to fortran and cmake, so I'm sure there is a simple fix I am missing!
error message:
100%] Linking Fortran executable dynamicmpm
CMakeFiles/dynamicmpm.dir/Solver.FOR.o: In function `modsolver_mp_createprofiledss_':
Solver.FOR:(.text+0x1143): undefined reference to `dss_create_'
Solver.FOR:(.text+0x11a8): undefined reference to `dss_define_structure_'
Solver.FOR:(.text+0x1471): undefined reference to `dss_reorder_'
CMakeFiles/dynamicmpm.dir/Solver.FOR.o: In function `modsolver_mp_solveequations_':
Solver.FOR:(.text+0x35ec): undefined reference to `dss_factor_real_d__'
Solver.FOR:(.text+0x361d): undefined reference to `dss_solve_real_d_'
CMakeFiles/dynamicmpm.dir/Solver.FOR.o: In function `modsolver_mp_destroyequations_':
Solver.FOR:(.text+0x4495): undefined reference to `dss_delete_'
CMakeFiles/dynamicmpm.dir/Solver.FOR.o: In function `modsolver_mp_initialisereducedsolution_':
Solver.FOR:(.text+0x5a58): undefined reference to `dss_create_'
Solver.FOR:(.text+0x5abd): undefined reference to `dss_define_structure_'
Solver.FOR:(.text+0x606d): undefined reference to `dss_reorder_'
I included use mkl_dss at the top of the Solver.FOR file
inside the cmakefile:
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(MPM)
enable_language (Fortran)
set(CMAKE_Fortran_COMPILER_ID "GNU")
add_compile_options(-nologo -O2 -ldl -assume buffered_io -fpp -Dinternal_release
-reentrancy threaded -free -warn all -real_size 64 -Qauto -fp:strict
-fp:constant -libs:static -threads -Qmkl:sequential -Qm64
-fmax-identifier-length=63 -ffree-form -ffree-line-length-none -fdefault-real-8)
set(SRCS MOHRStrainSoftening.FOR getversion.for GlobalConstants.FOR mkl_dss.f90 String.for
Feedback.for FileIO.for MatrixMath.FOR timing.for ISORT.FOR GeoMath.FOR Counters.FOR
ElemCalcTETRA.FOR ReadCalculationData.FOR ElemCalcQUAD.FOR InitialiseKernel.FOR
ElemCalcTRI.FOR ReadMaterialData.FOR ElemCalc.FOR Particle.FOR MeshInfo.FOR
ElemConnections.FOR RotBoundCond.FOR ReadGeometryData.FOR InitialiseElementType.for
Solver.FOR MPMData.FOR WriteMPMData.FOR WriteVTKASCII.FOR TwoLayerFormulation.FOR
MPMDYNUnsatConsolidation.FOR WriteVTKBinary.FOR MPMStrainSmoothing.FOR WriteVTKOutput.FOR
MPMDYNConsolidation.FOR MPMStresses.FOR MPMDynContact.FOR MPMDynViscousBoundary.FOR
WriteTestData.FOR Liquid.FOR WriteVTK2Layer.FOR ReadMPMData.FOR RigidBody.f WriteNodalData.FOR
MPMMeshAdjustment.FOR MPMEmptyElements.FOR WriteResultData.FOR MPMConvPhase.FOR
ErrorHandler.for AdjustParticleDiscretisation.FOR MPMExcavation.FOR MPMInit.FOR MPMDYNBTSig.FOR
LagrangianPhase.FOR MPMDYNStresses.FOR MPMDYNConvPhase.FOR MPMQuasiStaticImplicit.FOR
MPMDynamicExplicit.FOR Kernel.for GetStrain.FOR Anura3D.for FORMDE.FOR BuildLoad.FOR
BuildDElastic.FOR MOHR.FOR BuildBJacDet.FOR PRNSTR.FOR GetPrinStress.FOR)
add_executable(dynamicmpm ${SRCS})
I'm sure I am just not linking it properly but I can't seem to find the mistake. I include mkl_dss.f90 in SRCS and have the appropriate use statement in SOLVER.FOR
I am including a link to my previous SO post in case that might be useful:
Executable file does not exist after compiling Fortran code

Include mongocxx drivers with Cmake results with undefined methods on Ubuntu

I have an issue with linking libmongocxx in my project.
I am using CMAKE to link the library and I am running Ubuntu 17.10.
Here is my CMakeLists.txt :
cmake_minimum_required(VERSION 3.9)
project(web_service_cpp)
SET(CMAKE_CXX_STANDARD 14)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
find_package(Boost REQUIRED)
find_package(Hana REQUIRED)
find_package(libmongocxx REQUIRED)
find_package(libbsoncxx REQUIRED)
add_library(libmongocxx INTERFACE IMPORTED)
set_property(TARGET libmongocxx PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${libmongocxx_INCLUDE_DIR})
add_library(boost INTERFACE IMPORTED)
set_property(TARGET boost PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR})
include_directories(${LIBMONGOCXX_INCLUDE_DIR})
include_directories(${LIBBSONCXX_INCLUDE_DIR})
include_directories("/usr/local/include/mongocxx/v_noabi")
include_directories("/usr/local/include/bsoncxx/v_noabi")
include_directories("/usr/local/include/libmongoc-1.0")
include_directories("/usr/local/include/libbson-1.0")
include_directories("/usr/local/lib")
include_directories("${PROJECT_SOURCE_DIR}")
set(SOURCE_FILES src/main.cpp
src/cMqttService.cpp
src/cMongoDB.cpp
src/cRepository.cpp)
set(HEADER_FILES include/cRepository.h
include/cMqttService.h
include/cMongoDB.h
include/main.h)
add_executable(web_service_cpp
${HEADER_FILES}
${SOURCE_FILES})
target_link_libraries(web_service_cpp ${LIBMONGOCXX_LIBRARIES})
target_link_libraries(web_service_cpp ${LIBBSONXX_LiBRARIES})
I find it weird that I am getting this error since it use to work on macOS :
[ 20%] Building CXX object
CMakeFiles/web_service_cpp.dir/src/main.cpp.o
[ 40%] Building CXX object CMakeFiles/web_service_cpp.dir/src/cMqttService.cpp.o
[ 60%] Building CXX object CMakeFiles/web_service_cpp.dir/src/cMongoDB.cpp.o
[ 80%] Building CXX object CMakeFiles/web_service_cpp.dir/src/cRepository.cpp.o
[100%] Linking CXX executable bin/bin/web_service_cpp
CMakeFiles/web_service_cpp.dir/src/cMqttService.cpp.o: In function `cMqttService::initCommunication()':
cMqttService.cpp:(.text+0x1da): undefined reference to `mqtt::async_client::async_client(std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&, mqtt::iclient_persistence*)'
cMqttService.cpp:(.text+0x225): undefined reference to `mqtt::connect_options::connect_options()'
cMqttService.cpp:(.text+0x266): undefined reference to `mqtt::connect_options::connect_options(mqtt::connect_options const&)'
cMqttService.cpp:(.text+0x286): undefined reference to `mqtt::async_client::connect(mqtt::connect_options)'
cMqttService.cpp:(.text+0x3ca): undefined reference to `mqtt::async_client::publish(std::shared_ptr)'
cMqttService.cpp:(.text+0x464): undefined reference to `mqtt::async_client::publish(mqtt::buffer_ref, void const*, unsigned long, int, bool)'
cMqttService.cpp:(.text+0x4ea): undefined reference to `mqtt::async_client::~async_client()'
cMqttService.cpp:(.text+0x63f): undefined reference to `mqtt::async_client::~async_client()'
CMakeFiles/web_service_cpp.dir/src/cMqttService.cpp.o: In function `mqtt::async_client::disconnect()':
cMqttService.cpp:(.text._ZN4mqtt12async_client10disconnectEv[_ZN4mqtt12async_client10disconnectEv]+0x36): undefined reference to `mqtt::disconnect_options::disconnect_options()'
CMakeFiles/web_service_cpp.dir/src/cMqttService.cpp.o: In function `void __gnu_cxx::new_allocator::construct, mqtt::buffer_ref, int&, bool&>(mqtt::message*, mqtt::buffer_ref&&, mqtt::buffer_ref&&, int&, bool&)':
cMqttService.cpp:(.text._ZN9__gnu_cxx13new_allocatorIN4mqtt7messageEE9constructIS2_JNS1_10buffer_refIcEES6_RiRbEEEvPT_DpOT0_[_ZN9__gnu_cxx13new_allocatorIN4mqtt7messageEE9constructIS2_JNS1_10buffer_refIcEES6_RiRbEEEvPT_DpOT0_]+0xdc): undefined reference to `mqtt::message::message(mqtt::buffer_ref, mqtt::buffer_ref, int, bool)'
CMakeFiles/web_service_cpp.dir/src/cMongoDB.cpp.o: In function `cMongoDB::cMongoDB(std::__cxx11::basic_string, std::allocator >, short)':
cMongoDB.cpp:(.text+0x63): undefined reference to `mongocxx::v_noabi::instance::instance()'
cMongoDB.cpp:(.text+0x7c): undefined reference to `mongocxx::v_noabi::uri::k_default_uri[abi:cxx11]'
cMongoDB.cpp:(.text+0x96): undefined reference to `mongocxx::v_noabi::uri::uri(bsoncxx::v_noabi::string::view_or_value)'
cMongoDB.cpp:(.text+0xb8): undefined reference to `mongocxx::v_noabi::client::client()'
cMongoDB.cpp:(.text+0x190): undefined reference to `mongocxx::v_noabi::uri::uri(bsoncxx::v_noabi::string::view_or_value)'
cMongoDB.cpp:(.text+0x1ad): undefined reference to `mongocxx::v_noabi::uri::operator=(mongocxx::v_noabi::uri&&)'
cMongoDB.cpp:(.text+0x1bc): undefined reference to `mongocxx::v_noabi::uri::~uri()'
cMongoDB.cpp:(.text+0x215): undefined reference to `mongocxx::v_noabi::client::client(mongocxx::v_noabi::uri const&, mongocxx::v_noabi::options::client const&)'
cMongoDB.cpp:(.text+0x232): undefined reference to `mongocxx::v_noabi::client::operator=(mongocxx::v_noabi::client&&)'
cMongoDB.cpp:(.text+0x241): undefined reference to `mongocxx::v_noabi::client::~client()'
cMongoDB.cpp:(.text+0x2e3): undefined reference to `mongocxx::v_noabi::client::~client()'
cMongoDB.cpp:(.text+0x2f6): undefined reference to `mongocxx::v_noabi::uri::~uri()'
cMongoDB.cpp:(.text+0x309): undefined reference to `mongocxx::v_noabi::instance::~instance()'
collect2: error: ld returned 1 exit status
CMakeFiles/web_service_cpp.dir/build.make:172: recipe for target 'bin/bin/web_service_cpp' failed
make[2]: *** [bin/bin/web_service_cpp] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/web_service_cpp.dir/all' failed
make[1]: *** [CMakeFiles/web_service_cpp.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
I am open to suggestions!
Thank you for your help in advance.
I found the solution to my problem. It is caused by all those hard coded strings that I used back on macOS.
cmake_minimum_required(VERSION 3.9)
project(web_service_cpp)
SET(CMAKE_CXX_STANDARD 14)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
find_package(Boost REQUIRED)
find_package(Hana REQUIRED)
find_package(OpenSSL REQUIRED)
find_library(paho-mqttpp3 NAMES libpaho-mqttpp3.so REQUIRED)
find_library(paho-mqtt3a NAMES libpaho-mqtt3a.so REQUIRED)
find_package(libmongocxx REQUIRED)
find_package(libbsoncxx REQUIRED)
add_library(libmongocxx INTERFACE IMPORTED)
add_library(libbsoncxx INTERFACE IMPORTED)
set_property(TARGET libmongocxx PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${LIBMONGOCXX_INCLUDE_DIRS})
set_property(TARGET libbsoncxx PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${LIBBSONCXX_INCLUDE_DIRS})
add_library(boost INTERFACE IMPORTED)
set_property(TARGET boost PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR})
add_library(pahottpp STATIC IMPORTED)
set_target_properties(pahottpp PROPERTIES IMPORTED_LOCATION ${paho-mqttpp3})
add_library(pahomqtt3a SHARED IMPORTED)
set_property(TARGET pahomqtt3a PROPERTY IMPORTED_LOCATION ${paho-mqtt3a})
include_directories(${LIBMONGOCXX_INCLUDE_DIRS} ${LIBBSONCXX_INCLUDE_DIRS})
link_directories(${LIBMONGOCXX_INCLUDE_DIRS})
link_directories(${LIBBSONCXX_INCLUDE_DIR})
include_directories("${PROJECT_SOURCE_DIR}")
set(SOURCE_FILES src/main.cpp
src/cMqttService.cpp
src/cMongoDB.cpp
src/cRepository.cpp)
set(HEADER_FILES include/cRepository.h
include/cMqttService.h
include/cMongoDB.h
include/main.h)
add_executable(web_service_cpp
${HEADER_FILES}
${SOURCE_FILES})
target_link_libraries(web_service_cpp ${LIBMONGOCXX_LIBRARIES} ${lIBBSONCXX_LIBRARIES} pahottpp pahomqtt3a)

Error while compiling gdb

I get the following error when compiling GDB.
../readline/libreadline.a ../opcodes/libopcodes.a ../bfd/libbfd.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -ldl -ltermcap -lz -lm -L/usr/lib/python2.7/config -lpthread -ldl -lutil -lm -lpython2.7 -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions -lexpat ../libiberty/libiberty.a build-gnulib/import/libgnu.a
python.o: In function `gdbpy_target_charset':
python.c:(.text+0x7b5): undefined reference to `PyUnicodeUCS2_Decode'
python.o: In function `gdbpy_target_wide_charset':
python.c:(.text+0x820): undefined reference to `PyUnicodeUCS2_Decode'
py-cmd.o: In function `cmdpy_function':
py-cmd.c:(.text+0x39b): undefined reference to `PyUnicodeUCS2_Decode'
py-cmd.o: In function `cmdpy_completer':
py-cmd.c:(.text+0x74c): undefined reference to `PyUnicodeUCS2_Decode'
py-cmd.c:(.text+0x7c0): undefined reference to `PyUnicodeUCS2_Decode'
py-frame.o:py-frame.c:(.text+0x29b): more undefined references to `PyUnicodeUCS2_Decode' follow
py-utils.o: In function `python_string_to_unicode':
py-utils.c:(.text+0xe1): undefined reference to `PyUnicodeUCS2_FromEncodedObject'
py-utils.o: In function `unicode_to_encoded_string':
py-utils.c:(.text+0x13c): undefined reference to `PyUnicodeUCS2_AsEncodedString'
py-utils.o: In function `unicode_to_encoded_python_string':
py-utils.c:(.text+0x1c7): undefined reference to `PyUnicodeUCS2_AsEncodedString'
py-utils.o: In function `target_string_to_unicode':
py-utils.c:(.text+0x409): undefined reference to `PyUnicodeUCS2_Decode'
py-value.o: In function `valpy_string':
py-value.c:(.text+0xb8b): undefined reference to `PyUnicodeUCS2_Decode'
py-value.o: In function `valpy_str':
py-value.c:(.text+0x141b): undefined reference to `PyUnicodeUCS2_Decode'
collect2: ld returned 1 exit status
make[2]: *** [gdb] Error 1
make[2]: Leaving directory
What might be the reason for it?

static link openssl to sqlcipher

I have build sqlcipher for Linux but it depends on openssl. I want to configure sqlcipher to work without external openssl library by linking it statically.
I configure sqlcipher with this command
./configure --prefix=/home/admin/Downloads/qt-everywhere-opensource-src-4.8.0/src/plugins/sqldrivers/sqlcipher/ --disable-shared --enable-static --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="/usr/lib64/libcrypto.a"
make
after that I got next strings:
/libtool --mode=link gcc -DSQLITE_HAS_CODEC -DSQLITE_OS_UNIX=1 -I. -I./src -I./ext/rtree -D_HAVE_SQLITE_CONFIG_H -DNDEBUG -I/usr/include -DSQLITE_THREADSAFE=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 /usr/lib64/libcrypto.a -DHAVE_READLINE=0 \
-o sqlite3 ./src/shell.c libsqlite3.la \
-lpthread -rpath "/home/admin/Downloads/qt-everywhere-opensource-src-4.8.0/src/plugins/sqldrivers/sqlcipher/lib"
libtool: link: gcc -DSQLITE_HAS_CODEC -DSQLITE_OS_UNIX=1 -I. -I./src -I./ext/rtree -D_HAVE_SQLITE_CONFIG_H -DNDEBUG -I/usr/include -DSQLITE_THREADSAFE=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DHAVE_READLINE=0 -o sqlite3 ./src/shell.c /usr/lib64/libcrypto.a ./.libs/libsqlite3.a -lpthread -Wl,-rpath -Wl,/home/admin/Downloads/qt-everywhere-opensource-src-4.8.0/src/plugins/sqldrivers/sqlcipher/lib
./.libs/libsqlite3.a(sqlite3.o): In function `sqlcipher_activate':
sqlite3.c:(.text+0xb66): undefined reference to `EVP_get_cipherbyname'
sqlite3.c:(.text+0xb70): undefined reference to `OPENSSL_add_all_algorithms_noconf'
./.libs/libsqlite3.a(sqlite3.o): In function `sqlcipher_random':
sqlite3.c:(.text+0xc0c): undefined reference to `RAND_bytes'
./.libs/libsqlite3.a(sqlite3.o): In function `sqlcipher_codec_ctx_set_cipher':
sqlite3.c:(.text+0x11a2): undefined reference to `EVP_get_cipherbyname'
sqlite3.c:(.text+0x11ba): undefined reference to `EVP_CIPHER_key_length'
sqlite3.c:(.text+0x11d4): undefined reference to `EVP_CIPHER_iv_length'
sqlite3.c:(.text+0x11ee): undefined reference to `EVP_CIPHER_block_size'
sqlite3.c:(.text+0x11fd): undefined reference to `EVP_sha1'
sqlite3.c:(.text+0x1205): undefined reference to `EVP_MD_size'
./.libs/libsqlite3.a(sqlite3.o): In function `sqlcipher_page_hmac':
sqlite3.c:(.text+0x1880): undefined reference to `HMAC_CTX_init'
sqlite3.c:(.text+0x1885): undefined reference to `EVP_sha1'
sqlite3.c:(.text+0x18b9): undefined reference to `HMAC_Init_ex'
sqlite3.c:(.text+0x18d9): undefined reference to `HMAC_Update'
sqlite3.c:(.text+0x18f8): undefined reference to `HMAC_Update'
sqlite3.c:(.text+0x1917): undefined reference to `HMAC_Final'
sqlite3.c:(.text+0x1929): undefined reference to `HMAC_CTX_cleanup'
./.libs/libsqlite3.a(sqlite3.o): In function `sqlcipher_page_cipher':
sqlite3.c:(.text+0x1b35): undefined reference to `EVP_CipherInit'
sqlite3.c:(.text+0x1b4a): undefined reference to `EVP_CIPHER_CTX_set_padding'
sqlite3.c:(.text+0x1b7a): undefined reference to `EVP_CipherInit'
sqlite3.c:(.text+0x1ba2): undefined reference to `EVP_CipherUpdate'
sqlite3.c:(.text+0x1bcc): undefined reference to `EVP_CipherFinal'
sqlite3.c:(.text+0x1be2): undefined reference to `EVP_CIPHER_CTX_cleanup'
./.libs/libsqlite3.a(sqlite3.o): In function `sqlcipher_cipher_ctx_key_derive':
sqlite3.c:(.text+0x1d3a): undefined reference to `PKCS5_PBKDF2_HMAC_SHA1'
sqlite3.c:(.text+0x1e08): undefined reference to `PKCS5_PBKDF2_HMAC_SHA1'
collect2: ld returned 1 exit status
make: *** [sqlite3] Error 1
I have installed openssl and openssl-dev packages and /usr/lib64/libcrypto.a exists.
What I do wrong?
Adjust your CFLAGS to include the path to the OpenSSL header files. Something like this:
CFLAGS="-DSQLITE_HAS_CODEC -I/path/to/openssl/include"

Resources