'socket.http' DLLs aren't found when Lua is compiled - lua

I've started to really get into using Lua, and a few months ago I've figured out on how to turn .lua files into executables.
It's been working great so far, until I started to compile lua scripts that use 'socket.http'. It seems to be missing some DLLs of some sort, and I don't know how I would be able to add them into the same folder.
Where would I find these such DLLs to add into the same folder of my executable, so that I could be able to run Lua executables using socket.http?

socket.http module doesn't come as DLL; it comes as a pure-lua module. Usually there is socket.lua and socket\http.lua files (as well as socket\core.dll), so you'd need to package all of them and make them available to your script to make it work.
You can find the Lua files in the luasocket repository, but make sure that they match the API for the binaries (socket/core.* files) you are using.

Related

javac not recognizing external libraries

I have a working version of my project in eclipse.
I exported the project as a runnable jar.
Extracted (after converting to .zip)and tried to compile a particular java file from the command prompt
(Doing it this way since I have a project requirement, where input parameter inside that particular file can be modified and recompiled/run by users who wont have Eclipse)
I have used some external libraries( for Eg:json-simple,gson etc).They arent getting recognized , during compilation.
But if I run the class file(from the Eclipse compiled version), it gets executed properly
a)Tried to compile from root folder(using package name)
javac packageName.javaFileName.java
b) and went inside the package and compiled directly.
javac javaFileName.java
The a)part didnt compile at all saying classNotFound. The b)part started compiling but threw an error where none of the external libraries got recognized.(Getting --> error: cannot find symbol for places wherever the code/import of the external lib is used)
a)Tried to compile from root folder(using package name) javac
packageName.javaFileName.java b) and went inside the package and
compiled directly. javac javaFileName.java
The a)part didnt compile at all saying classNotFound.
Yes. javac requires you to specify a filesystem path to the (first) source(s) to compile. You appear instead to have tacked .java onto the end of the desired fully-qualified class name. Probably you want to compile from the root of the unpacked jar, specifying a correct path:
javac [options] package/name/className.java
for class package.name.className. (You can also compile from a different working directory if you specify an appropriate option, as discussed below.)
The b)part
started compiling but threw an error where none of the external
libraries got recognized.(Getting --> error: cannot find symbol for
places wherever the code/import of the external lib is used)
If the class you're compiling depends on others that also need to be compiled then javac would likely make a similar complaint about them. Either compile from the root (as in (a)), or specify the path to the source root via the -sourcepath option. Either way, there's no reason to descend into the source tree to compile.
But the external libs are actually a separate, albeit related, question. You don't need to compile these, but you do need to tell javac to use them as sources of classes. You would do that via the -classpath option, which you can abbreviate to -cp. If those were packaged in the jar itself (i.e. a "fat jar") then that should be fairly easy, something along these lines:
javac -cp .:lib/dependency1.jar:lib/dependency2.jar package/name/className.java
The "lib" part may vary, and the separator definitely differs depending on OS (on Windows it is ;, whereas on Mac / Linux / Solaris is is :, as shown).
If the external libs were not packaged into the main jar then the procedure is the same, but you might have a bigger challenge finding the needed jars. Also, such a jar is probably not runnable if you move it to a different machine. Nevertheless, you should probably look in META_INF/MANIFEST.MF, as it should contain the needed information.

How do I get F# Forge to work

I can't seem to get Forge to work.
I'm using VS Code 1.6.1 with Ionide-F# 2.8.2. Until now I've only compiled scripts, but I need a project file for a specfic .dll to work (Unmanaged Exports).
However I can't seem to get an F# project going with Forge. When I use the `>F# New Project" command it tells me I need to refresh my templates, because I don't have any.
If I refresh, nothing happens. I have git installed as was suggested in other places, but to no avail.
When I open Forge.exe directly from my C:\Users\>USER<\.vscode\bin-forge directory, it doesn't even go into interactive mode. I downloaded Forge separately with the same result.
Has anyone else encountered this issue?
I'm not sure why it's working now, the only thing I can remember doing is adding the following to my user settings:
"FSharp.toolsDirPath": "C:/Program Files (x86)/Microsoft SDKs/F#/4.0/Framework/v4.0",
"FSharp.fsiFilePath": "C:/Program Files (x86)/Microsoft SDKs/F#/4.0/Framework/v4.0/Fsi.exe"
Maybe Forge didn't find the F# tools, but they're on the windows path, so I can't fathom why it helped.

