Missing libwinpthread-1.dll

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
bluebird
Posts: 172
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF

Missing libwinpthread-1.dll

Post by bluebird »

Missing file Missing libwinpthread-1.dll prevents running an HMG exe.

To build a sample and run it,
I have to find the "missing" above-named DLL then bring it into the directory for the project or sample that I want to build
or else - even in the case of a sample - it will not run the 2nd time. The built sample does run the first time after the build.
If I re build it it will also run once.

I am using 32 bit HMG 3.4.3 on a 64 bit Windows 10 OS.

Is there a way to fix this so that HMG sees the DLL which is really not missing.

Thanks
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: Missing libwinpthread-1.dll

Post by srvet_claudio »

Please change in your build.bat
-ldflag="-pthread -static -lpthread"

For:
-ldflag="-pthread -static-libgcc -static-libstdc++ -static -lpthread"
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
bluebird
Posts: 172
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF

Re: Missing libwinpthread-1.dll

Post by bluebird »

Dear Claudio

I looked at My build.bat used for samples and for building my own projects but I do not see
this line starting with -ldflag= etc.

Are you referring to another build file within the HMG directories?

Thanks for your reply
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: Missing libwinpthread-1.dll

Post by srvet_claudio »

See file in folder

C:\hmg.3.4.3\build.bat
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
bluebird
Posts: 172
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF

Re: Missing libwinpthread-1.dll

Post by bluebird »

Dear Claudio

I am sorry to take your time but I cannot locate the place to change in my HMG.3.4.3 direectory Build.bat file . Here it is
Can you please point out where I must change the file to insert
-ldflag="-pthread -static-libgcc -static-libstdc++ -static -lpthread"

@ECHO OFF
TITLE Building in 32 bits...
rem *******************************************************************************
rem SYNTAX
rem *******************************************************************************
rem build [ /n ] [ /d ] [ /c ] <program.prg> | <project.hbp> [<hbmk2 params>]
rem
rem /n no run after build
rem /d enabled debugger
rem /c console mode
rem
rem
rem This batch file passes information to hbmk2 to make possible an easy (zero
rem configuration build of HMG applications).
rem
rem You can achieve a customized build passing parameters directly to hbmk2.
rem Please, take a look at hbmk2 help:
rem
rem hbmk2 --help

rem *******************************************************************************
rem SET DEFAULT OPTIONS
rem *******************************************************************************

SET gtdrivers=-gtgui -gtwin
SET runafterbuild=.t.
SET debug=

rem ******************************************************************************
rem DELETE FILES FROM PREVIOUS BUILD
rem ******************************************************************************

if exist build.log del build.log
if exist error.log del error.log
if exist init.cld del init.cld

rem ******************************************************************************
rem SET HMGPATH
rem ******************************************************************************
rem
rem Using %~dp0 the HMGPATH is automatically set to current (HMG) folder making it
rem portable (zero config)

SET HMGPATH=%~dp0

rem ******************************************************************************
rem SET BINARIES PATHS
rem ******************************************************************************

SET PATH=%HMGPATH%\harbour\bin;%HMGPATH%\mingw\bin;%PATH%

rem *******************************************************************************
rem PROCESS PARAMETERS
rem *******************************************************************************
rem
rem /n no run after build
rem /d enabled debugger
rem /c console mode

if [%1]==[] goto VERSION

:CHECKPARAMS
if [%1] == [] goto CONTINUE
SET param=%~1
if %param:~0,1% == / goto CHECKSWITCH
GOTO CONTINUE

:CHECKSWITCH
if /I [%1]==[/n] set runafterbuild=.f.
if /I [%1]==[/n] shift

if /I [%1]==[/d] set debug=-b
if /I [%1]==[/d] shift

if /I [%1]==[/c] set gtdrivers=-gtwin -gtgui
if /I [%1]==[/c] shift
goto CHECKPARAMS

:CONTINUE

rem ******************************************************************************
rem ViewError - To work with it, must be found in your Operating environment
rem ******************************************************************************
if not [%ViewError%]==[] if not exist %ViewError%\ViewError.exe SET ViewError=

rem ******************************************************************************
rem Attempt to delete EXE and report if it been executed
rem ******************************************************************************

:CHECKEXE
if exist "%~n1.exe" del "%~n1.exe"
if not exist "%~n1.exe" goto COMPILE_RES
if [%ViewError%]==[] echo x=MSGBOX("%~n1.exe is currently running."+chr(13)+chr(10)+"Close it and try again.",0," ERROR at trying to compile") > %temp%\TEMPmessage.vbs
if [%ViewError%]==[] call %temp%\TEMPmessage.vbs
if exist %temp%\TEMPmessage.vbs del %temp%\TEMPmessage.vbs /f /q
echo Operating System: cannot open output file %~n1.exe: Permission denied > error.log
echo HMG_IDE_NoRunApp >> error.log
if not [%ViewError%]==[] goto VIEWERROR
goto END

