Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Conversation

@pramodk
Copy link
Collaborator

@pramodk pramodk commented Oct 26, 2019

coreneuron now build as submodule of neuron on windows and runs ring test:

Screenshot 2019-10-27 at 01 24 39

@pramodk pramodk requested a review from nrnhines October 26, 2019 23:26
@pramodk
Copy link
Collaborator Author

pramodk commented Oct 27, 2019

@nrnhines : everything works if build static library of coreneuron (which is default). With shared library if I build as:

cmake ..  -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=`pwd`/install -DCOMPILE_LIBRARY_TYPE=SHARED

Then what produced is following and I get link error while running:

Screenshot 2019-10-27 at 12 40 46

If I build as submodule then everything works because I believe Cmake of neuron has some extra settings that influence how libraries/dlls are generated.

Do you remember what we have done in NEURON to properly generate dlls?

@nrnhines
Copy link
Collaborator

I wonder if I'm using my own wrappers for dlopen, etc., implemented in
src/oc/cygwinprt.c. At least I see

$ nm libnrniv.dll.a |grep dlopen
0000000000000000 I __imp_dlopen_noerr
0000000000000000 T dlopen_noerr
0000000000000000 I __imp_dlopen
0000000000000000 T dlopen

and

$ grep DLFCN nrnconf.h
/* #undef HAVE_DLFCN_H */

and it is part of the liboc_la_SOURCES in nrn/src/oc/Makefile.am

@nrnhines
Copy link
Collaborator

And also look at how dlopen is declared in src/nrniv/nrnpy.cpp with

#ifdef MINGW
#define RTLD_NOW 0
#define RTLD_GLOBAL 0
#define RTLD_NOLOAD 0
extern "C" {
extern void* dlopen_noerr(const char* name, int mode);
#define dlopen dlopen_noerr
extern void* dlsym(void* handle, const char* name);
extern int dlclose(void* handle);
extern char* dlerror();
}
#else
//#define _GNU_SOURCE
#include <dlfcn.h>
#endif

@pramodk
Copy link
Collaborator Author

pramodk commented Oct 27, 2019

@nrnhines : note that we are not using dlopen in coreneuron. The issue is coming from the fact that the lib directory only contains .dll.a files which are helper files but actual dlls are in build/coreneuron directory which are not being copied in bin directory:

Screenshot 2019-10-27 at 18 52 35

@pramodk
Copy link
Collaborator Author

pramodk commented Oct 27, 2019

Ok, got it! It's following CMake property:

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)

@pramodk pramodk merged commit cb56a28 into master Oct 28, 2019
@pramodk pramodk deleted the mingw branch October 28, 2019 18:00
pramodk added a commit to neuronsimulator/nrn that referenced this pull request Nov 2, 2022
* Use CMAKE_SHARED_LIBRARY_SUFFIX instead of .so (required for windows/mingw)
* Fix for exe suffix and make sure to have dlls in bin directory
* adjust runtime output only for coreneuron directory
* define mingw definition

CoreNEURON Repo SHA: BlueBrain/CoreNeuron@cb56a28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants