Solved Need help setting up my Qt project w/ NASM (MakeFile.Debug:98)
-
Hello,
I have found a useful article on how to set up Qt for NASM assembler.
For testing purposes I wanted to return the contents of rax and display them inside a label.But I keep getting the following error: Error: [Makefile.Debug:98: test.o] Error 2
Do I need an extra installation of NASM or certain compiler settings?
thanks
source:
.pro
QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = test_stuff TEMPLATE = app DEFINES += QT_DEPRECATED_WARNINGS APIs deprecated before Qt 6.0.0 QMAKE_EXTRA_COMPILERS += nasm NASMEXTRAFLAGS = -f elf64 -g -F dwarf OTHER_FILES += $$NASM_SOURCES nasm.output = ${QMAKE_FILE_BASE}.o nasm.commands = nasm $$NASMEXTRAFLAGS -o ${QMAKE_FILE_BASE}.o ${QMAKE_FILE_NAME} nasm.input = NASM_SOURCES NASM_SOURCES = test.asm CONFIG += c++11 SOURCES += \ main.cpp \ mainwindow.cpp HEADERS += \ mainwindow.h FORMS += \ mainwindow.ui # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target DISTFILES += \ test.asm
mainwindow.cpp
#include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); } MainWindow::~MainWindow() { delete ui; } extern "C" __int64 _testmain(); void MainWindow::on_pushButton_clicked() { ui->label->setText(QString::number(_testmain())); }
test.asm
section .text global _testmain:function _testmain: mov rax, 1234 ret
-
Hi,
Can you post the complete error ?
-
@SGaist said in Need help setting up my Qt project w/ NASM (MakeFile.Debug:98):
Hi,
Can you post the complete error ?
Hi,
This is all I got:
[Makefile.Debug:98: test.o] Error 2
Got this after right clicking and select "display output". (translations added after "//")process_begin: CreateProcess(NULL, nasm -f elf64 -g -F dwarf -o test.o ../test_stuff/test.asm, ...) failed. make (e=2): Das System kann die angegebene Datei nicht finden. // the system cannot find the mentioned file mingw32-make[1]: *** [Makefile.Debug:98: test.o] Error 2 mingw32-make[1]: Leaving directory 'D:/Dokumente/build-test_stuff-Desktop_Qt_5_12_0_MinGW_64_bit-Debug' mingw32-make: *** [Makefile:36: debug] Error 2 05:37:11: Der Prozess "D:\Qt\Tools\mingw730_64\bin\mingw32-make.exe" wurde mit dem Rückgabewert 2 beendet. //the process "D:..." has been terminated with a return value of 2 Fehler beim Erstellen/Deployment des Projekts test_stuff (Kit: Desktop Qt 5.12.0 MinGW 64-bit) // Error while compiling/Deployment of "test_stuff..." Bei der Ausführung von Schritt "Make" //during the execution of "Make" 05:37:11: Verstrichene Zeit: 00:02.
-
Hi @SnuggleKat
stuff/test.asm, ...) failed. make (e=2): Das System kann die angegebene Datei nicht finden. // the system cannot find
that sounds as if
nasm
is not in thePATH
environment variable.What happens if you type
nasm
in a command window?Regards
-
@aha_1980 said in Need help setting up my Qt project w/ NASM (MakeFile.Debug:98):
Hi @SnuggleKat
stuff/test.asm, ...) failed. make (e=2): Das System kann die angegebene Datei nicht finden. // the system cannot find
that sounds as if
nasm
is not in thePATH
environment variable.What happens if you type
nasm
in a command window?Regards
Hi,
do you mean cmd.exe?
Typing in "nasm" there doesn't lead to anything.
So I assume Qt doesn't come with an assembly compiler.However, I have an installation of nasm from here
Added it as a path variable but no change -
do you mean cmd.exe?
yes
Typing in "nasm" there doesn't lead to anything.
So I assume Qt doesn't come with an assembly compiler.Qt is a library, no compiler, so yes.
However, I have an installation of nasm from here
Added it as a path variable but no changeHow did you do and verify this?
-
@aha_1980 said in Need help setting up my Qt project w/ NASM (MakeFile.Debug:98):
How did you do and verify this?
By following the link of my last post you can find an installer.
I then added the installation path as system variable -
And does
nasm
work in Windows cmd.exe after you modifiedPATH
? Otherwise there is still something wrong. Please post the output ofecho %PATH%
in that case.Note that your need to re-open the cmd.exe after you made global environment changes.
-
@SnuggleKat said in Need help setting up my Qt project w/ NASM (MakeFile.Debug:98):
So I assume Qt doesn't come with an assembly compiler.
No, the compiler does
-
@aha_1980 said in Need help setting up my Qt project w/ NASM (MakeFile.Debug:98):
And does
nasm
work in Windows cmd.exe after you modifiedPATH
? Otherwise there is still something wrong. Please post the output ofecho %PATH%
in that case.Note that your need to re-open the cmd.exe after you made global environment changes.
Processing echo %PATH% gave me the following:
C:\Users\acer>echo %PATH% C:\PS3\ProDG\bin;c:\devkitPro\msys\bin;C:\mingw\bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files (x86)\Brackets\command;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\python27;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\MySQL\MySQL Utilities 1.6\;C:\WINDOWS\System32\OpenSSH\;C:\Users\acer\AppData\Local\Microsoft\WindowsApps;C:\Users\acer\AppData\Roaming\Dashlane\6.1841.0.13779\bin\Firefox_Extension\{442718d9-475e-452a-b3e1-fb1ee16b8e9f}\components;C:\Users\acer\AppData\Roaming\Dashlane\6.1841.0.13779\ucrt;C:\Users\acer\AppData\Roaming\Dashlane\6.1841.0.13779\bin\Qt
-
Ok, added nasm to my environment variables. Made a little mistake there.
Typing "nasm" into cmd now outputs:nasm:fatal: no input file specified type `nasm -h' for help
However, the error in Qt Creator remains the same
EDIT: It works now!Just had to restart Qt :)
Thank you guys, you are awesome :)