I committed changes yesterday that configure the thing with CMake, so linux compatibility is half-done now. I'll try to implement the platform interface and test it this afternoon, but it may have to wait for this weekend depending on exactly what my workload looks like.
Tari wrote:
I committed changes yesterday that configure the thing with CMake, so linux compatibility is half-done now. I'll try to implement the platform interface and test it this afternoon, but it may have to wait for this weekend depending on exactly what my workload looks like.


Just curious.... is the LuaZM stuff done yet? (if this is on the back burner and won't be done for a while, dont worry, I understand Smile )
Getting key reading requires the platform to intercept reads/writes to an arbitrary memory address, which afaik isn't implemented. (@Tari: LuaZM directly polls the keyboard port)
That's already implemented in the library, but the UI doesn't support input in any fashion yet. I am indeed emulating MMIO, though (as noted in the readme) it's unlikely to work on 32-bit systems.
Tari wrote:
That's already implemented in the library, but the UI doesn't support input in any fashion yet. I am indeed emulating MMIO, though (as noted in the readme) it's unlikely to work on 32-bit systems.


I have a 64-bit cpu but i'm running 32-bit linux. will it work?
I haven't actually run it on Linux, but I think it'll work. The main requirement for those fixed mappings is that the requested addresses be in user (rather than kernel) space. On 32-bit Windows, user space is 0x00000000-0x80000000, and the rest is kernel space. The MMIO that's of interest, meanwhile is around 0xA00000000. Linux appears to use a 3GB region for userspace so it should work (0xC0000000 and above unavailable). With a 64-bit operating system, the user/kernel split gets pushed a lot higher, so it's not a concern.

The best way to see if it'll work on your system is just to run it. It's smart enough to tell you if it's not possible to reserve the regions, and warns that certain things may cause it to crash:
Quote:
Failed to create fixed mapping for VRAM.
Failed to create fixed mapping for keyboard registers.
Things may go bad very quickly.
And if sizeof(void *) <= 4:
Quote:
Fixed allocation will not usually work on 32-bit systems, which this appears to be.
Oh, ok cool. Just to verify, there is not a linux version out just yet, correct?
Correct, I didn't find the time to implement the platform interface today. Probably tomorrow afternoon, since that'll be the start of my weekend.
Bump.

I implemented the unix platform interface so the thing should be usable on Linux (and other unices) at this point, though I haven't actually tested that.

Notes on using it right now: both the UI and CL-backed programs need to take the shared memory name as arguments on the command line. On windows this can be any string as long as it doesn't contain a backslash, and it should be the name of an existent file that it can clobber freely on unix.
I intend to allow the UI to launch the backend program on its own (via some sort of dialog) eventually, but that's a low priority beyond implementing features that I have need for while building pLemmings.
Can I download a tarball somewhere?
Yes, from bitbucket (see the first post in the thread, which I edited to include URLs). Downloads->Branches->default will get you a snapshot of the current dev tree.
I ran cmake, got no errors, then ran make, and got this error:


Code:

flyingfisch@Office-OptiPlex-745:~/Downloads/tari-fx-cg-cl-6fd1a5e93a95$ make
[ 14%] Building C object CMakeFiles/fx-cg-cl.dir/platform/unix.c.o
/home/flyingfisch/Downloads/tari-fx-cg-cl-6fd1a5e93a95/platform/unix.c: In function ‘platform_munmap’:
/home/flyingfisch/Downloads/tari-fx-cg-cl-6fd1a5e93a95/platform/unix.c:29:5: warning: incompatible implicit declaration of built-in function ‘memset’ [enabled by default]
/home/flyingfisch/Downloads/tari-fx-cg-cl-6fd1a5e93a95/platform/unix.c: In function ‘platform_map_free’:
/home/flyingfisch/Downloads/tari-fx-cg-cl-6fd1a5e93a95/platform/unix.c:64:18: error: ‘size’ undeclared (first use in this function)
/home/flyingfisch/Downloads/tari-fx-cg-cl-6fd1a5e93a95/platform/unix.c:64:18: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [CMakeFiles/fx-cg-cl.dir/platform/unix.c.o] Error 1
make[1]: *** [CMakeFiles/fx-cg-cl.dir/all] Error 2
make: *** [all] Error 2
Okay, it looks like I started implementing the unix platform stuff, then decided on a new approach to take with it and rewrote the win32 interface and forgot to finish the unix one. In any case, I just pushed a version that I've confirmed compiles, but whether it will correctly link and run is another question.
Code:
[02:33:25 ~/fx-cg-cl/build]
[tari@Kirishima]$ make
[ 14%] Building C object CMakeFiles/fx-cg-cl.dir/debug.c.o
[ 28%] Building C object CMakeFiles/fx-cg-cl.dir/display.c.o
[ 42%] Building C object CMakeFiles/fx-cg-cl.dir/input.c.o
[ 57%] Building C object CMakeFiles/fx-cg-cl.dir/interface.c.o
[ 71%] Building C object CMakeFiles/fx-cg-cl.dir/main.c.o
[ 85%] Building C object CMakeFiles/fx-cg-cl.dir/rtc.c.o
[100%] Building C object CMakeFiles/fx-cg-cl.dir/platform/unix.c.o
Linking C static library libfx-cg-cl.a
[100%] Built target fx-cg-cl


I'm currently traveling, so don't expect much from me for the rest of the week. I appreciate your bug reports though!
Tari wrote:
Okay, it looks like I started implementing the unix platform stuff, then decided on a new approach to take with it and rewrote the win32 interface and forgot to finish the unix one. In any case, I just pushed a version that I've confirmed compiles, but whether it will correctly link and run is another question.
Code:
[02:33:25 ~/fx-cg-cl/build]
[tari@Kirishima]$ make
[ 14%] Building C object CMakeFiles/fx-cg-cl.dir/debug.c.o
[ 28%] Building C object CMakeFiles/fx-cg-cl.dir/display.c.o
[ 42%] Building C object CMakeFiles/fx-cg-cl.dir/input.c.o
[ 57%] Building C object CMakeFiles/fx-cg-cl.dir/interface.c.o
[ 71%] Building C object CMakeFiles/fx-cg-cl.dir/main.c.o
[ 85%] Building C object CMakeFiles/fx-cg-cl.dir/rtc.c.o
[100%] Building C object CMakeFiles/fx-cg-cl.dir/platform/unix.c.o
Linking C static library libfx-cg-cl.a
[100%] Built target fx-cg-cl


I'm currently traveling, so don't expect much from me for the rest of the week. I appreciate your bug reports though!


Do you have a win32 version I could try out then?
You'll be better off building it yourself. Smile Basically the same procedure with cmake on Windows as it is on Linux. For example, what I do with Visual Studio 2012:
Code:
$ cmake -G "Visual Studio 11 Win64" ..
Then open up the solution it generates in Visual Studio and go to town compiling it. I've been using the win32 platform code, so that's known-working.

Any project that links against the library will need to have its library and include paths updated to include the headers and static library for [CL], just as you'd have to do with GCC.

For pLemmings, I've set it up with CMake and keep a copy of FX-CG[CL] under its source directory as a submodule, so it's pretty easy. Relevant parts of the CMakeLists for that:

Code:
cmake_minimum_required(VERSION 2.6)
project(pLemmings)

file(GLOB SOURCES "${PROJECT_SOURCE_DIR}/*.c")
add_executable(pLemmings ${SOURCES})

set_property(SOURCE "${PROJECT_SOURCE_DIR}/main.c"
             PROPERTY COMPILE_DEFINITIONS main=fxcg_main)
add_subdirectory("${PROJECT_SOURCE_DIR}/fx-cg-cl")
include_directories(BEFORE "${PROJECT_SOURCE_DIR}/fx-cg-cl/include")
target_link_libraries(pLemmings fx-cg-cl)
In this way, simply building pLemmings ensures the library is up-to-date and easily handles the search paths.
I tried to compile CL and it gave me:

Code:
C:\Users\Kids\repos\main.o:main.c:(.text+0x4f): undefined reference to `interface_init'
C:\Users\Kids\repos\main.o:main.c:(.text+0x58): undefined reference to `display_init'
C:\Users\Kids\repos\main.o:main.c:(.text+0x61): undefined reference to `input_init'
C:\Users\Kids\repos\main.o:main.c:(.text+0x99): undefined reference to `fxcg_main'
C:\Users\Kids\repos\main.o:main.c:(.text+0x9e): undefined reference to `input_fini'
C:\Users\Kids\repos\main.o:main.c:(.text+0xa3): undefined reference to `display_fini'
C:\Users\Kids\repos\main.o:main.c:(.text+0xa8): undefined reference to `interface_fini'
Looks like you're trying to build an addin and not linking against the [CL] library. More details, please (what are your trying to do, and what are you running?).
I was using Code::Blocks to compile main.c. I'm using Windows right now.
I'm going to assume you didn't run CMake, which would be the problem.. CMake has a CodeBlocks generator, which you may like. Running cmake without any parameters will make it print a list of available generators:
Quote:
CodeBlocks - MinGW Makefiles= Generates CodeBlocks project files.
CodeBlocks - NMake Makefiles= Generates CodeBlocks project files.
CodeBlocks - Unix Makefiles = Generates CodeBlocks project files.
eg
Code:
C:\Users\Kids\repos> mkdir build
C:\Users\Kids\repos> cd build
C:\Users\Kids\repos\build> cmake -G "CodeBlocks - NMake Makefiles" ..
And open the project file it generates.

You can't just build main.c and expect it to work, because it's several modules.
The CMake thing gives me this:


Code:
The C compiler identification is unknown
The CXX compiler identification is unknown
Check for working C compiler: bcc32
CMake Error: your C compiler: "bcc32" was not found.   Please set CMAKE_C_COMPILER to a valid compiler path or name.
CMake Error: Internal CMake error, TryCompile configure of cmake failed
Check for working C compiler: bcc32 -- broken
CMake Error at C:/Users/Kids/Downloads/cmake-2.8.10.2-win32-x86/cmake-2.8.10.2-win32-x86/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler "bcc32" is not able to compile a simple test program.

  It fails with the following output:

   

 

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)


CMake Error: your C compiler: "bcc32" was not found.   Please set CMAKE_C_COMPILER to a valid compiler path or name.
CMake Error: your CXX compiler: "bcc32" was not found.   Please set CMAKE_CXX_COMPILER to a valid compiler path or name.
Configuring incomplete, errors occurred!
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 2 of 5
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement