Open boonpingng opened 7 years ago
Could you provide some more info about how it fails? Yes packages are supported, this is also tested in https://github.com/dhoegh/BuildExecutable.jl/blob/master/test/test.jl. Please do only use import
statement and not using
as the functions are not imported in the the namespace and essentially only act as import
normally would.
Hi Daniel,
Thanks for the sample. I will try it out.
The problem is like I uses the Interpolation package, which I will need to use "using Interpolations" to run in Julia terminal. When I compile without using import, the error is as shown(cannot find the package). In the later part of the program, I also use the "Plots" package.
Another part is that I am using the file ndgrid.jl to run some process. Currently, I put the file under the working directory.
Here is my code.
` import Plots.plot import Grid.InterpGrid import Grid.BCnil import Grid.InterpLinear
a = 5; # length of rectangle b = 4; # breath of rectangle h = 5.5; # distance to surface h1 = 0.01; # distance to freeform lens M_line = 16; # N_rec must be even and >2 N_rec = 8; cnst = 100 q = 1:N_rec; C = a(q/N_rec.^0.5); # Length of individual rectangle x C1 = Cb/a; # Breath of individual rectangle y
inter_x = zeros(length(C),div(M_line,2)); inter_y = zeros(length(C),div(M_line,2)-1); # Remove overlapping
for ii = 1:length(C)
for jj = 1:div(M_line,2)
inter_x[ii,jj] = div(2C[ii]jj,M_line);
end
for jj = 1:div(M_line,2)-1
inter_y[ii,jj] = div(2C1[ii]jj,M_line);
end
end
coor = [vec(Cones(1,size(inter_y,2))) vec(inter_y) ; vec(inter_x) vec(C1ones(1,size(inter_x,2)))]; coor = [C zeros(N_rec,1) ; coor ; zeros(N_rec,1) C1];
theta = linspace(1,2,10)pi/180;
intensity1 = collect([1.2 3.6 5.4 6.6 7.0 3.6 6.5 3.5 6.7 8.6]);
intpl_theta = linspace(1,length(theta),cnstN_rec);
itp = InterpGrid(intensity1, BCnil, InterpLinear);
intensity = itp[intpl_theta];
tot_int = pi/2sum(intensity.sin(intpl_theta)); cul_int = cumsum(intensity.sin(intpl_theta)); N_int = tot_int2/pi/N_rec;
ind = zeros(N_rec,1);
for ii = 1:N_rec tmp = abs(cul_int-ii*N_int); (~,idx) = findmin(tmp); ind[ii] = idx; end
intpl_theta = intpl_theta[ind]; gamma = (0:M_line)pi/2/M_line; gamma_size = length(gamma); intpl_theta_size = length(intpl_theta); intpl_theta = repmat(intpl_theta ,1, gamma_size); gamma = repmat(gamma' , intpl_theta_size); x = sin(intpl_theta).cos(gamma); y = sin(intpl_theta).*sin(gamma); z = cos(intpl_theta);
LIDC = [vec(x) vec(y) vec(z)]; # Does not include origin coor = [coor h*ones(size(coor,1),1)];
plot(coor[:,1],coor[:,2],line=(:dots))
`
Sorry for the late response. You do not need to use using
to get it working in REPL, you just need to qualify all call to library function with the corresponding module. For example you need to put Plot.
in front of the plot
. Fyi it is unlikely to get plotting working as it depends on a lot of binary dependencies, which is not supported by this package.
Hi, this is similar questions,
I want to use HDF5 package in my script. however, after using buildexecutable, i got an error message.
fatal: error thrown and no exception handler available. Base.InitError(mod=:HDF5, error=ErrorException("could not load library "C:\Users\Donghyeon Kim.julia\v0.5\WinRPM\deps\usr\x86_64-w64-mingw32\sys-root\mingw\bin\libhdf5.DLL" The specified module could not be found. ")) rec_backtrace at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\stackwalk.c:84 record_backtrace at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\task.c:233 jl_throw at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\task.c:551 jl_errorf at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\builtins.c:78 jl_dlerror at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\dlload.c:69 jl_load_dynamiclibrary at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\dlload.c:209 jl_get_library at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\runtime_ccall.cpp:152 jl_load_and_lookup at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\runtime_ccall.cpp:163 unknown function (ip: 0000000004692CAA) init_libhdf5 at C:\Users\Donghyeon Kim.julia\v0.5\HDF5\src\HDF5.jl:24 [inlined] init at C:\Users\Donghyeon Kim.julia\v0.5\HDF5\src\HDF5.jl:2365 unknown function (ip: 00000000046A55CE) jl_call_method_internal at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_internal.h:211 [inlined] jl_apply_generic at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\gf.c:1950 jl_apply at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia.h:1388 [inlined] jl_module_run_initializer at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\toplevel.c:83 _julia_init at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\init.c:753 julia_init at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\task.c:284 jl_init_with_image at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\jlapi.c:45 main at C:/Users/DONGHY~1/AppData/Local/Temp/jl_2C1E.tmp\start_func.c:30 __tmainCRTStartup at /home/abuild/rpmbuild/BUILD/mingw-w64-crt\crt\crtexe.c:334 mainCRTStartup at /home/abuild/rpmbuild/BUILD/mingw-w64-crt\crt\crtexe.c:212 BaseThreadInitThunk at C:\Windows\System32\KERNEL32.DLL (unknown line) RtlUserThreadStart at C:\Windows\SYSTEM32\ntdll.dll (unknown line)
After using buildexecutable, the binary tried to find library in absolute path (in my computer)
that's why it cannot run in other computers..
Hi All,
Anyone can compile added packages? I am using the package "interpolations" but it seems that the system will not link this package into the executable.
Also, can I use "include("filename.jl")" in the executable?
Thanks for your advice.