Closed fmazur closed 9 months ago
Please give more of error log, can't prompt w/o exact context. Clang is always extra picky and requires code tuning.
Please give more of error log, can't prompt w/o exact context. Clang is always extra picky and requires code tuning.
Here is full make log after make clean
: https://pastebin.com/z1SHRUQJ
I pushed branch with fix of this one https://github.com/Garux/netradiant-custom/tree/Qt-macOS2
I pushed branch with fix of this one https://github.com/Garux/netradiant-custom/tree/Qt-macOS2
Thank you! It resolved that issue. I'm stuck on next part. I've verified that X11 is working and that I can run X11 applications. Paths that linker is looking for are there.
[fmazur@freya ~]$ ls /usr/X11
bin etc include lib libexec share var
[fmazur@freya ~]$ ls /usr/X11R6
bin etc include lib libexec share var
After cpp/c compile finished it tired to do install/libassimp_.dylib
and install/q3map2.arm64
:
https://pastebin.com/cPziej6J
I've zlib and assimp installed and exported before compile
export LDFLAGS="-L/opt/homebrew/opt/zlib/lib"
export CPPFLAGS="-I/opt/homebrew/opt/zlib/include"
I'm unable to debug this myself.
This is commit, which enabled mac build the other day https://github.com/Garux/netradiant-custom/commit/f7d120f9beab4183e623a17229b9163342970b8e. I believe unzip.cpp
part is your stuff.
These funcs likely were force-present in environment b4 and thus disabled.
This is commit, which enabled mac build the other day f7d120f. I believe
unzip.cpp
part is your stuff. These funcs likely were force-present in environment b4 and thus disabled.
unzip is provided by system on M1 machines.
I've reverted the commit to restore MACLIBDIR
. I've added /opt/local/lib to the path. (that's the path that contains X11 etc, not /usr/local/lib from what I've checked)
Here is a list of libs that are in MACLIBDIR, active ports and full compile log https://pastebin.com/5cJmJngU https://pastebin.com/hTNGQKLG
I'm not familiar with clang stuff so best I can do i try stuff and provide logs.
Have you surely removed ifdefs/recompiled? Because lets see the 1st one, it's not there, when it's disabled by ifdefs And it was exactly the problem the other time.
Right. I was confused for a bit, thought I just had to revert that commit and not cherry-pick. After cherry-picking that commit that removed ifdefs and updating MACLIBDIR it continued to build but it hangs on something.
[fmazur@freya ~/Games/netradiant-custom]$ git diff
diff --git a/Makefile b/Makefile
index 8cc8a972..d39dc3ee 100644
--- a/Makefile
+++ b/Makefile
@@ -232,7 +232,7 @@ ifeq ($(OS),Darwin)
CPPFLAGS_COMMON += -DPOSIX -DXWINDOWS
CFLAGS_COMMON += -fPIC
CXXFLAGS_COMMON += -fno-exceptions -fno-rtti
- MACLIBDIR ?= /usr/local/lib
+ MACLIBDIR ?= /opt/local/lib
CPPFLAGS_COMMON += -I$(MACLIBDIR)/../include -I/usr/X11R6/include
LDFLAGS_COMMON += -L$(MACLIBDIR) -L/usr/X11R6/lib
LDFLAGS_DLL += -dynamiclib -ldl
diff --git a/tools/mbspc/qcommon/q_platform.h b/tools/mbspc/qcommon/q_platform.h
index d3b3b6b0..a11b0198 100644
--- a/tools/mbspc/qcommon/q_platform.h
+++ b/tools/mbspc/qcommon/q_platform.h
@@ -156,6 +156,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define idx64 1
#define ARCH_STRING "x86_64"
#define Q3_LITTLE_ENDIAN
+#elif defined __aarch64__
+#define ARCH_STRING "arm64"
+#define Q3_LITTLE_ENDIAN
#endif
#define DLL_EXT ".dylib"
Had to define arm section for qplatform as it errored out on unsupported platform and endianness which made it not appear anymore? End of build log with nm output for CurrentDirectory method from libassimp.dylib and contents of install folder https://pastebin.com/zkH9t4Hb
Each time I clean build and builds are in arm64. I'll try to revert the f7d120f commit and try to build in i386 maybe?
Great, so now linker can't find assmodel.dylib
.
-Wl,-rpath '-Wl,$ORIGIN/..'
is the trick to find it in linux; in windows it works out of the box.
Idk what's the way for mac now, the other time it was linked normally, but missing in runtime; fix was:
% install_name_tool -change install/libassimp_.dylib @executable_path/libassimp_.dylib assmodel.dylib
(for assmodel.dylib
particularly)
That would probably work if assmodel.dylib existed but it doesn't get compiled.
[fmazur@freya ~/Games/netradiant-custom]$ install_name_tool -change install/libassimp_.dylib @executable_path/libassimp_.dylib assmodel.dylib
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: can't open file: assmodel.dylib (No such file or directory)
I presume the $$ORIGIN trick could be replaced with -Wl,-rpath,@loader_path/.. -Wl,-rpath,@executable_path/..
for M1
Not sure whether you need full log but here is end part with the changed $$ORIGIN https://pastebin.com/wZBU7vTR
[fmazur@freya ~/Games/netradiant-custom]$ ls install/
h2data libassimp_.dylib q2map.arm64 qdata3.arm64
h2data.arm64 q2map qdata3
I presume libassimp_.dylib is not complete (4,3mb)
There is assimp available in /opt/local/lib/libassimp.dylib and /opt/local/include/assimp and there is assimp in project libs. I assume this is to build against custom assimp?
I mixed up, was meant to say
Great, so now linker can't find
libassimp_.dylib
4,3mb is okay; building own version of assimp because at the time of adding it required adjustments to have it usable and for stability.
Oh, and -Wl,-rpath '-Wl,$ORIGIN/..'
is related to finding dylib in runtime.
Current problem is linker not finding assimp from -lassimp_ -Linstall
prompts (or less likely broken assimp build).
May be lets contact in some discord to enfasten this, my id is 246624639655215114 there.
After honing out remaining M1 quirks I was able to make
on M1. Here is more or less updated guide since I don't have access to clean env:
ARM M1 Max Darwin freya 23.3.0 Darwin Kernel Version 23.3.0: Wed Dec 20 21:30:44 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6000 arm64
environment:
the following packages installed: Macports: ~gtkglext~ pkgconfig glib2-devel libxml2 ~gtk2 pango atk~ gettext wget assimp Qt5Core Qt5Gui Qt5Widgets subversion xorg zlib zstd
Branch Qt-macOS2-M1 ( after being merged https://github.com/Garux/netradiant-custom/pull/169 - Qt-macOS2 ) Locate your lib folder either /usr/local/lib or /opt/local/lib ( mine was the /opt/local/lib ) and update Makefile MACLIBDIR path There were issues with linking -lassimp_ . I had luck using port installed assimp -lassimp (assimp 5.3.1)
I'm not sure which packaged are needed after subversion since xorg may have been provided by xquartz but check whether /usr/X11R6 and /usr/X11 directories exist.
build: run 'make -j16'
run: ./install/radiant.arm64
Edit: Crossed out packages that are most likely not needed.
EDIT: M1 Max arm64
I've installed all dependencies required by the make with MacPorts (there were few missing on the https://github.com/Garux/netradiant-custom/blob/master/COMPILING )
gcc/g++ clang version 14.0.3 (clang-1403.0.22.14.1) arm64-apple-darwin23.3.0 xcode 14.3.1 (and then tried again with 15.2 - latest)
Attempting to build netradiant-custom-latest gives out errors during compile.
Compile errors at
Am I missing some dependency or compile flags?