Closed momor10 closed 6 years ago
Can you try using gnu make (I think it should come with msys2)?
using make of msys2 (had to install by pacman -S make) it worked.
the result: cxxasn1.lib
however trying to link it with my project i get the following error:
cxxasn1.lib(cxx_lib_libcxxasn1_la-asn-buf.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MTd_StaticDebug' in in main.obj
my qt project file for the library:
LIBS += -L$$PWD/cxx-lib/libs/ -lcxxasn1
INCLUDEPATH += $$PWD
INCLUDEPATH += $$PWD/cxx-lib/inc
HEADERS += $$PWD/MyAsnFile.h
SOURCES += $$PWD/MyAsnFile.cpp
DISTFILES += \
$$PWD/cxx-lib/inc/snacc.h.in
going through the esnacc-ng\cxx-examples\automake.mk i dont see anything else that might be relevant putting in? did i miss something?
edit: tried using --enabled-shared and --enabled-static which both resulted in the same error when linking.
while compiling i get the following warning: libtool: warning: undefined symbols not allowed in x86_64-pc-msys shared libraries; building static only
momor10 notifications@github.com writes:
while compiling i get the following warning: libtool: warning: undefined symbols not allowed in x86_64-pc-msys shared libraries; building static only
1 that means it's trying to build the x64 version, right? how do i specify to build x86 ? 2 is it possible to make it compile shared libraries also?
The ./configure should support the flag "--enable-shared" - does that not work?
For the windows build, it seems we do the following:
./configure CC=build-aux/cccl CXX=build-aux/cccl LD="which link
" LIBS="-lws2_32 -liphlpapi"
Maybe that helps?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
using:
bash ./configure LD=linker.exe LIBS="-lws2_32 -liphlpapi"
results in:
PS D:\Projekte\esnacc-ng> make
/usr/bin/make all-am
make[1]: Entering directory '/d/Projekte/esnacc-ng'
compiler/esnacc.exe -C -mo `dirname cxx-lib/src/snaccrose.cpp` asn1specs/snaccrose.asn
make[1]: *** [Makefile:5099: cxx-lib/src/snaccrose.cpp] Error 127
make[1]: Leaving directory '/d/Projekte/esnacc-ng'
make: *** [Makefile:1371: all] Error 2
And
bash ./configure CC=build-aux/cccl CXX=build-aux/cccl LD=linker.exe LIBS="-lws2_32 -liphlpapi"
results in:
LINK : warning LNK4044: Nicht erkannte Option /I./compiler/core; wird ignoriert.
LINK : warning LNK4044: Nicht erkannte Option /I./c-lib/inc; wird ignoriert.
LINK : warning LNK4044: Nicht erkannte Option /I./compiler/back-ends; wird ignoriert.
LINK : warning LNK4044: Nicht erkannte Option /I.; wird ignoriert.
LINK : warning LNK4044: Nicht erkannte Option /DCOMPILER; wird ignoriert.
lt-esnacc.c
LINK : compiler/esnacc.exe wurde nicht gefunden oder beim letzten inkrementellen Linkvorgang nicht erstellt; vollständiger Link wird durchgeführt.
compiler/esnacc.exe -C -mo `dirname cxx-lib/src/snaccrose.cpp` asn1specs/snaccrose.asn
make[1]: *** [Makefile:5099: cxx-lib/src/snaccrose.cpp] Error 127
make[1]: Leaving directory '/d/Projekte/esnacc-ng'
make: *** [Makefile:1371: all] Error 2
The Error when trying to use the lib:
cxxasn1.lib(cxx_lib_libcxxasn1_la-snaccexcept.obj):-1: Fehler: LNK2038: Konflikt ermittelt für "RuntimeLibrary": Der Wert "MT_StaticRelease" stimmt nicht mit dem Wert "MD_DynamicRelease" in main.obj überein.
on stackoverflow someone said (not to me):
The library and your project must be linked with the same settings with regards to the C Runtime Library. In your case one was linked against the CRT DLL (/MD) and the other was linked statically (/MT). You just need to make sure both match and this error will go away. source: https://stackoverflow.com/questions/28887001/lnk2038-mismatch-detected-for-runtimelibrary-value-mt-staticrelease-doesn
However im not sure how to find out what to do? do i need to compile esnacc differently? do i need to compile my project using the lib differently? how do i found which is linked how?
edit: even with --enabled-shared i will get an:
libtool: warning: undefined symbols not allowed in x86_64-pc-msys shared libraries; building static only (im using the 32bit version of msys2)
edit2: after trying the -no-undefined because of the "libtool: warning: undefined symbols not allowed":
bash ./configure LD=linker.exe --enable-shared --build=i686-pc-msys --host=i686-pc-msys
make results in:
cl : Befehlszeile error D8021 : Ungültiges numerisches Argument /Wl,-DLL,-IMPLIB:cxx-lib/.libs/cxxasn1.dll.lib.
make[1]: *** [Makefile:1641: cxx-lib/libcxxasn1.la] Error 2
make[1]: Leaving directory '/d/Projekte/esnacc-ng'
make: *** [Makefile:1370: all] Error 2
worked like that:
bash ./configure LD=linker.exe --enable-shared CFLAGS=-MD CXXFLAGS=-MD --build=i686-pc-msys --
host=i686-pc-msys
LIBS += -L$$PWD/cxx-lib/libs/ -lcxxasn1
LIBS += -L$$PWD/cxx-lib/libs/ -lcxxasn1rose
INCLUDEPATH += $$PWD
INCLUDEPATH += $$PWD/cxx-lib/inc
HEADERS += $$PWD/CoopIts.h
SOURCES += $$PWD/CoopIts.cpp
QMAKE_CFLAGS_MT+=$$PWD/cxx-lib/inc
QMAKE_CXXFLAGS_MT+=$$PWD/cxx-lib/inc
this doesnt solve the problem about the shared libraries not being compiled. however now at least im able to use the static libraries in my msvc2017 qt Project. Just for anyone having the same problem.
thx @orgcandman for your help in both cases here and about the "syntax in the asn file" thread.
edit: i didnt test it yet, i only managed to compile and start the software without crashing. i hope there are no problems about solving it like that?
and still have a lot of linker warnings like:
udpthread.obj:-1: Warnung: LNK4217: Lokal definiertes Symbol "??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void))" wurde in "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall std::basic_stringbuf<char,struct std::char_traits<char>,class std::allocator<char> >::str(void)const " (?str@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ)-Funktion importiert.
im trying to build esnacc with msvc 2017 and msys2 on windows 10. i already managed to compile it using mingw. However i need to use esnacc (encode data in per and send uper udp stream) in a windows c++/qt application using msvc2017.
Using msys2 i managed to boot and configure esnacc using the following command:
the resulting output:
trying to compile it with jom or nmake will result in the following errors
The docs say msvc 2013 is supported, however there is no step by step description on how to make it compile (using automake?)