build - Launch4j/windres : how to set paths correctly?

标签 build path launch4j

我为我的项目配置了 launch4j。当我在 windowsXP 上开发时,我又使用了它,它在那里工作。现在我也需要它在 mac 上构建:

我的build.xml:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="create-exe">

    <property name="platform" value="win32"/>
    <property name="launch4j.dir" location="${basedir}/tools/launch4j/" />

    <include file="create-jar.xml" as="sub"/>

    <target name="create-exe" depends = "sub.create-jar">
        <launch4j configFile="launch4j-config.xml" />
        <delete file="client.win32.jar"/>
    </target>

    <taskdef name="launch4j" classname="net.sf.launch4j.ant.Launch4jTask">
        <classpath>
            <pathelement path="tools/launch4j/launch4j.jar"/>
            <pathelement path="tools/launch4j/lib/xstream.jar"/>
        </classpath>
    </taskdef>
</project>

我得到以下输出:

create-exe:
 [launch4j] Compiling resources
 [launch4j] Generated resource file...
 [launch4j] LANGUAGE 0, 1
 [launch4j] 2 RCDATA BEGIN "1.6.0\0" END
 [launch4j] 18 RCDATA BEGIN "0\0" END
 [launch4j] 25 RCDATA BEGIN "512\0" END
 [launch4j] 27 RCDATA BEGIN "1024\0" END
 [launch4j] 21 RCDATA BEGIN "http://java.com/download\0" END
 [launch4j] 20 RCDATA BEGIN "32\0" END
 [launch4j] 9 RCDATA BEGIN "true\0" END
 [launch4j] 101 RCDATA BEGIN "An error occurred while starting the application.\0" END
 [launch4j] 102 RCDATA BEGIN "This application was configured to use a bundled Java Runtime Environment but the runtime is missing or corrupted.\0" END
 [launch4j] 103 RCDATA BEGIN "This application requires a Java Runtime Environment\0" END
 [launch4j] 104 RCDATA BEGIN "The registry refers to a nonexistent Java Runtime Environment installation or the runtime is corrupted.\0" END
 [launch4j] 17 RCDATA BEGIN "true\0" END

BUILD FAILED
/Users/fabian/dev/rsys-client/create-win32-exe.xml:9: net.sf.launch4j.BuilderException: net.sf.launch4j.ExecException: java.io.IOException: Cannot run program "./bin/windres": error=2, No such file or directory

当我将 bindir="tools/launch4j/bin" 添加到 launch4j 执行时,找到 ld 和 Windres,输出更改为:

create-exe:
 [launch4j] Compiling resources
 [launch4j] Linking
 [launch4j] /Users/fabian/dev/rsys-client/tools/launch4j/bin/ld: cannot find ./w32api/crt2.o: No such file or directory
 [launch4j] /Users/fabian/dev/rsys-client/tools/launch4j/bin/ld: cannot find ./head/guihead.o: No such file or directory
 [launch4j] /Users/fabian/dev/rsys-client/tools/launch4j/bin/ld: cannot find ./head/head.o: No such file or directory
 [launch4j] /Users/fabian/dev/rsys-client/tools/launch4j/bin/ld: cannot find ./w32api/libmingw32.a: No such file or directory
 [launch4j] /Users/fabian/dev/rsys-client/tools/launch4j/bin/ld: cannot find ./w32api/libgcc.a: No such file or directory
 [launch4j] /Users/fabian/dev/rsys-client/tools/launch4j/bin/ld: cannot find ./w32api/libmsvcrt.a: No such file or directory
 [launch4j] /Users/fabian/dev/rsys-client/tools/launch4j/bin/ld: cannot find ./w32api/libkernel32.a: No such file or directory
 [launch4j] /Users/fabian/dev/rsys-client/tools/launch4j/bin/ld: cannot find ./w32api/libuser32.a: No such file or directory
 [launch4j] /Users/fabian/dev/rsys-client/tools/launch4j/bin/ld: cannot find ./w32api/libadvapi32.a: No such file or directory
 [launch4j] /Users/fabian/dev/rsys-client/tools/launch4j/bin/ld: cannot find ./w32api/libshell32.a: No such file or directory

BUILD FAILED
/Users/fabian/dev/rsys-client/create-win32-exe.xml:9: net.sf.launch4j.BuilderException: net.sf.launch4j.ExecException: Exec failed (1): /Users/fabian/dev/rsys-client/tools/launch4j/bin/ld -mi386pe --oformat pei-i386 --dynamicbase --nxcompat --no-seh --subsystem windows -s ./w32api/crt2.o ./head/guihead.o ./head/head.o /var/folders/n5/44dkvyzd00z0h5mklk_pwtch0000gn/T/launch4j3026065429236284429o ./w32api/libmingw32.a ./w32api/libgcc.a ./w32api/libmsvcrt.a ./w32api/libkernel32.a ./w32api/libuser32.a ./w32api/libadvapi32.a ./w32api/libshell32.a -o /Users/fabian/dev/rsys-client/Kassa.exe

Total time: 6 seconds

最佳答案

对于那些经历过以下情况的人:

error=2, No such file or directory

在 64 位 Linux 上运行 windres 时出现问题,您需要安装 32 位库。在 Linux Mint 上,我安装了 ia32-libs 包:

sudo apt-get install ia32-libs

关于build - Launch4j/windres : how to set paths correctly?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14319358/

相关文章:

cordova - 构建 meteor 应用程序后 meteor 无法运行

java - SNAPSHOT 和 RELEASE 版本未在 Maven 本地存储库中获得更新

iphone - 应用程序在 [[NSBundle mainBundle] pathForResource 处崩溃

javascript - 跨操作系统平台的路径分隔符

java - Exec 失败错误 - launch4j Maven 插件

java - 使用launch4j时如何获取可执行文件的路径?

java - Launch4j 不工作(找不到主类)

build - 在跨平台环境中管理 conda env

c++ - 良好做法:如何定义外部库的编译路径

ruby-on-rails - 我应该把我的 chromedriver 文件放在哪里?