4 Jul 2025 |
megmug | I can definitely provide that if its of any use | 08:15:15 |
WeetHet | I'm not gonna debug C++ linking for you | 08:15:34 |
megmug | Meaning, it is not possible to "fix" or circumvent using the nix shell? | 08:15:48 |
WeetHet | It's not a nix issue | 08:15:55 |
WeetHet | It's an issue with how your project is built | 08:16:10 |
WeetHet | Or written idk | 08:16:14 |
megmug | understandable | 08:16:23 |
WeetHet | It just so happens to work out on linux | 08:16:25 |
WeetHet | That's my best guess | 08:17:40 |
megmug | Okay, thank you for having a look at it | 08:18:10 |
WeetHet | You can go over the .o files using nm and look for the mangled REPLDriver<CloudClient>::add_action | 08:18:34 |
K900 | My guess would be that it's instantiated in a .cpp file instead of a header | 08:19:17 |
K900 | So it's not linked correctly | 08:19:22 |
WeetHet | Yep, probably that | 08:19:34 |
K900 | And Clang is just stricter about this than GCC | 08:19:47 |
megmug | Yeah, we have a header and a corresponding .cxx file that implements it | 08:20:04 |
megmug | I tried switching it to gcc on MacOS via the CC and CXX env variables but that made things even worse. To my current understanding, because everything else is built with clang and the resulting binaries will not be compatible | 08:22:10 |
K900 | GCC on OSX is not really a good idea AFAIK | 08:22:57 |
K900 | Though I'm far from an OSX expert | 08:23:02 |
K900 | You might want to try building with clang on Linux actually | 08:23:19 |
K900 | Just to see if the issue reproduces | 08:23:24 |
megmug | this i should try yes | 08:24:05 |
WeetHet | Imagine that you have
header.h :
#ifndef HEADER_H
#define HEADER_H
template <typename T> class Test {
T x;
public:
static Test mkTest(T x);
};
#endif
impl.cpp :
#include "header.h"
template <typename T> Test<T> Test<T>::mkTest(T x) { return Test{x}; }
main.cpp :
#include "header.h"
int main() { Test<int> t = Test<int>::mkTest(3); }
| 08:24:34 |
WeetHet | Right? | 08:24:40 |
WeetHet | * Imagine that you have
header.h :
#ifndef HEADER_H
#define HEADER_H
template <typename T> class Test {
T x;
public:
static Test mkTest(T x);
};
#endif
impl.cpp :
#include "header.h"
template <typename T> Test<T> Test<T>::mkTest(T x) { return Test{x}; }
main.cpp :
#include "header.h"
int main() { Test<int> t = Test<int>::mkTest(3); }
| 08:24:47 |
WeetHet | Well, building it fails | 08:25:02 |
WeetHet | $ g++ main.cpp impl.cpp -o main
Undefined symbols for architecture arm64:
"Test<int>::mkTest(int)", referenced from:
_main in main-880b44.o
ld: symbol(s) not found for architecture arm64
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
| 08:25:17 |
WeetHet | I'm 99% sure you have the same issue | 08:25:47 |
megmug | Ok, but why does it work so flawlessly on x86 linux then? | 08:26:54 |
WeetHet | Idk C++ stuff | 08:27:06 |