rem ******************************************************************************
rem COMPILE RESOURCES
rem ******************************************************************************
:COMPILE_RES

if exist build.log del build.log

echo #define HMGRPATH %HmgPath%\RESOURCES > _hmg_resconfig.h
COPY /b %HMGPATH%\resources\hmg32.rc+"%~n1.rc"+%HMGPATH%\resources\filler _temp.rc >NUL
WINDRES -i _temp.rc -o _temp.o >windres.log 2>&1

rem *******************************************************************************
rem SET PROJECT OUTPUT FILE NAME
rem *******************************************************************************
rem
rem The first parameter sent to hbmk2 is -o%~n1.exe. I've added to it create the
rem application with the project basename (<projectname.hbp> specified by the user.

rem *******************************************************************************
rem SET DEFAULT CONFIGURATION FILE
rem *******************************************************************************
rem
rem The second parameter sent to hbmk2 is the hmg.hbc script to set config required.

rem ******************************************************************************
rem CALL HBMK2
rem ******************************************************************************

if exist MYPARAMS.TXT goto WITHPARAMS
goto NOPARAMS

:WITHPARAMS
SET /P PARAMS=< MYPARAMS.TXT
if [%PARAMS%]==[] goto NOPARAMS
SET runafterbuild=.f.
HBMK2 -mt -run -runflag="%PARAMS%" -o"%~n1" %HMGPATH%\hmg32.hbc %gtdrivers% %debug% -q %1 %2 %3 %4 %5 %6 %7 %8 >hbmk.log 2>&1
goto LOGS

:NOPARAMS
HBMK2 -mt -o"%~n1" %HMGPATH%\hmg32.hbc %gtdrivers% %debug% -q %1 %2 %3 %4 %5 %6 %7 %8 >hbmk.log 2>&1

rem ******************************************************************************
rem CREATE LOGS
rem ******************************************************************************

:LOGS
if errorlevel 1 if exist windres.log copy /a windres.log+hbmk.log error.log >nul
if errorlevel 1 if not exist windres.log copy /a hbmk.log error.log >nul

if errorlevel 0 if exist windres.log copy /a windres.log+hbmk.log build.log >nul
if errorlevel 0 if not exist windres.log copy /a hbmk.log build.log >nul

if exist error.log goto ERROR
goto CLEANUP

rem ******************************************************************************
rem COMPILING ERRORS
rem ******************************************************************************

:ERROR
if not [%ViewError%]==[] echo HMG_IDE_NoRunApp >> error.log
goto VIEWERROR

rem ******************************************************************************
rem CLEANUP
rem ******************************************************************************

:CLEANUP
if exist windres.log del windres.log
if exist hbmk.log del hbmk.log
if exist _hmg_resconfig.h del _hmg_resconfig.h
if exist _temp.rc del _temp.rc
if exist _temp.o del _temp.o

rem ******************************************************************************
rem SHOW LOG
rem ******************************************************************************

:VIEWERROR
if not exist error.log TYPE build.log
if not exist error.log goto RUNAPP
if not [%ViewError%]==[] %ViewError%\ViewError.exe error.log %HmgPath% %1 32
if [%runafterbuild%]==[.f.] goto END
if [%ViewError%]==[] TYPE error.log
rem if [%ViewError%]==[] PAUSE
goto END

rem ******************************************************************************
rem RUN APPLICATION
rem ******************************************************************************

:VERSION
CLS
ECHO.
ECHO Syntax:
ECHO ------
ECHO.
ECHO BUILD [/n] [/d] [/c] [^<Program.prg^>^|^<Project.hbp^>] [^<HBMK2 parameters...^>]
ECHO.
ECHO.
ECHO.
ECHO.
PAUSE
GOTO END

:RUNAPP
if [%runafterbuild%]==[.f.] goto END
if exist "%~n1".exe "%~n1".exe
exit /b 0
:END
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: Missing libwinpthread-1.dll

Post by srvet_claudio »

Please add the params in hbmk2:

HBMK2 -ldflag="-pthread -static-libgcc -static-libstdc++ -static -lpthread" -mt -o"%~n1" %HMGPATH%\hmg32.hbc %gtdrivers% %debug% -q %1 %2 %3 %4 %5 %6 %7 %8 >hbmk.log 2>&1
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
bluebird
Posts: 172
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF

Re: Missing libwinpthread-1.dll

Post by bluebird »

Dear Claudio

I found the HBMK2 file in a 3.4.3 bat directory, but not in 3.4.4 which I am now using.
3.4.4 has an HBMK exe file and several files of type .hbl

Is there a suggested solution for the 3.4.4 "missing" libwinpthread-1.dll file ?

Sorry to keep bugging you
Post Reply