Julia ccall() could not load library - julia

I am stuck with the problem of calling C library from Julia.
Here is the line:
test=ccall((:foo1,"DLL1"),Int32,(Int32, Int32),1,1)
DLL1.dll is in the same folder as main .jl file and pwd() returns this folder.
But Julia gives me the following error:
LoadError: error compiling anonymous: could not load library
Is there some better tutorials than official for ccall. Since it's not working even with libc.

Related

Deploy Qt Design Studio Project for Webassembly

I am using Qt 6.3.2 and im on a M1 Mac.
I am trying to build a Qt Design Studio Project for webassembly but I have trouble to install the Designer Components for Webassembly.
To use a Design Studio Project, you have to install the Designer Components to your Installation, which I did like stated in the documentation:Adding Qt Quick Designer Components to Qt Installations.
This works fine when I build it for Mac but I cant get it to work with WASM. Do I need to build the components in a specific way for em++?
When I use the components like stated in the docs I get the following error message:
em++: warning: unrecognized file type: `/Users/marius/Qt/6.3.2/wasm_32/./qml/QtQuick/Studio/Effects/libquickstudioeffectsplugin.dylib`. Mapping to `-lquickstudioeffectsplugin` and hoping for the best [-Wmap-unrecognized-libraries]
em++: warning: unrecognized file type: `/Users/marius/Qt/6.3.2/wasm_32/./qml/QtQuick/Studio/Application/libquickstudioapplicationplugin.dylib`. Mapping to `-lquickstudioapplicationplugin` and hoping for the best [-Wmap-unrecognized-libraries]
em++: warning: unrecognized file type: `/Users/marius/Qt/6.3.2/wasm_32/./qml/QtQuick/Studio/EventSimulator/libquickstudioeventsimulatorplugin.dylib`. Mapping to `-lquickstudioeventsimulatorplugin` and hoping for the best [-Wmap-unrecognized-libraries]
em++: warning: unrecognized file type: `/Users/marius/Qt/6.3.2/wasm_32/./qml/QtQuick/Studio/EventSystem/libquickstudioeventsystemplugin.dylib`. Mapping to `-lquickstudioeventsystemplugin` and hoping for the best [-Wmap-unrecognized-libraries]
wasm-ld: error: unable to find library -lquickstudioeffectsplugin
wasm-ld: error: unable to find library -lquickstudioapplicationplugin
wasm-ld: error: unable to find library -lquickstudioeventsimulatorplugin
wasm-ld: error: unable to find library -lquickstudioeventsystemplugin
em++: error: '/Users/marius/Documents/Git/emsdk/upstream/bin/wasm-ld #/var/folders/k3/prb53mjs50sf220pb_trz4fc0000gn/T/emscripten_7udnbcap.rsp.utf-8' failed (returned 1)
ninja: build stopped: subcommand failed.
I tried to build the components for other architectures or as a static library.

GLM Precompile Error In Julia Pro 1.0/1.2

