top of page
Search
sharikabieudk

Curl Devel Mingw Compiler: Understanding the Differences between MSYS2, MinGW-w64 and Cygwin



Install 32-bit Cygwin (version 2.10 or later) in a location that does not have any spaces in its pathname. The default and preferred location is c:\cygwin. Do not use locations under Program Files, Documents and Settings, or any other directory containing a space in its name. Be sure to select and install the following packages: from the Devel category: gcc-core, gcc-fortran, make from the Libs category: libcurl-devel, libexpat-devel from the Net category: curl from the X11 category: xinit, xview-devel If you are updating a previous Cygwin/32 installation of the WFDB Software Package, we recommend updating your Cygwin installation first, using Cygwin's setup-x86 tool.


Install 64-bit Cygwin (version 2.10 or later) in a location that does not have any spaces in its pathname. The default and preferred location is c:\cygwin64. Do not use locations under Program Files, Documents and Settings, or any other directory containing a space in its name. Be sure to select and install the following packages: from the Devel category: gcc-core, gcc-fortran, make from the Libs category: libcurl-devel, libexpat-devel from the Net category: curl If you are updating a previous Cygwin/64 installation of the WFDB Software Package, we recommend updating your Cygwin installation first, using Cygwin's setup-x86_64 tool.




Curl Devel Mingw Compiler




Use MinGW's gcc to produce WFDB and curl DLLs in Windowsnative format. You can use any other compiler that is compatible with WindowsDLLs to compile application code and link it to these WFDB and curlDLLs, and to other third-party DLLs if you wish.


I found a solution! On MSYS2 just do "pacman -Sy mingw-w64-x86_64-curl" which installs the binaries and the header files. The info was here -msys2 and I have no idea why this is not in the curl downloads page or why MinGW on MSYS is not mentioned at all.


