From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,URIBL_SBL_A autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 3144 invoked from network); 2 Sep 2023 21:46:03 -0000 Received: from cgl.ntg.nl (5.39.185.202) by inbox.vuxu.org with ESMTPUTF8; 2 Sep 2023 21:46:03 -0000 Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 345FF482DEA for ; Sat, 2 Sep 2023 23:44:35 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VkjYx4CoWIVn for ; Sat, 2 Sep 2023 23:44:34 +0200 (CEST) Received: from cgl.ntg.nl (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id D5A36482DE7 for ; Sat, 2 Sep 2023 23:43:58 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 6371B482990 for ; Sat, 2 Sep 2023 23:43:34 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eemnAXXVPqYA for ; Sat, 2 Sep 2023 23:43:34 +0200 (CEST) Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cgl.ntg.nl (Postfix) with ESMTPS id 0EE1848295B for ; Sat, 2 Sep 2023 23:43:34 +0200 (CEST) Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-500b0f06136so524617e87.0 for ; Sat, 02 Sep 2023 14:43:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693691013; x=1694295813; darn=ntg.nl; h=in-reply-to:references:from:to:subject:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=UY3cqpm3yL9SxQJrzOqg3bBjV33AxZ+PRB8lSFDuB0A=; b=T5Zg4z3Ddnl1T/JrPWE5EjgvShL4BPzRBndhrCt1pgVgtZ6V+2qXpLT6RDXVW+rQkf QhPj1bOmw1YmuHw3Hp0ZcrGHi5ZlGqSZ+dNpx/SUBbJ+gm72h1NCl892aWH9+Gz8L9p7 hkgCEGMWcWZER2gKLvoEYf4QH+eZyLEO/6NH+oAi+uaeNmodGOOShsd4hzx3EGy7UcQv HvEGmkXHnWL+AEEXZdNnpZXcw8EyDvZwsu11/r/v+1Td/tSFwJXG1fTjOLWiNIfKLdU/ /vuYH55GShqXpl5rBiBJIceTQkzu6SnaUNaLD7ZL/kMTITT0KWw5adzsajwrX4hWZg7p 4Xqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693691013; x=1694295813; h=in-reply-to:references:from:to:subject:message-id:date :content-transfer-encoding:mime-version:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=UY3cqpm3yL9SxQJrzOqg3bBjV33AxZ+PRB8lSFDuB0A=; b=G7BYLu5ikqD6uE1r3bh1j6sxE24KI7ECX8xtUQFFadsGwWgEsQTac7O+xGk4ulb6A+ xdp+YCCqlfVbWMMtHPj5CLlNG72L6RafElH55x3l8FnzFjq5A/ckRH+X/DcNgURO3KrN 4X8HBlcLZqYkE2D4m6uAcNzi6un78+U4et3IgERw/br9kyxrSvWpxJB3T67W6RqcXaHm 1/WS/iPCn8+cM9+KFm+bewkUwQETjEgkG3irwFkZPjD0H9tZDbMgto+mTL3Cumecy/zU EasksUX8hZmA2LoKvBgrUXfXdRXb9a2iqLapTxUHK7KvQrc5q1oNHNS0Mbib4ytPevon GOvA== X-Gm-Message-State: AOJu0Ywf8wKO5P8iSUA5xyRKXY4z/pFlC4xd3+RNSzipBh4dTAPDjIfk i84Fzj7lGgaXb9DjoIHATUBN0Z+GfQs= X-Google-Smtp-Source: AGHT+IEClM7rCweOy9MoIg+ESZgITsiXwVvX97K9yst+n2RMEdIDu8JiaQuxiSfxNDai+K5doR3VYQ== X-Received: by 2002:ac2:58f8:0:b0:4fe:25bc:71f5 with SMTP id v24-20020ac258f8000000b004fe25bc71f5mr3655979lfo.11.1693691012552; Sat, 02 Sep 2023 14:43:32 -0700 (PDT) Received: from localhost (88-101-230-166.rcg.o2.cz. [88.101.230.166]) by smtp.gmail.com with ESMTPSA id j8-20020aa7c408000000b0052567e6586bsm3855085edq.38.2023.09.02.14.43.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Sep 2023 14:43:32 -0700 (PDT) Mime-Version: 1.0 Date: Sat, 02 Sep 2023 23:43:30 +0200 Message-Id: To: "mailing list for ConTeXt users" From: =?utf-8?q?Michal_Vlas=C3=A1k?= X-Mailer: aerc 0.15.2 References: In-Reply-To: Message-ID-Hash: 3DHJD6S6WDRNOGQEFFBIFMUJCKWEZCXK X-Message-ID-Hash: 3DHJD6S6WDRNOGQEFFBIFMUJCKWEZCXK X-MailFrom: lahcim8@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list Reply-To: mailing list for ConTeXt users Subject: [NTG-context] Re: Building luametatex with Lua symbols exposed List-Id: mailing list for ConTeXt users Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Wed Aug 30, 2023 at 6:23 PM CEST, Jairo A. del Rio wrote: > Hi, beloved list. Since sources are in the distribution, I've tried > compiling luametatex by setting LMT_STRIP in CMakeLists.txt to 0, yet the > resulting binary still warns about undefined symbols, such as lua_gettop, > when an external library is loaded in Lua. Any ideas on how to solve it? Hi Jairo, you need to expose _dynamic_ symbols in your luametatex binary. If you are using Linux, just adding the following to the CMake invocation line should work: -DCMAKE_EXECUTABLE_ENABLE_EXPORTS=1 For example, I compiled with: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXECUTABLE_ENABLE_EXPORTS=1 cmake --build build -j10 You can check the difference in dynamic symobls with: readelf --dyn-syms build/luametatex Note, that while this approach doesn't require any modification to luametatex's source files, it does export _all_ symbols, which makes binaries bigger, and symbol resolution slower. It also exports also symbols that are not intended to be used by external modules, like "tex_get_x_token". Back when luametatex source code wasn't available, I created a demo which showed how to build a "luametatex like application" (i.e. executable with Lua statically linked in), with exported dynamic symbols, working with CMake on both Unix and Windows. It might interest you: https://github.com/vlasakm/lua-demo To support Windows in the case of luametatex, "#define LUA_BUILD_AS_DLL" would need to be added when compiling Lua. The problem with any module is, that you want to compile against exactly the same Lua headers as the ones in luametatex, and with similar flags. That is why the demo hosts everything in one CMake setup, but since Lua's API hopefully doesn't change in the 5.4 series, you are probably fine even with separate compilation. IIRC stripping (LMT_STRIP) applies only to static symbols ("symbols") and not the dynamic ones ("dynamic symbols"), and thus should be irrelevant. It seems that people had similar issues before: https://www.mail-archive.com/ntg-context@ntg.nl/msg97764.html https://www.mail-archive.com/ntg-context@ntg.nl/msg98184.html I think it would be nice to support this "by default", but in that case, the binary size would have to be addressed, and only the "supported" public API of luametatex actually exposed. Support of this could also be behind a compile time switch, but I am not sure how useful would that be. Michal ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________