Hello internet friends,
I am using the Julia Pro v.1.0.5-2 IDE to render animations for some Condensed Matter Physics data. When I attempt to run:
array = load("C:/Users/Kyle/Desktop/julia/data/Psi_L=89_W=0_0.01_500000-500/Psi_L=89_W=0_g=0.0_L^2.jld", "data")
#gif for i=1:7
array_2 = abs2.(array[i][:,:,1])
x=1:89
y=1:89
f(x,y) = array_2[x,y]
plot(x,y,f,st=:surface,camera=(0,30), title = "Wavefunction Density Animation, L=89, g=0, t = $(5*i)")
end
I get the following error:
[ Info: Precompiling GLM [38e38edf-8417-5370-95a0-9cbb8c7f171a]
ERROR: LoadError: No deps.jl file could be found. Please try running Pkg.bui
Currently, the build command might fail when Julia has been built from sourc
and the recommendation is to use the official binaries from julialang.org.
For more info see https://github.com/JuliaLinearAlgebra/Arpack.jl/issues/5.
ERROR: LoadError: LoadError: Failed to precompile Arpack [7d9fca2a-8960-54d3aPro_v1.0.5-2\compiled\v1.0\Arpack\X5VZL.ji.
in expression starting at C:\Users\Kyle\.juliapro\JuliaPro_v1.0.5-2\packages
in expression starting at C:\Users\Kyle\.juliapro\JuliaPro_v1.0.5-2\packages
ERROR: LoadError: Failed to precompile PDMats [90014a1f-27ba-587c-ab20-58faa-2\compiled\v1.0\PDMats\wuzEE.ji.
in expression starting at C:\Users\Kyle\.juliapro\JuliaPro_v1.0.5-2\packages
ERROR: LoadError: Failed to precompile Distributions [31c24e10-a181-5473-b8e_v1.0.5-2\compiled\v1.0\Distributions\xILW0.ji.
in expression starting at C:\Users\Kyle\.juliapro\JuliaPro_v1.0.5-2\packages
ERROR: LoadError: Failed to precompile GLM [38e38edf-8417-5370-95a0-9cbb8c7fcompiled\v1.0\GLM\6OREG.ji.
When I attempt to run:
Pkg.build("Arpack")
I get the following error:
Pkg.build("Arpack")
Building Arpack → `C:\Users\Kyle\.juliapro\JuliaPro_v1.0.5-2\packages\Arpa
┌ Error: Error building `Arpack`:
│ ┌ Warning: Platform `x86_64-w64-mingw32-libgfortran4` is not an officially
│ └ # BinaryProvider C:\Users\julia\AppData\Local\Julia-1.0.5\share\julia\st
It is important to mention that I had produced several animations with no problems with the same exact code. I stopped to go through some emails and when I tabbed back and ran the code with new parameters, it broke as I described. Furthermore, all the relevant packages are installed (except the ones that threw these errors) and "using [xpackage]" are sprinkled in appropriately.
Thanks for taking the time to read!
Unfortunately, Arpack >=0.3.2 is incompatible with JuliaPro 1.2.0-1. To work aound this issue, you can either ] add Arpack#0.3.1 or install JuliaPro version 1.2.0-2.

How to use the module in Julia v0.7

I have the following set up: module xxxxx at the top of my file named xxxxx.jl
I go to do the following:
include("modules/xxxxx/xxxxx.jl")
using xxxxx
I get the following error:
ERROR: LoadError: ArgumentError: Package xxxxx not found in current path:
- Run Pkg.add("xxxxx") to install the xxxxx package.
Any suggestions? I don't have this error on Julia v0.6 only on v0.7!
Thanks!
Write
using .xxxxx
By using include function the module is loaded as a submodule of a current module.
E.g. if you included it in global scope then you can also write
using Main.xxxxx
But the syntax I gave at the top would work no matter if you are in Main module or you include a submodule in another module defined by you.

Julia 0.4.5: libz fails to load on Ubuntu

While I was attempting to use Requests in Julia, the following error was output:
julia> using Requests
INFO: Precompiling module Requests...
ERROR: LoadError: LoadError: error compiling version: could not load library "libz"
libz: cannot open shared object file: No such file or directory
while loading /home/michael/.julia/v0.4/Libz/src/lowlevel.jl, in expression starting on line 110
while loading /home/michael/.julia/v0.4/Libz/src/Libz.jl, in expression starting on line 11
ERROR: LoadError: Failed to precompile Libz to /home/michael/.julia/lib/v0.4/Libz.ji
while loading /home/michael/.julia/v0.4/Requests/src/Requests.jl, in expression starting on line 27
ERROR: Failed to precompile Requests to /home/michael/.julia/lib/v0.4/Requests.ji
in compilecache at ./loading.jl:400
I'm not knowledgeable enough in Julia to discern exactly what is happening, but here is the code from Libz.jl (line 11)...
include("lowlevel.jl")
...from lowlevel.jl (lines 103-110)...
# Functions
# ---------
function version()
return unsafe_string(ccall((:zlibVersion, zlib), Ptr{UInt8}, ()))
end
const zlib_version = version()
...and from Requests.jl (line 27)
using Libz
This problem has persisted after I've removed then reinstalled Libz, MbedTLS, and Requests, and after I've Pkg.update()'ed and restarted julia and my computer. Is anyone well enough versed in Julia to know how to fix this?
Per the comment by Gnimuc K and a tiny bit more research:
sudo apt-get install zlib1g-dev
installs zlib, which Julia needed. Once it was installed...
julia> Pkg.update()
julia> Pkg.build("Libz")
worked all the kinks out.

Cannot run Julia script from command line in .julia directory

When I try to run a script in the .julia directory from the command line it fails, example below:
D:\MyProjects\Julia\.julia\v0.4\Mocha\tools>julia plot_statistics.jl
ERROR: could not open file d:\myprojects\julia\plot_statistics.jl
in include at boot.jl:261
in include_from_node1 at loading.jl:320
in process_options at client.jl:280
in _start at client.jl:378
D:\MyProjects\Julia\.julia\v0.4\Mocha\tools>julia "d:\MyProjects\Julia\.julia\v0.4\Mocha\tools\plot_statistics.jl"
ERROR: LoadError: ArgumentError: ArgParse not found in path
in require at loading.jl:249
in include at boot.jl:261
in include_from_node1 at loading.jl:320
in process_options at client.jl:280
in _start at client.jl:378
while loading d:\MyProjects\Julia\.julia\v0.4\Mocha\tools\plot_statistics.jl, in expression starting on line 2
Notice in the first attempt the error message is missing a significant portion of the path, everything from .julia on.
In the second attempt I try to give the full path, but Julia rejects that too.
Windows 10; Julia is on the path (e.g. julia enters the REPL); Julia ver. 0.4.5

Resources