[Ecls-list] Various problems building executable under windows
Rujia Liu
2575127 at qq.com
Thu Jun 25 16:46:41 UTC 2015
Dear all,
Thanks to everyone, now I'm pretty close to my goal (porting a program to ECL and build standalone executable under windows). Here are some small issues I found (issue 1is fixed, and issue 2 is skipped):
1. see https://gitlab.com/embeddable-common-lisp/ecl/blob/develop/src/cmp/cmpmain.lsp#L158
(format f "/DEBUGTYPE:CV /OUT:~A ~A ~{~&\"~A\"~}"
There are two issues:
a. /DEBUGTYPE:CV is deprecated
b. the argument to /OUT: is NOT quoted, so if the output-name contains whitespaces (it's very common), msvc will consider it several tokens instead of a single filename. I changed it to /OUT:\"~A\" \"~A\" ... and it worked.
2. in the same file, function link-cc:
#+msvc
(defun linker-cc (o-pathname object-files &key
(type :program)
(ld-flags (split-program-options *ld-flags*)))
(safe-run-program
*ld*
`(,(concatenate 'string "-Fe" (brief-namestring o-pathname))
, at object-files
,@(split-program-options *ld-rpath*)
,@(split-program-options *user-ld-flags*)
, at ld-flags))
(embed-manifest-file o-pathname type)
(delete-msvc-generated-files o-pathname))
The code looks promising, but unfortunately, if you're building an executable with asdf:make-build (:type :program), an error would occur, saying that "output filename matches input file".
For example, if the system is called "example", compiling the system would create example.lib, then building the executable would create example.exe. However, when creating {filename}.exe, msvc would first create {filename}.exp and {filename}.lib, example.lib is both an input file and an output file.
I manually copied the argument to a link_program.bat file, changed the output name to example1.exe and it worked. However, it would be nice if anyone could fix this in ECL because it looks non-trivial for me because o-pathname has to be consistent with other calls to msvc (linking will be followed by a call to mt.exe to add manifest file).
3. The above tricks is enough to get example.exe working. However, when I try with my target project, the executable (say, real-project.exe) cannot start, saything about packages likes ASDF:OPERATE are referenced but not created.
I've searched the error message in the codebase, and here is the result:
https://gitlab.com/embeddable-common-lisp/ecl/blob/develop/src/c/load.d#L174
and
https://gitlab.com/embeddable-common-lisp/ecl/blob/develop/src/c/read.d#L2451
That is:
"The packages~& ~A~&were referenced in compiled file~& ~A~&but have not been created",
Looking at the parameters to the linker, I realized that asdf.lib is NOT linked against. How can I link it?
4. Another question, which is not urgent, is how to bundle encodings? I got the following error:
"Unable to find mapping file GBK for encoding SYS:ENCODINGS;GBK.BIN"
See: https://gitlab.com/embeddable-common-lisp/ecl/blob/develop/src/lsp/iolib.lsp#L309
The problem is that in packages/encodings, there is no gbk.bin. The closest one is windows-cp936, but I don't know how to "tell" ECL that GBK is an alias of cp936.
BTW: GBK is automatically detected in function "with-output-to-string". Is there a way to change the default encoding?
Thanks!
- Rujia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20150626/d9ed14cf/attachment.html>
More information about the ecl-devel
mailing list