Changeset 627bacf in OpenModelica


Ignore:
Timestamp:
2022-05-16T11:15:02+02:00 (23 months ago)
Author:
GitHub <noreply@…>
Branches:
maintenance/v1.20, maintenance/v1.21, maintenance/v1.22, master
Children:
caa3fcca
Parents:
520e4d0b
git-author:
Mahder Gebremedhin <mahge@…> (05/16/22 11:15:02)
git-committer:
GitHub <noreply@…> (05/16/22 11:15:02)
Message:

Build libOpenModelicaRuntimeC and libomcgc as DLLs. (#8961)

  • We now build both of these libs as dlls on Windows. They are already built as shared libraries on linux.

We build libomcgc as shared library because we do not want to ever have
two instances of the garbage collector linked into one binary (exe or dll)
ever. Having two instances of the garbage collector leads to quite
ominous bugs that would be vey difficult to find. See #8738 and #8955
Just avoid the possibility altogether.

We build libOpenModelicaRuntimeC as a dll because it saves memory.
It is linked to every simulation executable we generate and there is
no reason to duplicate it in every one of those executables. We will
see what implications this will have for FMUs.

Fixes #8738.

Location:
OMCompiler
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • OMCompiler/3rdParty

    • Property commit changed from 0321aa8528eb7d2a954f406c796087a64d365083 to af9b79766959e92cd3e996da37c50d9226b28ae0
  • OMCompiler/Compiler/Util/Autoconf.mo.omdev.mingw

    r395c1164 r627bacf  
    1919                                     " -lsundials_sunlinsoldense -lsundials_sunlinsolklu -lsundials_sunlinsollapackdense -lsundials_sunlinsolspbcgs -lsundials_sunlinsolspfgmr -lsundials_sunlinsolspgmr -lsundials_sunlinsolsptfqmr -lsundials_sunnonlinsolnewton" +
    2020                                     " -lsundials_cvode -lsundials_cvodes -lsundials_idas -lsundials_kinsol";
    21   constant String ldflags_basic = linkType + "-lomcgc -lregex -ltre -lintl -liconv -lexpat -static-libgcc -luuid -loleaut32 -lole32 -limagehlp -lws2_32 -llis" +
     21  constant String ldflags_basic = " -lomcgc " + linkType + "-lregex -ltre -lintl -liconv -lexpat -static-libgcc -luuid -loleaut32 -lole32 -limagehlp -lws2_32 -llis" +
    2222                                  ldflags_sundials +
    2323                                  ldflags_suitesparse +
  • OMCompiler/Makefile.common

    rd77d5a5 r627bacf  
    145145
    146146boehm-gc:  boehm-gc-lib $(OMBUILDDIR)/include/omc/c/gc.h $(OMBUILDDIR)/include/omc/c/gc_config_macros.h $(OMBUILDDIR)/include/omc/c/gc_version.h $(OMBUILDDIR)/include/omc/c/gc_pthread_redirects.h
    147 $(OMBUILDDIR)/$(LIB_OMC)/libomcgc.a: 3rdParty/gc/.libs/libomcgc.a
     147$(builddir_bin)/libomcgc-1.dll: 3rdParty/gc/.libs/libomcgc-1.dll
    148148  cp -p $< $@
    149 3rdParty/gc/.libs/libomcgc.a: 3rdParty/gc/Makefile
     149  cp -p 3rdParty/gc/.libs/libomcgc.dll.a $(builddir_lib)/omc/libomcgc.dll.a
     1503rdParty/gc/.libs/libomcgc-1.dll: 3rdParty/gc/Makefile
    150151  $(MAKE) -C 3rdParty/gc/ libomcgc.la
    151152$(OMBUILDDIR)/include/omc/c/gc.h: 3rdParty/gc/include/gc.h
     
    158159  cp -pPR $< $@
    1591603rdParty/gc/Makefile: 3rdParty/gc/configure.ac
    160   (cd 3rdParty/gc && mkdir -p m4 libatomic_ops/m4 && autoreconf -vif && automake --add-missing && ./configure --prefix="`pwd`" "--host=$(host)" $(LIBGC_EXTRA_CONFIGURATION) --enable-static --disable-gcj-support --disable-java-finalization --enable-large-config CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS) -DLARGE_CONFIG -DTHREAD_LOCAL_ALLOC")
     161  (cd 3rdParty/gc && mkdir -p m4 libatomic_ops/m4 && autoreconf -vif && automake --add-missing && ./configure --prefix="`pwd`" "--host=$(host)" $(LIBGC_EXTRA_CONFIGURATION) --enable-shared --disable-static --disable-gcj-support --disable-java-finalization --enable-large-config CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS) -DLARGE_CONFIG -DTHREAD_LOCAL_ALLOC")
    161162
    162163ipopt:
  • OMCompiler/Makefile.omdev.mingw

    rd77d5a5 r627bacf  
    328328  (time $(MAKE) -f $(defaultMakefileTarget) CFLAGS="$(CFLAGS)" omc-bootstrapped OMBUILDDIR=$(OMBUILDDIR))
    329329
    330 boehm-gc-lib: $(OMBUILDDIR)/$(LIB_OMC)/libomcgc.a
     330boehm-gc-lib: $(builddir_bin)/libomcgc-1.dll
    331331
    332332
  • OMCompiler/SimulationRuntime/c/Makefile.common

    raf03d959 r627bacf  
    197197  $(CC) -shared -o $@ $(BASE_OBJS) $(GCOBJPATH_MINIMAL) $(LDFLAGS)
    198198
     199libOpenModelicaRuntimeC.dll: $(BASE_OBJS) Makefile.objs
     200  @rm -f $@
     201  $(CC) -shared -o $@ $(BASE_OBJS) $(LDFLAGS) -L$(OMBUILDDIR)/lib/omc -lomcgc -ldbghelp -lregex -Wl,--export-all-symbols,--out-implib,$@.a
     202
    199203libOpenModelicaRuntimeC.dylib: $(BASE_OBJS) $(GCOBJPATH_MINIMAL) Makefile.objs
    200204  @rm -f $@
     
    271275
    272276bootstrap-dependencies: $(LIBRUNTIME)
     277ifeq (MINGW,$(findstring MINGW,$(shell uname)))
     278  cp -p $(LIBRUNTIME) $(builddir_bin)
     279#   copy the import (dll.a) lib as well.
     280  cp -p $(LIBRUNTIME).a $(builddir_lib)
     281else
    273282  cp -p $(LIBRUNTIME) $(builddir_lib)
     283endif
    274284  # copy header files
    275285  cp -p $(RUNTIME_HEADERS) $(builddir_inc)/c/
  • OMCompiler/SimulationRuntime/c/Makefile.omdev.mingw

    raec55cb r627bacf  
    3636CONFIG_H=$(top_builddir)/Compiler/runtime/config.h
    3737LIBSIMULATION=libSimulationRuntimeC.a
    38 LIBRUNTIME=libOpenModelicaRuntimeC.a
     38LIBRUNTIME=libOpenModelicaRuntimeC.dll
    3939LIBFMIRUNTIME=libOpenModelicaFMIRuntimeC.a
    4040CMINPACK_NO_DLL=-DCMINPACK_NO_DLL
  • OMCompiler/SimulationRuntime/c/cmake_3.14.cmake

    rdf7454a1 r627bacf  
    8888  target_link_libraries(SimulationRuntimeC PUBLIC wsock32)
    8989  set_target_properties(SimulationRuntimeC PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS true)
    90 endif(WIN32)
     90endif(MINGW)
    9191
    9292if(OM_OMC_ENABLE_IPOPT)
  • OMCompiler/omc_config.h

    r8529da7 r627bacf  
    8989
    9090/* adrpo: add -loleaut32 as is used by ExternalMedia */
    91 #define DEFAULT_LDFLAGS "-fopenmp -Wl,-Bstatic -lregex -ltre -lintl -liconv -lexpat -lomcgc -lpthread -loleaut32 -limagehlp -lhdf5 -lz -lszip -Wl,-Bdynamic"
     91#define DEFAULT_LDFLAGS "-fopenmp -Wl,-Bstatic -lregex -ltre -lintl -liconv -lexpat -lpthread -loleaut32 -limagehlp -lhdf5 -lz -lszip -Wl,-Bdynamic"
    9292
    9393#define CONFIG_WITH_OPENMP 1
Note: See TracChangeset for help on using the changeset viewer.