How to install Lua libraries on separate folder

Hello i would like to change folder that luasocket is installing to how can i do that ? My plan is at the end i want to export my lua file as exe and use it to run my server. I want to put luasocket inside Project file so other windows computer wont have problems (I am using Windows computer too). Thanks for helping.
my code
Main.lua
lpackage.path = package.path..';./libs/lua/?.lua'
package.cpath = package.cpath..';./libs/socket/?.dll;'
This is my Project tree
Project
-libs
--lua
Assuming you keep the name of the luasocket DLL the same (which is usually, core.dll), you need to use ./libs/?.dll instead of ./libs/socket/?.dll, as the question mark will be replaced with socket/core when socket.core module is required from socket.lua. You'll need to put core.dll in libs/socket folder.
You will also need to have lua.dll present (as the core.dll is usually compiled against it) or use a proxy dll if your executable statically compiles lua interpreter.

How to install lmapm for lua?

I am making a script that requires lmapm, but I'm not quite sure how to install it. I have 4 files,
lmapm.c
test.lua
README
Makefile
And I'm not sure how to use them in my lua environment. Lua 5.1 is installed on my desktop in a folder called "5.1", and it was installed with LuaRocks (If that matters) I know lua libraries are used with require, but this is a c file, not a lua file.
How can I install/use lmapm in my lua programs?
Upon reading the readme it tells me to run make, but makefile is just a "file" on my computer, there is nothing I can run it with.
README: Short description of what you got and how to install & use the module at the end.
test.lua: Lua script to test the module/sample of usage.
lmapm.c: C source code and the module in raw/still unusable form. Needs to get compiled and linked to a dynamic library of target platform.
Makefile: Automatic build instructions to compile&link lmapm.c to what you finally use in Lua.
Makefile serves as a macro which makes building easier with minimal input by users. To run this file, you need program make (comes with GNU toolchain; on Unix install package build-essential, on Windows MSYS). Before you have to fix the path to your Lua and MAPM installation (as mentioned in the official build instructions). Furthermore you need the C compiler and linker (which you already installed on Unix together with make and have to install on Windows by f.e. MinGW).
The result is a dynamic library/Lua C module which you can require simply by its filename. To put it in the scope of Lua, move it in the application or (better) in the Lua modules directory.

Can i run Erlang without local admin rights on Windows?

I have a machine which doesn't give me local admin rights. Is it still possible to run erlang on it, as I cannot run a windows .exe installer to install erlang?
You can copy erl.exe (plus the runtime system and all the libraries you need) from another installation and run it without the need to install. As long as you are allowed to execute files it should be okay.
Forgive me for not being as smart as Zubair,
but I would like to know exactly how to do this.
I do not have admin privilege, cannot run installers, and cannot copy files to C:\WINDOWS.
In particular, I cannot write to C:\WINDOWS\WinSxS or C:\WINDOWS\system32.
How do I get a list of exactly what libraries are required by the various erlang executables ?
I have all the MS redistributable libraries and manifests,
but I don't know where to put them to make it work.
The redistributable library structure has directories such as
Microsoft.VC90.ATL, Microsoft.VC90.CRT, etc. Each directory contains relevant dlls and a manifest.
Do I copy all the contents into the ERL_HOME\bin directory or ERL_HOME\erts-x.y.z\bin or ERL_HOME\erts-x.y.z\lib ?
or leave them in some other directory and put those entries in the PATH ?
or do I need to build the paths implied by the manifests (i.e. where they would be copied into the WinSxS cache) using hashes and version numbers in the paths, then put those entries in the PATH ?

Resources