c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/curlx86/libcurl.a(easy.o):(.text+0x8f): undefined reference to libssh2_init'c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/curlx86/libcurl.a(easy.o):(.text+0x16b): undefined reference tolibssh2_exit'c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/curlx86/libcurl.a(http2.o):(.text+0xcd): undefined reference to nghttp2_version'c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/curlx86/libcurl.a(http2.o):(.text+0x2ca): undefined reference tonghttp2_submit_rst_stream'c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/curlx86/libcurl.a(http2.o):(.text+0x2dc): undefined reference to nghttp2_session_send'c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/curlx86/libcurl.a(http2.o):(.text+0x31d): undefined reference tonghttp2_session_set_stream_user_data'c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/curlx86/libcurl.a(http2.o):(.text+0x3c0): undefined reference to nghttp2_pack_settings_payload'c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/curlx86/libcurl.a(http2.o):(.text+0x4bd): undefined reference tonghttp2_session_resume_data'c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/curlx86/libcurl.a(http2.o):(.text+0x4fe): undefined reference to nghttp2_session_mem_recv'c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/curlx86/libcurl.a(http2.o):(.text+0x51c): undefined reference tonghttp2_strerror'c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/curlx86/libcurl.a(http2.o):(.text+0x5c3): undefined reference to nghttp2_priority_spec_init'c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/curlx86/libcurl.a(http2.o):(.text+0x614): undefined reference tonghttp2_submit_priority'c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/curlx86/libcurl.a(http2.o):(.text+0x621): undefined reference to `nghttp2_session_send'


I finally was able to link cURL correctly (I think) to Code Blocks (GNU compiler) and get all the dll issues sorted. It was able to compile and run correctly once, then stopped working with new errors associated with libcurl.a(url.o). The two errors are


I also have the curl lib in my linker search directories and curl include compiler search directories. I put them in according to the instructions found online at -tutorial/a3-using-libraries-with-codeblocks/ Because it built and worked once, I think these settings are correct but I am at the limits of my understanding this part of programming.


In the MSYS2 bash shell, use pacman again to install the build toolchain and compilers. Run the command below to install the mingw-w64-x86_64-toolchain package group.


More work is needed to actually develop Nit programs under a Windows environment. Simple programs like hello_world and Fibonacci work well outside of cygwin. However the compiler still expects UNIX-like paths and can't find nit_dir.


  • MinGW-w64 provides a development and runtime environment for 32- and64-bit (x86 and x64) Windows applications using the Windows API andthe GNU Compiler Collection (gcc).This package contains the C compiler, supportingcross-compiling to 32-bit MinGW-w64 targets. Other Packages Related to gcc-mingw-w64-i686 depends

  • recommends

  • suggests

  • enhances

dep:binutils-mingw-w64-i686 (>= 2.30) Cross-binutils for Win32 (x86) using MinGW-w64 dep:gcc-mingw-w64-base (= 8.3.0-6+21.3deb10u2) GNU Compiler Collection for MinGW-w64 (base package) dep:libc6 (>= 2.15) [amd64, mips64el, s390x] GNU C Library: Shared libraries also a virtual package provided by libc6-udeb dep:libc6 (>= 2.17) [arm64] dep:libc6 (>= 2.22) [ppc64el] dep:libc6 (>= 2.28) [armel, armhf, i386, mips, mipsel] dep:libgcc1 (>= 1:4.2) [not armel, armhf, i386] GCC support library dep:libgcc1 (>= 1:4.3) [armel, armhf] dep:libgcc1 (>= 1:7) [i386] dep:libgmp10 Multiprecision arithmetic library dep:libisl19 (>= 0.15) manipulating sets and relations of integer points bounded by linear constraints dep:libmpc3 multiple precision complex floating-point library dep:libmpfr6 (>= 3.1.3) multiple precision floating-point computation dep:libstdc++6 (>= 5.2) GNU Standard C++ Library v3 dep:mingw-w64-i686-dev Development files for MinGW-w64 targeting Win32 dep:zlib1g (>= 1:1.1.4) compression library - runtime sug:gcc-8-locales (>= 8.3.0) GCC, the GNU compiler collection (native language support files) Download gcc-mingw-w64-i686 Download for all available architectures ArchitecturePackage SizeInstalled SizeFiles amd6434,666.4 kB142,439.0 kB [list of files] arm6432,305.3 kB133,913.0 kB [list of files] armel30,351.0 kB126,919.0 kB [list of files] armhf31,004.5 kB107,215.0 kB [list of files] i38635,862.7 kB145,795.0 kB [list of files] mips32,280.8 kB151,143.0 kB [list of files] mips64el32,861.1 kB160,157.0 kB [list of files] mipsel32,772.5 kB150,917.0 kB [list of files] ppc64el34,917.5 kB162,093.0 kB [list of files] s390x32,314.2 kB146,131.0 kB [list of files] This page is also available in the following languages (How to set the default document language):


To be compatible with current Python on Windows, we need to buildagainst matching Microsoft C Runtime library. For Python 2.4 and 2.5MSVCR71 was used, for Python 2.6 the right one is MSVCR90. To achievebuilding against different MSVCRT, you need to adjust compilerspecifications, example is shown in cmake/mingw.spec, which is used byCMakeLists.txt. You might need to tune it for your environment.


just to clarify, by default, CmdStanR creates directory "$HOME/.cmdstanr " and inside that, you have directories name cmdstan for whatever you get from CmdStan develop branch from github, or the specified release name. the stanc compiler is found in a subdir named bin.


pacman -S makepacman -S mingw-w64-i686-gccpacman -S mingw-w64-i686-SDL2pacman -S mingw-w64-i686-SDL2_imagepacman -S mingw-w64-i686-curlpacman -S mingw-w64-i686-openalpacman -S mingw-w64-i686-pkg-configpacman -S mingw-w64-i686-libvorbis


I have Ubuntu 20.04, i am using GDNative in a project and i can compile for linux just fine but when i compile for windows and i have mingw installed as said in the doc it throw a g++ error "Command line option not found. Did you mean... so this is a compiler error i guess. So how to fix this ? Has anyone compiled for windows under linux please help me.


MinGW already supports UCRT and R-devel can be built with it, but thorough testing is needed and experiments with packages require rebuilding all code from scratch, ensuring to object file built with MSVCRT gets in, hence all libraries for packages to test. Note that MinGW and hence the compiler toolchain itself has to be built for either MSVCRT or UCRT, as MinGW takes care of the C runtime part that is compiler specific (and some of that needs to be).


Getting such a compiler toolchain is easy as scripts and docker files are readily available, provided and used by at least MinGW developers and MXE. These scripts typically build the compiler toolchain on Linux: they build a cross-compiler using the compilers and tools available on Linux and cross-build the native compilers, binutils, MinGW runtime, etc, including several libraries needed by GCC itself.


  • The information on building Fossil inside anOCI container is now ina separate document.This includes the instructions on using the OCI container as anexpedient intermediary for building a statically-linked Fossil binary onmodern Linux platforms, which otherwise make this difficult.6.0 Building on/for Android6.1 Cross-compiling from LinuxThe following instructions for building Fossil for Android via Linux,without requiring a rooted OS, are adapted froma forum post.On the development machine, from the fossil source tree:export CC=$NDK_PATH/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang./configure --with-openssl=nonemakeOn the Android device, enable the USB debugging option fromDeveloper menu in Device Options. Connect the device to the developmentsystem with USB. If it's configured and connected properly,the device should show up in the output of adb devices:sudo adb devicesCopy the resulting fossil binary onto the device...sudo adb push fossil /data/local/tmpAnd run it from an adb shell:sudo adb shell> cd /data/local/tmp# Fossil requires a HOME directory to work with:> export HOME=$PWD> export PATH=$PWD:$PATH> fossil versionThis is fossil version 2.11 [e5653a4ceb] 2020-03-26 18:54:02 UTCThe output might, or might not, include warnings such as:WARNING: linker: ./fossil: unused DT entry: type 0x6ffffef5 arg 0x1464WARNING: linker: ./fossil: unused DT entry: type 0x6ffffffe arg 0x1ba8WARNING: linker: ./fossil: unused DT entry: type 0x6fffffff arg 0x2The source of such warnings is not 100% certain.Some information about these (reportedly harmless) warnings canbe foundon this StackOverflow post.7.0 Building for Fuzz TestingThis feature is primarily intended for fossil's developers and maychange at any time. It is only known to work on Linux systems and hasbeen seen to work on x86/64 and ARM.Fossil has builtin support for processing specific features usinglibfuzzer. The features which can be tested this way arefound in the help text for the test-fuzzcommand.Fuzzing requires:Customizing the build of fossil a small bit.

  • The clang C compiler.

  • libfuzzer. On Ubuntu-derived systems, it can be installed with apt install libfuzzer-XYZ, where XYZ is a version number (several versions may be available on any given system)

  • First, modify the top-level Makefile.in:Extend the TCCFLAGS variable with: -fsanitize=fuzzer -DFOSSIL_FUZZ (and see src/fuzz.c for more options).

  • Rename APPNAME from fossil to fossil-fuzz.

  • Then rebuild:$ make clean$ ./configure CC=/path/to/clang$ makeIf clang is your default compiler, the CC configure option isnot required.The resulting fossil-fuzz binary differs from the standardone primarily in that it runs the test-fuzz command bydefault. It needs to be told what to fuzz and needs to be given adirectory of input files to seed the fuzzer with:$ mkdir cases # Copy input files into ./cases. e.g. when fuzzing the markdown # processor, copy any to-be-tested .md files into that directory. # Then start the fuzzer:$ ./fossil-fuzz --fuzztype markdown casesAs it works, it writes its mutated test files into the test-inputdirectory, each one named in the form of a hash. When it finds aproblem it will produce a stack trace for the offending code, willoutput the name of the file which triggered the crash (namedcases/SOME_HASH) and may, depending on the nature of theproblem, produce a file named crash-SOMETHING. In theory thecrash file can be fed directly back into the fuzzer to reproduce theproblem:$ ./fossil-fuzz --fuzztype markdown crash-SOMETHINGBut whether or not it will genuinely crash may depend on staticapp-level state which might not trigger the crash when running anindividual test.For a detailed information about the fuzzer's flags and features, see:

  • Flags for the fuzzer can be passed directly to fossil,e.g. -jobs=4 to start four fuzzer jobs in parallel, but doingso may cause the fuzzer to strip the --fuzztype flag, leadingto it testing the wrong thing. When passing on fuzzer-specific flagsalong with --fuzztype, be sure to check your system's processlist to ensure that your --fuzztype flag is there.8.0 Building WebAssembly ComponentsAs of version 2.19, fossil uses one component built asWebAssemblya.k.a. WASM. Because compiling WASM code requires non-trivialclient-side tooling, the repository includes compiled copies of thesepieces. Most Fossil hackers should never need to concern themselveswith the WASM parts, but this section describes how to for those whowant or need to do so.The bits described in this section are necessary when updatingextsrc/pikchr.c from the upstream source, or thefossil binary will use a different version of pikchr than/pikchrshow does (as the latter runs the WASM build of pikchr).These instructions have only ever been tested on Linux systems. They"should" work on any Unix-like system supported by Emscripten. Thefossil makefiles for Windows builds do not include any of theWASM-related components (patches to add that would be welcomed, ofcourse).The first step is to configure the tree with support forEmscripten. This requires that the systemhas the Emscripten SDK (a.k.a. emsdk) installed, as documented at: _started/downloads.htmlFor instructions on keeping the SDK up to date, see: _reference/emsdk.htmlSidebar: getting Emscripten up and running is trivial and painless, at least on Linux systems, but the installer downloads many hundreds of megabytes of tools and dependencies, all of which will be installed under the single SDK directory (as opposed to being installed at the system level). It does, however, require that python3 be installed at the system level and it can optionally make use of a system-level cmake for certain tasks unrelated to how fossil uses the SDK.After installing the SDK, configure the fossil tree with emsdksupport:$ ./configure --with-emsdk=/path/to/emsdk ...other options...If the --with-emsdk flag is not provided, the configurescript will check for the environment variable EMSDK, whichis one of the standard variables the SDK environment uses. If thatvariable is found, its value will implicitly be used in place of themissing --with-emsdk flag. Thus, if the emsdk_env.shscript is sourced into the shell before running the configure script,the SDK will be detected even without the config flag.The configure script installs some makefile variables which tell thebuild where to find the SDK and it generates a script namedtools/emcc.sh (from the template file/tools/emcc.sh.in), which is awrapper around the Emscripten C compiler (emcc). The wrapperscript uses the configure-time state to attempt to set up the variousenvironment variables which are required by emcc and willfail if it cannot do so. Once it's set up the environment, it passeson all of its arguments to emcc.The WASM-related build parts are set up such that none of them shouldever trigger implicity (e.g. via dependencies resolution) in a normalbuild cycle. They are instead explicitly built as described below.From the top of the source tree, all WASM-related components can bebuilt with:$ make wasmAs of this writing, those parts include:extsrc/pikchr.wasm is a WASM-compiled form of extsrc/pikchr.c.

  • extsrc/pikchr.js is JS/WASM glue code generated by Emscripten to give JS code access to the API exported by the WASM file.

  • Sidebar: The file extsrc/pikcher-worker.js is hand-coded and intended to be loaded as a "Worker" in JavaScript. That file loads the main module and provides an interface via which a main JavaScript thread can communicate with pikchr running in a Worker thread. The file src/fossil.page.pikchrshowasm.js implements the /pikchrshow app and demonstrates how pikchr-worker.js is used.When a new version of extsrc/pikchr.c is installed, thefiles pikchr.js,wasm will need to be recompiled to accountfor that. Running make wasm will, if the build is set up forthe emsdk, recompile those:$ make wasm./tools/emcc.sh -o extsrc/pikchr.js ...$ ls -la extsrc/pikchr.js,wasm-rw-rw-r-- 1 stephan stephan 17263 Jun 8 03:59 extsrc/pikchr.js-rw-rw-r-- 1 stephan stephan 97578 Jun 8 03:59 extsrc/pikchr.wasmSidebar: if that fails with a message along the lines of:setting `EXPORTED_RUNTIME_METHODS` expects `` but got ``then the emcc being invoked is too old: emcc changed the format oflist-type arguments at some point. The required minimum version isunknown, but any SDK version from May 2022 or later "should" (as ofthis writing) suffice. Any older version may or may not work.After that succeeds, we need to run the normal build so that thosegenerated files can be compiled in to the fossil binary, accessiblevia the /builtin page:$ makeBefore checking in those newly-built files, they need to be tested byrunning the /pikchrshow page. If that page loads, the compilationprocess fundamentally worked (a load failure will be made obvious tothe viewer). If it fails to load then the browser's dev tools consolelikely provides at least a small hint (and sometimes a usefulhint) about the nature of the problem. Don't check those files inuntil /pikchrshow runs, though!Should pikchr's C interface ever change, pikchr-worker.jswill need to be updated to accommodate it, but such modification istypically trivial.8.1 Solutions other than Emscripten?Emscripten is not the only option for building C as WASM, but itprovides a complete toolchain which eliminates many other steps whichmust otherwise be accounted for on a per-project basis. Despite itsconvenience, it behooves us to explore other build options for thesake of portability and avoiding what amounts to vendor lock-in.For later refererence, here are articles specifically coveringbuilding WASM projects without using Emscripten: -to-webassembly/

  • -without-emscripten

2ff7e9595c


0 views0 comments

Recent Posts

See All

Comments


bottom of page