error: undefined symbol ... during make
-
I get this error during make process of my project.
the symbols are well defined in the external header .h file.
The .h files is well included in my main .cpp program (#include "... .h").
I could chekc with some tests that the .h file is linked well.But still the make process brings those errors.
I hope somebody has a good hint for it.
-
You've cut the crucial bit of information out - does it fail during compilation or linking stage? From this output my guess is that during linking. It can be caused by many things:
- listed symbols are missing from library they come from
- linked library is not included properly
- symbols are declared in header but have no implementation (they are not present in library's .cpp file)
-
wdt_dio.h
should not be inHEADERS
. If it comes from a library (which is only included and linked, not compiled), all you need to do is to add it's parent directory toINCLUDEPATH
. -
@jsulm: Yes, wdt_dio has all the "missing symbols".
@sierdzio: Ok, I understand. I actually added this later just assuming it might be missing. What means "to add it's parent directory to INCLUDEPATH" ? You mean /usr/lib? Which INCLUDEPATH?
Just for information:
The project itself compiles / works well as just an Qt program. My goal now is it to have it available too as web application. -
@elbnacht said in error: undefined symbol ... during make:
/usr/lib?
/usr/include probably (the one where the header file is located)
-
@elbnacht said in error: undefined symbol ... during make:
@jsulm: Yes, wdt_dio has all the "missing symbols".
@sierdzio: Ok, I understand. I actually added this later just assuming it might be missing. What means "to add it's parent directory to INCLUDEPATH" ? You mean /usr/lib? Which INCLUDEPATH?
INCLUDEPATH variable in qmake. You should set it in your .pro file. It should point to the directory where the wdt_dio header is located.
Just for information:
The project itself compiles / works well as just an Qt program. My goal now is it to have it available too as web application.Is wdt_dio compiled for WebAssembly, too? It won't link otherwise.
-
@elbnacht said in error: undefined symbol ... during make:
My goal now is it to have it available too as web application
That explains. I would say you have to compile that lib with em++ as well (if possible at all).
-
I didn't touch the wdt_dio ... thought the driver is running fine ...
I read yesterday a lot at the emscription web site but came of no result solving my problem.What means exactly compiling it for WebAssembly? I have my dwt_dio driver .c and .h file.
What do I do using the em++ compiler? I thought, this will be done automatically when qmake creates the makefile and make doues the job. -
@elbnacht said in error: undefined symbol ... during make:
I thought, this will be done automatically when qmake creates the makefile and make doues the job
No, why should it? The lib is already built.
What I mean is: you need to get source code of that lib and compile it using the same tool chain you're using to compile your projects. -
Sorry, but I'm lost now. Please corect me:
The wdt_dio driver (its a hardware driver) is compiled using gcc ...
The WebAssembly project is using emsdk qmake / make ... using em++.Should I create a make file for the wdt_dio using em++ and compile ... it again?
-
@elbnacht said in error: undefined symbol ... during make:
Should I create a make file for the wdt_dio using em++ and compile ... it again?
You need to download the source code and then build it with em++. It should not be necessary to write makefile by yourself, but use whatever is used by wdt_dio project (check its source code).
-
Ok, found some more interesting websites about linking etc.
I started with a simple emcc wdt_dio.c ... created the error 'linux/module.h' file not found, which is beside other included in the .c file.
All linux sources are installed on my system ...
Could not find any compiler flags avoiding it ...But also for my basic understanding:
WebAssembly requires a different driver compiled with emcc/em++ for the emscription environment. Is that right? -
@elbnacht The libs you want to use with WebAssembly has to be compiled for WebAssembly. You can't use (as far as I know) libs compiled with GCC.
"emcc wdt_dio.c ... created the error 'linux/module.h'" - tell emcc where the headers are. -
@elbnacht said in error: undefined symbol ... during make:
WebAssembly requires a different driver compiled with emcc/em++ for the emscription environment. Is that right?
Very probably yes. And these can be missing at this point. WASM ecosystem is quite limited at this point.
Think about WebAssembly as a different operating system: libraries are not compatible, your system headers/libs won't work, you are essentially cross-compiling. Similar to deploying for an embedded board, except here the system is not Linux but a sandboxed web browser environment.
-
Many thanks for your explanation. This sounds much clearer for me.
I made a simple Makefile (to find the .h files). Output creates some errors:
===================================
infratec@debian:~/Qt-Projekte/driver$ make
make -C /lib/modules/4.19.0-8-amd64/build SUBDIRS=/home/infratec/Qt-Projekte/driver modules
make[1]: Verzeichnis "/usr/src/linux-headers-4.19.0-8-amd64" wird betreten
CC [M] /home/infratec/Qt-Projekte/driver/wdt_dio.o
clang: error: unknown argument: '-mno-fp-ret-in-387'
clang: error: unknown argument: '-mpreferred-stack-boundary=3'
clang: error: unknown argument: '-mskip-rax-setup'
clang: error: unknown argument: '-mindirect-branch=thunk-extern'
clang: error: unknown argument: '-mindirect-branch-register'
clang: error: unknown argument: '-fno-var-tracking-assignments'
clang: error: unknown argument: '-mrecord-mcount'
clang: error: unknown argument: '-fconserve-stack'
clang: error: unknown argument: '-fmacro-prefix-map=/usr/src/linux-headers-4.19.0-8-common/='
clang: error: unknown argument: '-fcf-protection=none'
clang: warning: optimization flag '-falign-jumps=1' is not supported [-Wignored-optimization-argument]
clang: warning: optimization flag '-falign-loops=1' is not supported [-Wignored-optimization-argument]
clang: warning: optimization flag '-fno-delete-null-pointer-checks' is not supported [-Wignored-optimization-argument]
clang: warning: optimization flag '-fmerge-constants' is not supported [-Wignored-optimization-argument]
shared:ERROR: compiler frontend failed to generate LLVM bitcode, halting
make[4]: *** [/usr/src/linux-headers-4.19.0-8-common/scripts/Makefile.build:315: /home/infratec/Qt-Projekte/driver/wdt_dio.o] Fehler 1
make[3]: *** [/usr/src/linux-headers-4.19.0-8-common/Makefile:1537: module/home/infratec/Qt-Projekte/driver] Fehler 2
make[2]: *** [Makefile:146: sub-make] Fehler 2
make[1]: *** [Makefile:8: all] Fehler 2
make[1]: Verzeichnis „/usr/src/linux-headers-4.19.0-8-amd64“ wird verlassen
make: *** [Makefile:17: all] Fehler 2===============================
Any idea on this?