Comments (4)
I haven't used pulp to build the C++ target, but it looks like it should be ok, as long as you end up with the standard results in the output
directory and then use the default Makefile
described here: https://github.com/pure11/pure11#getting-started. But can you try using those instructions instead (no pulp
, just make
for everything), and see how that goes? It looks to me like your include paths aren't there for some reason. See also http://andyarvanitis.com/hello-world-purescript-cpp/ (even though you're on Windows, but much of it still applies).
from purescript-native.
Actually, sorry, I was wrong, it doesn't look related to make paths -- I'm guessing you have the wrong versions of the packages, probably retrieved by pulp
. Please try using psc-package
(it's the "official" tool for the C++ backend) using either of those instructions I've linked, and let me know if you're still having problems.
from purescript-native.
Yes, you are right, I have wrong versions of the packages!
psc-package work fine, I use ./pcc first , and then psc-package update, then make. And works fine .
I follow this article http://andyarvanitis.com/hello-world-purescript-cpp/ , and finally I got compiled sucessfully!! And also got vs2015 compiled successful!!! Thank you very much !!
The instructions are :
1, install mingw : http://iweb.dl.sourceforge.net/project/mingw-w64/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/mingw-w64-install.exe
chosse version 6.3.0
architecture i686
threads posix
exception sjlj
build revision 1
2,createWorkingDir, "workDir" for example.
3, mkdir src
4,copy some Main.purs to src
for eaxmple, the content of Main.purs is
module Main where
import Prelude
import Control.Monad.Eff.Console (log, logShow)
main = do
logShow(2)
5, ./pcc
you can get pcc.exe as follows
git clone https://github.com/andyarvanitis/purescript-native.git
stack setup
stack build
then you should find pcc.exe
or you can download all exe you needed in
https://github.com/jellyr/ConvertPure11ToVS2015/releases/tag/1.0 for pcc.exe and vbs
https://github.com/purescript/purescript/releases purescript exes
make sure these exes is in your system path!!
6, make
note: The make file won't work on my current mingw on windows 10. It report errors as follows :
$ make
Makefile:26: extraneous text after 'ifeq' directive
Makefile:92: *** missing 'endif'. Stop.
Then I change
ifeq ($(GC),yes)
override CXXFLAGS += -DUSE_GC
override LDFLAGS += -lgc
endif
to
ifeq ($(GC),yes)
override CXXFLAGS += -DUSE_GC
endif
ifeq ($(GC),yes)
override LDFLAGS += -lgc
endif
The make will work fine!
one more thing to note
@mkdir -p $(BIN_DIR)
the windows mkdir cmd do not support -p arg, excute mingw-w64.bat as your terminal.
7,now, you should see "main.exe" in your output\bin dir!
now,let's convert it to vs2015 project, *.vcxproj.
download vbs from https://github.com/jellyr/ConvertPure11ToVS2015/blob/master/ConvertPure11ToVS2015.vbs
8, put the vbs to your working dir, the same path as your Makefile .
the architecture should look like
output
-------Control.Applicative
-------Control.Apply
-------And so on
src
---------Main.purs
Makefile
psc-package.json
ConvertPure11ToVS2015.vbs
9, run ConvertPure11ToVS2015.vbs
you should see YourOwnProjectName.vcxproj in your output dir,
open it with VS2015, build it.
10, you should see an error .
Show_ffi.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class std::locale::id std::codecvt<char32_t,char,struct _Mbstatet>::id" (__imp_?id@?$codecvt@_UDU_Mbstatet@@@std@@2V0locale@2@A)
11,it is vs2015's bug. see https://social.msdn.microsoft.com/Forums/vstudio/en-US/8f40dcd8-c67f-4eba-9134-a19b9178e481/vs-2015-rc-linker-stdcodecvt-error?forum=vcgeneral for detail.
open show_ffi.cc
change
static std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t> utf32conv;
to
static std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> utf32conv;
12, Now, if every thing goes right, your should see
1> YourOwnProjectName.vcxproj -> E:\hs\pur11HelloWorld\output\Debug\YourOwnProjectName.exe
1> YourOwnProjectName.vcxproj -> E:\hs\pur11HelloWorld\output\Debug\YourOwnProjectName.pdb (Full PDB)
13, cheer!!!!
for example, I want test Maybe Monad.
module Main where
import Prelude
import Control.Monad.Eff.Console (log, logShow)
import Data.Maybe
main = do
logShow $ (Nothing::Maybe Int) >>= \x -> pure $x * 10
logShow $ (Just 3::Maybe Int ) >>= \x -> pure $ x * 10
I can add ,
maybe to psc-package.json and then run cmd psc-package update
or run command psc-package install maybe
and then run make
gcc will compile success , then run vbs as above instructions and compile use vs2015. I it will success too!
great!!! but It seems there's some other issues , I'll write on another thread.
from purescript-native.
Great! And thanks for the detailed notes. I haven't had any issues with mingw or VS2015 in the past, but I'll have a closer look at your notes and try it again soon.
from purescript-native.
Related Issues (20)
- ObjectUpdate seems to need deep copy HOT 2
- Cannot find ls/ls.h and rs/rs.h HOT 2
- Incorrect equality check in Data_Interval_Duration_Iso HOT 3
- Returning a constant from the ffi HOT 7
- "attribute 'haskell-nix' missing" when building with nix HOT 3
- error building purescript-dotlang HOT 16
- Support spago alternate entry point option
- ffi array type interop with opaque types HOT 7
- zero-fill shift right operator doesn't exist HOT 11
- pass arguments to run HOT 2
- stack nix integration HOT 1
- Problems with nix toolchain HOT 9
- Consider combining executables (and specify backend with switch) HOT 5
- un-gitignore cabal files HOT 2
- cpp binary size HOT 4
- Update to PureScript 0.14 HOT 5
- Webassembly / Emscripten with C++ HOT 1
- Upgrade to Latest PureScript Version
- Backend "psgo" exited with error:1 HOT 2
- go module initialization HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from purescript-native.