Send Beginners mailing list submissions to beginners@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners or, via email, send a message with subject or body 'help' to beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. Re: Error Message: Can not find C library. How can I do this? (Henk-Jan van Tuyl) 2. Re: Error Message: Can not find C library. How can I do this? (Edgar Klerks) ---------------------------------------------------------------------- Message: 1 Date: Fri, 01 Mar 2019 19:02:42 +0100 From: "Henk-Jan van Tuyl" <hjgt...@chello.nl> To: beginners@haskell.org Subject: Re: [Haskell-beginners] Error Message: Can not find C library. How can I do this? Message-ID: <op.zxzi2whfpz0j5l@alquantor> Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Did you try setting environment variable LIBRARY_PATH? Something like: Set LIBRARY_PATH=%LIBRARY_PATH%;C:\wxWidgets\lib You might need to set C_INCLUDE_PATH as well, for the header files. Regards, Henk-Jan van Tuyl On Tue, 26 Feb 2019 07:47:59 +0100, S. H. Aegis <shae...@gmail.com> wrote: > Hello. > > I’m new to stack & FFI. > > I created a dll file by http://www.mingw.org/wiki/sampleDLL > [...] > *Configuring test2-0.1.0.0...* > *Cabal-simple_Z6RU0evB_2.4.0.1_ghc-8.6.3.exe: Missing dependency on a > foreign* > *library:* > ** Missing (or bad) C library: example_dll.a* [...] > How can I fix this? I did a lot of things on the webpages, but I could > not. > > Please, help me. > > > > Sincerely, S. Chang. -- Message from Stanford University: Folding@home What if you could share your unused computer power to help find a cure? In just 5 minutes you can join the world's biggest networked computer and get us closer sooner. Watch the video. http://foldingathome.stanford.edu/ -- http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- ------------------------------ Message: 2 Date: Fri, 1 Mar 2019 20:42:01 +0100 From: Edgar Klerks <edgar.kle...@gmail.com> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] Error Message: Can not find C library. How can I do this? Message-ID: <CAGAUyt=xug7y0k1znbmqqwehcxzbbbqj102qa+m5hwq5zzr...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" You made a small typo: example_dll.cpp, example_dll.dll, example_dll.h, example_dll.o, example_exe.cpp, *libexample_dll.a* And in your code, you call it example_dll.a instead of libexample_dll.a: > > extra-libraries: > - example_dll.a > That should probably be: extra-libraries: - libexample_dll.a On Tue, Feb 26, 2019 at 7:48 AM S. H. Aegis <shae...@gmail.com> wrote: > Hello. > > I’m new to stack & FFI. > > I created a dll file by http://www.mingw.org/wiki/sampleDLL > > And I put all files into dll folder. (Those files are example_dll.cpp, > example_dll.dll, example_dll.h, example_dll.o, example_exe.cpp, > libexample_dll.a) I test example_exe.exe file, and confirmed that works. > > (Windows7 Pro, stack 1.9.3) > > <package.yaml> > > executables: > > test2-exe: > > main: Main.hs > > source-dirs: app > > ghc-options: > > - -threaded > > - -rtsopts > > - -with-rtsopts=-N > > dependencies: > > - test2 > > extra-libraries: > > - example_dll.a > > extra-lib-dirs: > > - dll > > <stack.yaml> > > # Extra directories used by stack for building > > extra-include-dirs: > > - dll > > extra-lib-dirs: > > - dll > > <Main.hs> > > {-# LANGUAGE ForeignFunctionInterface #-} > > > > module Main where > > > > -- import Lib > > import Foreign > > > > foreign import ccall "example_dll.h hello" > > c_hello :: IO() > > > > main :: IO () > > main = c_hello > > <example_dll.cpp> > > #include <stdio.h> > > #include "example_dll.h" > > > > __stdcall void hello(const char *s) > > { > > printf("Hello %s\n", s); > > } > > int Double(int x) > > { > > return 2 * x; > > } > > void CppFunc(void) > > { > > puts("CppFunc"); > > } > > void MyClass::func(void) > > { > > puts("MyClass.func()"); > > } > > > > When I try to stack build, I get error messages. > > > > *C:\Users\shaegis\Documents\Haskell\test2\dll>stack build* > > *Building all executables for `test2' once. After a successful build of > all of them, only specified executables will be rebuilt.* > > *test2-0.1.0.0: configure (lib + exe)* > > *Configuring test2-0.1.0.0...* > > *Cabal-simple_Z6RU0evB_2.4.0.1_ghc-8.6.3.exe: Missing dependency on a > foreign* > > *library:* > > ** Missing (or bad) C library: example_dll.a* > > *This problem can usually be solved by installing the system package that* > > *provides this library (you may need the "-dev" version). If the library > is* > > *already installed but in a non-standard location then you can use the > flags* > > *--extra-include-dirs= and --extra-lib-dirs= to specify where it is.If the* > > *library file does exist, it may contain errors that are caught by the C* > > *compiler at the preprocessing stage. In this case you can re-run > configure* > > *with the verbosity flag -v3 to see the error messages.* > > > > *-- While building package test2-0.1.0.0 using:* > > * > C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_2.4.0.1_ghc-8.6.3.exe > --builddir=.stack-work\dist\e626a42b configure > --with-ghc=C:\Users\shaegis\AppData\Local\Programs\stack\x86_64-windows\ghc-8.6.3\bin\ghc.EXE > --with-ghc-pkg=C:\Users\shaegis\AppData\Local\Programs\stack\x86_64-windows\ghc-8.6.3\bin\ghc-pkg.EXE > --user --package-db=clear --package-db=global > --package-db=C:\sr\snapshots\3233b5e2\pkgdb > --package-db=C:\Users\shaegis\Documents\Haskell\test2\.stack-work\install\784ab3f0\pkgdb > --libdir=C:\Users\shaegis\Documents\Haskell\test2\.stack-work\install\784ab3f0\lib > --bindir=C:\Users\shaegis\Documents\Haskell\test2\.stack-work\install\784ab3f0\bin > --datadir=C:\Users\shaegis\Documents\Haskell\test2\.stack-work\install\784ab3f0\share > --libexecdir=C:\Users\shaegis\Documents\Haskell\test2\.stack-work\install\784ab3f0\libexec > --sysconfdir=C:\Users\shaegis\Documents\Haskell\test2\.stack-work\install\784ab3f0\etc > --docdir=C:\Users\shaegis\Documents\Haskell\test2\.stack-work\install\784ab3f0\doc\test2-0.1.0.0 > --htmldir=C:\Users\shaegis\Documents\Haskell\test2\.stack-work\install\784ab3f0\doc\test2-0.1.0.0 > --haddockdir=C:\Users\shaegis\Documents\Haskell\test2\.stack-work\install\784ab3f0\doc\test2-0.1.0.0 > --dependency=base=base-4.12.0.0 > --extra-include-dirs=C:\Users\shaegis\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include > --extra-include-dirs=C:\Users\shaegis\Documents\Haskell\test2\dll > --extra-lib-dirs=C:\Users\shaegis\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\bin > --extra-lib-dirs=C:\Users\shaegis\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\lib > --extra-lib-dirs=C:\Users\shaegis\Documents\Haskell\test2\dll > --enable-tests --enable-benchmarks* > > *Process exited with code: ExitFailure 1* > > > > How can I fix this? I did a lot of things on the webpages, but I could not. > > Please, help me. > > > > Sincerely, S. Chang. > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20190301/a7d4fe5d/attachment.html> ------------------------------ Subject: Digest Footer _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners ------------------------------ End of Beginners Digest, Vol 129, Issue 1 *****************************************