Cannot find -lopenal32

Pierrou

Active member
Joined
Jul 6, 2017
Messages
234
Hi,
The latest Windows version allows me to use JungleIDE again and that's great news, so I tried to switch again to Cerberus X for good. The HTML5GL custom target compiles just fine, which is awesome. I installed the TDM-GCC-64 v.4.9.2. compiler and changed the path in the config.winnt file, but I still can't get the Windows Desktop target to work.First I got errors which disappeared when I changed the Monkey X Studio path to MonkeyXStudio but I still can't get it to work yet...

At first I get a
Failed to copy openal32 to C:\Users\Pierre\Google Drive\Tests_Animations\test_affichage.buildv2017-10-24\glfw3\gcc_winnt\Release64
error message but then it starts compiling anyway, but right at the end of the process I get this :

C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lopenal32
collect2.exe: error: ld returned 1 exit status
Makefile:53: recipe for target 'Release64/CerberusGame' failed
mingw32-make: *** [Release64/CerberusGame] Error 1
TRANS FAILED: Error executing 'mingw32-make CCOPTS=" -m64 -O3 -DNDEBUG" LDOPTS=" -m64 -s -LC:/Users/Pierre/Documents/MonkeyXStudio/MonkeyX/Cerberus-Win_10-17/Bin/transcc_winnt.exlibs/Win64" LIBOPTS=" -lopenal32" OUT="Release64/CerberusGame"', return code=2

