Closed Heuristics closed 6 years ago
Good news, it appears as if my mingw came with a pthreads by default (found this out after trying out a precompiled one from the net).
So, I fixed this by changing a little in sodium\transaction.h
I changed this:
#ifdef __linux
#include <pthread.h>
#else
#include <pthread/pthread.h>
#endif
into this:
#ifdef __linux
#include <pthread.h>
#elif __MINGW32__
#include <pthread.h>
#else
#include <pthread/pthread.h>
`#endif``
It looks like the compile finished ok now. (have not yet tested if it works)
BR/ Christoffer
I attempted to write a simple hello world style application with Sodium and it did not go so well, I am guessing the compililation was not done correctly.
The code:
#include <iostream>
#include <sodium/sodium.h>
using namespace std;
int main() {
cout << "Hello world!" << endl;
sodium::transaction<> trans;
return 0;
}
If the line sodium::transaction<> trans;
is commented out this application prints hello world as expected, but if it is not commented out then the application does not print anything out, just exits. This is a little too odd for me to know what is going on.
Sorry about the delay in replying. I didn't get notified for some reason. I would really like to sort these kinds of issues out. I'll have time to do so when I have finished the book, which is really soon.
@the-real-blackh: Is there any chance to see Sodium work with Visual Studio?
Why the dependency on pthreads
? Aren't std
or boost
threads and associated utilities sufficient?
I'd certainly appreciate help with this. I have a lot of things on my priority list before I get to that. Here are my priorities at the moment:
I'm using the C++ version in a commercial project so the code is pretty solid. Having said that, there is a very tricky memory management issue to do with cycles and the use of reference counting pointers. This will affect you if you use a 'switch' a lot. I am working on a solution for this in a directory called v2/
Now that I've finished the book writing, the Java version is the model, but I need to bring the other implementations up to the same standard. This will mostly involve code for generating the same test cases in different languages.
If you split the project into the component languages I am sure that the community will help with ports and contributions. As it stands it is nigh on impossible to just pull the C++ version without pulling the other versions along with it.
GR
Sent from my Nexus 5. On 4 Feb 2016 7:56 p.m., "the-real-blackh" notifications@github.com wrote:
I'd certainly appreciate help with this. I have a lot of things on my priority list before I get to that. Here are my priorities at the moment:
I'm using the C++ version in a commercial project so the code is pretty solid. Having said that, there is a very tricky memory management issue to do with cycles and the use of reference counting pointers. This will affect you if you use a 'switch' a lot. I am working on a solution for this in a directory called v2/
Now that I've finished the book writing, the Java version is the model, but I need to bring the other implementations up to the same standard. This will mostly involve code for generating the same test cases in different languages.
— Reply to this email directly or view it on GitHub https://github.com/SodiumFRP/sodium/issues/53#issuecomment-180022728.
OK - I'll do that.
The C++ version is now a separate repo 'sodium-cxx'. I'd love to see some work on getting this going on Windows.
Can be closed i guess… https://github.com/SodiumFRP/sodium-cxx/pull/7
I was interested in this project and attempted to compile it in windows. I do not know if windows via mingw is even a target that the maintainer is interested in supporting (if not then just ignore this)
My setup: Windows 7 with gcc (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 4.8.3
I generated build files with cmake, this went fine, I just had to tell it where my boost libs were.
Then I attempted to kick off the build.
in sodium\lock_pool.h it complained at "#error This architecture is not supported"
I guess this is due to mingw 64bits not definining WORDSIZE. So I added: `#ifndef WORDSIZE
#define __WORDSIZE 64
#endif` At the top of the file and then that went away.
Then the second problem: in sodium\transaction.h The compiler cannot find
#include <pthread/pthread.h>
This is off course due to me not having pthreads installed (Edit: spoiler alert, I was wrong about this, see next post). I would recommend stating that pthreads is a requirement for building the project.Alternatively (and I prefer this solution, but I have no idea if it is viable), replace pthreads with boost threads since they are multiplatform and a dependency on boost already exists.This is where I am at currently, just wanted to let you know. Back to googling for pthreads in mingw.
BR/ Christoffer