Have I skipped one of the steps?
Thanks if you know what it means! (for myself I don't) :'(
 

MikeHart

Administrator
Joined
Jun 19, 2017
Messages
3,167
Did you install mingw or just unzip it and link to the location in the config file? First never works for me. I just unzip it and set the location. No troubles at alll. But i am using ted.
 

Pierrou

Active member
Joined
Jul 6, 2017
Messages
234
Yes I just unzipped the archive to C: and linked it in the config file. Haven't tried with Ted. Seems to be related to OpenAL?
 

dawlane

Well-known member
CX Code Contributor
Joined
Jun 21, 2017
Messages
854
-LC:/Users/Pierre/Documents/MonkeyXStudio/MonkeyX/Cerberus-Win_10-17/Bin/transcc_winnt.exlibs/Win64"
Looks like something has gone wrong with resolving the location of the libs directory.
It should have resolved to
-LC:/Users/Pierre/Documents/MonkeyXStudio/MonkeyX/Cerberus-Win_10-17/libs/Win64"
 

dawlane

Well-known member
CX Code Contributor
Joined
Jun 21, 2017
Messages
854
OK I think I know what the issue is having looked at the source code and how your file path is constructed.
I did a quick and dirty string slice to remove part of the path. This works well as long as you do not change the filenames of any key folder or applications. When doing cross platform all file names should be in lower case, spaces should be avoided and certain symbols must be avoided in paths.

Try to rename the Bin folder first to _bin and the rename is again to bin.
 

Pierrou

Active member
Joined
Jul 6, 2017
Messages
234
Thanks dawlane! I don't quite get what you mean when should I rename Bin (or bin?) to _bin and back to bin and what should I do in between?

BTW I've unzipped the original Cerberus-Win archive without the Jungle "hack" and without changing anything except the GCC path in the config file, and it ends the same way...

I'm really sorry I don't have a clue what I should try to do and why, so back to MonkeyX for now.
Thanks for helping!
 

Martin

Active member
CX Code Contributor
3rd Party Module Dev
Tutorial Author
Joined
Jun 19, 2017
Messages
334
One problem could be that you have spaces in your path. Could you just try out a simple path that is not that deep and especially without spaces? I can imagine that this is the problem for not being able to copy the dll. Especially Windows is very picky on that front.
 

Pierrou

Active member
Joined
Jul 6, 2017
Messages
234
Thanks Martin. I tried to put my Cerberus folder in C:\ yesterday but it lead to the same result.
 

Martin

Active member
CX Code Contributor
3rd Party Module Dev
Tutorial Author
Joined
Jun 19, 2017
Messages
334
That's odd. I'm going to try a bit here and there. Windows usually is the platform with makes not that many problems, at least not for me...

May I ask what kind of Windows you use?
 

Pierrou

Active member
Joined
Jul 6, 2017
Messages
234
When copying the Cerberus folder to C: still getting the same error messages

TRANS FAILED: Error executing 'mingw32-make CCOPTS=" -m64 -O3 -DNDEBUG" LDOPTS=" -m64 -s -LC:/Cerberus/Bin/transcc_winnt.exlibs/Win64" LIBOPTS=" -lopenal32" OUT="Release64/CerberusGame"', return code=2
and so on

System = W10 + Fall Creators Update...
Good luck !!
 
Last edited:

dawlane

Well-known member
CX Code Contributor
Joined
Jun 21, 2017
Messages
854
I will give you an explanations for the error and it's actually an over sight on my part. For the new build to find libs/Win64, transcc_winnt uses the OS module function AppPath. This returns a string path to the running executable. In your case this is C:/Users/Pierre/Documents/MonkeyXStudio/MonkeyX/Cerberus-Win_10-17/Bin/transcc_winnt.exe.

Now as the new lib directory would be C:/Users/Pierre/Documents/MonkeyXStudio/MonkeyX/Cerberus-Win_10-17/libs, I had to find a solution to strip the last two parts of the path (Bin/transcc_winnt.exe), there for I used string slicing as the simplest method to get rid of the last parts.
In the file Cerberus/src/trancc/trancc.cxs around line 414, you will see this code
Code:
' Get path to external dlls
_libs = AppPath()
_libs = _libs[.. _libs.Find("bin/transcc_winnt.exe")] + "libs/"

Now as your path contains Bin/transcc_winnt.exe and not bin/transcc_winnt.exe, the Find function in the string slice cannot find what it's looking for in this case bin/transcc_winnt.exe, where as your path shows Bin\transcc_winnt.exe. This is one of the problems with handling paths that are strings, Bin would not be the same as bin as in a string they are different. To fix it there are three possible solutions, the easiest is to rename the Bin directory in the Cerberus folder. I cannot under stand why this is different from the defaults that are distributed in the original github distribution. I should point out that you cannot just rename bin directly i.e Bin to bin, Windows would just keep the directory name as Bin, hence the two stage rename I outlined in the earlier post above.

So why is the last part of your path ending up as transcc_winnt.exlibs? Well the Find function returns a minus one if it cannot find the string, so slicing a string with -1 will return a string length minus one character.

The last two soulutions involve adding changes to transcc and recompiling. The first is to force the string returned by AppPath to lower case.
Code:
' Get path to external dlls
_libs = AppPath()
_libs = _libs.ToLower()
_libs = _libs[.. _libs.Find("bin/transcc_winnt.exe")] + "libs/"
Windows is case insensitive and once a string is converted the file system wouldn't be able to tell the difference between.
c:/users/pierre/cocuments/monkeyxstudio/monkeyX/cerberus-win_10-17 and
C:/Users/Pierre/Documents/MonkeyXStudio/MonkeyX/Cerberus-Win_10-17.

Note that the next are untested.
The second would be to use the function ExtractDir.
Code:
_libs=ExtractDir( AppPath() )
_libs=ExtractDir( _libs )+"libs"

A possible forth solution would be to use RealPath
_libs=RealPath( AppPath()+"/../../" )+"/libs"

Edit: A lot of this will be resolved once I get all the full changes made to transcc. And then the real fun will start.
 
Last edited:

Pierrou

Active member
Joined
Jul 6, 2017
Messages
234
Thanks for spending so much time on this. There wasn't any change in the directories' names and the "bin" folder is called "bin", not "Bin", in my Cerberus folder. I can wait a bit (much) more and test whatever you want if it's useful, for myself I'm not in a hurry at all!
 
Last edited:

dawlane

Well-known member
CX Code Contributor
Joined
Jun 21, 2017
Messages
854
There wasn't any change in the directories' names and the "bin" folder is called "bin", not "Bin", in my Cerberus folder.
I find it strange that the path that you have posted is showing
-LC:/Users/Pierre/Documents/MonkeyXStudio/MonkeyX/Cerberus-Win_10-17/Bin/transcc_winnt.exe
The path being passed by AppPath would have been
-LC:/Users/Pierre/Documents/MonkeyXStudio/MonkeyX/Cerberus-Win_10-17/bin/transcc_winnt.exe
which would be the case if the folder was named bin.

Try and have ago at renaming the bin directory to something else and then renaming it back to bin.
 

Pierrou

Active member
Joined
Jul 6, 2017
Messages
234
OK for now the path to CerberusX is C:\Cerberus. I renamed "bin" to "_bin" and tried to compile. As you can see, the error message also refers to a "Bin" folder

"Compiler C:\Cerberus\Bin\transcc_winnt.exe can't be found on the system"

After renaming the folder back to "bin" I get the usual :

"Failed to copy openal32 to C:\Users\Pierre\Google Drive\Tests_Animations\test_affichage.buildv2017-10-24\glfw3\gcc_winnt\Release64
g++ -m64 -O3 -DNDEBUG -Wno-free-nonheap-object -I../curl/include -I../glfw3/include -I../glfw3/src -I../openal/include -I../stb -I../zlib-1.2.8 -I../lpng1610 -c -o build/Release64/main.o ../main.cpp
g++ -m64 -s -LC:/Cerberus/Bin/transcc_winnt.exlibs/Win64 -Wl,--subsystem,windows -o Release64/CerberusGame build/Release64/context.o build/Release64/egl_context.o build/Release64/init.o build/Release64/input.o build/Release64/monitor.o build/Release64/osmesa_context.o build/Release64/vulkan.o build/Release64/wgl_context.o build/Release64/win32_init.o build/Release64/win32_joystick.o build/Release64/win32_monitor.o build/Release64/win32_time.o build/Release64/win32_thread.o build/Release64/win32_window.o build/Release64/window.o build/Release64/stb_vorbis.o build/Release64/stb_image.o build/Release64/main.o -lcomdlg32 -lgdi32 -lopengl32 -lopenal32 -lws2_32
C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lopenal32
collect2.exe: error: ld returned 1 exit status
Makefile:53: recipe for target 'Release64/CerberusGame' failed
mingw32-make: *** [Release64/CerberusGame] Error 1
TRANS FAILED: Error executing 'mingw32-make CCOPTS=" -m64 -O3 -DNDEBUG" LDOPTS=" -m64 -s -LC:/Cerberus/Bin/transcc_winnt.exlibs/Win64" LIBOPTS=" -lopenal32" OUT="Release64/CerberusGame"', return code=2"

Why it's only happening on my computer is a mystery...
 

Pierrou

Active member
Joined
Jul 6, 2017
Messages
234
Dawlane your black magic is working...!


Copied openal32.dll to C:\Users\Pierre\Google Drive\Tests_Animations\test_affichage.buildv2017-10-24\glfw3\gcc_winnt\Release64
Copied openal32_COPYING to C:\Users\Pierre\Google Drive\Tests_Animations\test_affichage.buildv2017-10-24\glfw3\gcc_winnt\Release64
Copied openal32_LICENCE to C:\Users\Pierre\Google Drive\Tests_Animations\test_affichage.buildv2017-10-24\glfw3\gcc_winnt\Release64
DEBUG PATH TO PASS TO MAKEFILE:
C:/Cerberus/libs/Win64
g++ -m64 -O3 -DNDEBUG -Wno-free-nonheap-object -I../curl/include -I../glfw3/include -I../glfw3/src -I../openal/include -I../stb -I../zlib-1.2.8 -I../lpng1610 -c -o build/Release64/main.o ../main.cpp
g++ -m64 -s -LC:/Cerberus/libs/Win64 -Wl,--subsystem,windows -o Release64/CerberusGame build/Release64/context.o build/Release64/egl_context.o build/Release64/init.o build/Release64/input.o build/Release64/monitor.o build/Release64/osmesa_context.o build/Release64/vulkan.o build/Release64/wgl_context.o build/Release64/win32_init.o build/Release64/win32_joystick.o build/Release64/win32_monitor.o build/Release64/win32_time.o build/Release64/win32_thread.o build/Release64/win32_window.o build/Release64/window.o build/Release64/stb_vorbis.o build/Release64/stb_image.o build/Release64/main.o -lcomdlg32 -lgdi32 -lopengl32 -lopenal32 -lws2_32

Testing my first CerberusX 64bit executable :')

Thanks to Mike, Martin and yourself I can compile to HTML Web GL and Win desktop now, and use JungleIDE with intellisense working. That's great! Thank you!
 

Raph

New member
Joined
Aug 25, 2017
Messages
23
I just got a new laptop and am setting it up. I am running into the same issues described in this thread, using the 10-24 release. My testcase below is the new bitmap font example. Errors include a failure to copy all the CURL and OpenAL dlls, plus the "winnt.exlibs" problem mentioned above -- I'd try the new trans but the Dropbox link seems to be dead.

Failed to copy openal32 to C:\Monkey\cerberus-v2017-10-24\Cerberus\examples\mojo2\BitmapFont\BitmapFont.buildv2017-10-24\glfw3\gcc_winnt\Release64
Failed to copy libcurl to C:\Monkey\cerberus-v2017-10-24\Cerberus\examples\mojo2\BitmapFont\BitmapFont.buildv2017-10-24\glfw3\gcc_winnt\Release64
Failed to copy libcrypto-1_1-x64 to C:\Monkey\cerberus-v2017-10-24\Cerberus\examples\mojo2\BitmapFont\BitmapFont.buildv2017-10-24\glfw3\gcc_winnt\Release64
Failed to copy libssl-1_1-x64 to C:\Monkey\cerberus-v2017-10-24\Cerberus\examples\mojo2\BitmapFont\BitmapFont.buildv2017-10-24\glfw3\gcc_winnt\Release64
g++ -m64 -O3 -DNDEBUG -Wno-free-nonheap-object -I../curl/include -I../glfw3/include -I../glfw3/src -I../openal/include -I../stb -I../zlib-1.2.8 -I../lpng1610 -c -o build/Release64/main.o ../main.cpp
g++ -m64 -s -LC:/Monkey/cerberus-v2017-10-24/Cerberus/Bin/transcc_winnt.exlibs/Win64 -Wl,--subsystem,windows -o Release64/CerberusGame build/Release64/context.o build/Release64/egl_context.o build/Release64/init.o build/Release64/input.o build/Release64/monitor.o build/Release64/osmesa_context.o build/Release64/vulkan.o build/Release64/wgl_context.o build/Release64/win32_init.o build/Release64/win32_joystick.o build/Release64/win32_monitor.o build/Release64/win32_time.o build/Release64/win32_thread.o build/Release64/win32_window.o build/Release64/window.o build/Release64/stb_vorbis.o build/Release64/stb_image.o build/Release64/main.o -lcomdlg32 -lgdi32 -lopengl32 -lopenal32 -lws2_32
CMakefile:53: recipe for target 'Release64/CerberusGame' failed
:/tdm-gcc-64/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lopenal32
collect2.exe: error: ld returned 1 exit status
mingw32-make: *** [Release64/CerberusGame] Error 1
TRANS FAILED: Error executing 'mingw32-make CCOPTS=" -m64 -O3 -DNDEBUG" LDOPTS=" -m64 -s -LC:/Monkey/cerberus-v2017-10-24/Cerberus/Bin/transcc_winnt.exlibs/Win64" LIBOPTS=" -lopenal32" OUT="Release64/CerberusGame"', return code=2
Abnormal program termination.
Exit code: -1​
 
Top Bottom