PortAudio Test application - Unresolved External symbol Pa_GetVersionInfo - c++

Background
I downloaded https://github.com/PortAudio/portaudio and compiled a DLL (removed ASIO support).
I'm running windows 10...Visual Studio 2019. Using the files in the msvc folder, I created a 64bit dll. under the build/msvc/ folder it created a new x64/release subfolder, and I see the following files:
cp#DESKTOP-ESLJ8N0:/mnt/c/Users/cp/source/github/portaudio/build/msvc/x64/Release$ ls -lah
total 3.8M
drwxrwxrwx 1 cp cp 4.0K Oct 6 14:56 .
drwxrwxrwx 1 cp cp 4.0K Oct 6 14:56 ..
-rwxrwxrwx 1 cp cp 13K Oct 6 14:56 pa_allocation.obj
-rwxrwxrwx 1 cp cp 118K Oct 6 14:56 pa_converters.obj
-rwxrwxrwx 1 cp cp 5.3K Oct 6 14:56 pa_cpuload.obj
-rwxrwxrwx 1 cp cp 5.3K Oct 6 14:56 pa_debugprint.obj
-rwxrwxrwx 1 cp cp 3.0K Oct 6 14:56 pa_dither.obj
-rwxrwxrwx 1 cp cp 66K Oct 6 14:56 pa_front.obj
-rwxrwxrwx 1 cp cp 21K Oct 6 14:56 pa_hostapi_skeleton.obj
-rwxrwxrwx 1 cp cp 60K Oct 6 14:56 pa_process.obj
-rwxrwxrwx 1 cp cp 14K Oct 6 14:56 pa_ringbuffer.obj
-rwxrwxrwx 1 cp cp 7.1K Oct 6 14:56 pa_stream.obj
-rwxrwxrwx 1 cp cp 2.0K Oct 6 14:56 pa_trace.obj
-rwxrwxrwx 1 cp cp 17K Oct 6 14:56 pa_win_coinitialize.obj
-rwxrwxrwx 1 cp cp 190K Oct 6 14:56 pa_win_ds.obj
-rwxrwxrwx 1 cp cp 25K Oct 6 14:56 pa_win_ds_dynlink.obj
-rwxrwxrwx 1 cp cp 1.5K Oct 6 14:56 pa_win_hostapis.obj
-rwxrwxrwx 1 cp cp 18K Oct 6 14:56 pa_win_util.obj
-rwxrwxrwx 1 cp cp 664K Oct 6 14:56 pa_win_wasapi.obj
-rwxrwxrwx 1 cp cp 19K Oct 6 14:56 pa_win_waveformat.obj
-rwxrwxrwx 1 cp cp 344K Oct 6 14:56 pa_win_wdmks.obj
-rwxrwxrwx 1 cp cp 29K Oct 6 14:56 pa_win_wdmks_utils.obj
-rwxrwxrwx 1 cp cp 154K Oct 6 14:56 pa_win_wmme.obj
-rwxrwxrwx 1 cp cp 1.3K Oct 6 14:56 pa_x86_plain_converters.obj
-rwxrwxrwx 1 cp cp 0 Oct 6 14:56 portaudio.Build.CppClean.log
-rwxrwxrwx 1 cp cp 287 Oct 6 14:56 portaudio.dll.recipe
-rwxrwxrwx 1 cp cp 3.4K Oct 6 14:56 portaudio.log
drwxrwxrwx 1 cp cp 4.0K Oct 6 14:56 portaudio.tlog
-rwxrwxrwx 1 cp cp 0 Oct 6 14:56 portaudio.vcxproj.FileListAbsolute.txt
-rwxrwxrwx 1 cp cp 214K Oct 6 14:56 portaudio_x64.dll
-rwxrwxrwx 1 cp cp 7.4K Oct 6 14:56 portaudio_x64.exp
-rwxrwxrwx 1 cp cp 13K Oct 6 14:56 portaudio_x64.lib
-rwxrwxrwx 1 cp cp 1.5M Oct 6 14:56 portaudio_x64.pdb
-rwxrwxrwx 1 cp cp 268K Oct 6 14:56 vc142.pdb
cp#DESKTOP-ESLJ8N0:/mnt/c/Users/cp/source/github/portaudio/build/msvc/x64/Release$
Cool. So far so good.
Next, I create a console application to try to test the DLL. So specifically I:
Specifically, I want to do something like this:
https://github.com/PortAudio/portaudio/blob/master/examples/pa_devs.c
I started by doing the following:
a) create a windows console application called "portaudio-listdevices-command". it creates a "hello world" solution. it compiles and runs no problem.
b) I hijacked the default "ConsoleApplication1.cpp" file and tried to copy all the logic from pa_devs.c into this cpp file. The code in the cpp file looks like this:
https://github.com/closetcodebrews/portaudio-listdevices-commandline/blob/main/ConsoleApplication1/ConsoleApplication1.cpp
c) I copied all the header files from the portaudio solution directly into my client application folder.
In case it helps, this is what the folder structure looks like for the client application:
cp#DESKTOP-ESLJ8N0:/mnt/c/Users/cp/source/github/portaudio-listdevices-command/ConsoleApplication1$ ls -lah
total 156K
drwxrwxrwx 1 cp cp 4.0K Oct 7 08:16 .
drwxrwxrwx 1 cp cp 4.0K Oct 6 15:34 ..
drwxrwxrwx 1 cp cp 4.0K Oct 6 15:34 .vs
-rwxrwxrwx 1 cp cp 8.1K Oct 6 17:00 ConsoleApplication1.cpp
-rwxrwxrwx 1 cp cp 1.5K Oct 6 15:34 ConsoleApplication1.sln
-rwxrwxrwx 1 cp cp 7.9K Oct 7 08:29 ConsoleApplication1.vcxproj
-rwxrwxrwx 1 cp cp 992 Oct 6 15:34 ConsoleApplication1.vcxproj.filters
-rwxrwxrwx 1 cp cp 168 Oct 6 15:34 ConsoleApplication1.vcxproj.user
drwxrwxrwx 1 cp cp 4.0K Oct 7 08:05 Debug
-rwxrwxrwx 1 cp cp 5.8K Oct 6 13:24 pa_asio.h
-rwxrwxrwx 1 cp cp 2.9K Oct 6 13:24 pa_jack.h
-rwxrwxrwx 1 cp cp 3.9K Oct 6 13:24 pa_linux_alsa.h
-rwxrwxrwx 1 cp cp 7.6K Oct 6 13:24 pa_mac_core.h
-rwxrwxrwx 1 cp cp 3.5K Oct 6 13:24 pa_win_ds.h
-rwxrwxrwx 1 cp cp 24K Oct 6 13:24 pa_win_wasapi.h
-rwxrwxrwx 1 cp cp 8.9K Oct 6 13:24 pa_win_waveformat.h
-rwxrwxrwx 1 cp cp 5.0K Oct 6 13:24 pa_win_wdmks.h
-rwxrwxrwx 1 cp cp 6.9K Oct 6 13:24 pa_win_wmme.h
-rwxrwxrwx 1 cp cp 48K Oct 6 13:24 portaudio.h
drwxrwxrwx 1 cp cp 4.0K Oct 7 08:16 x64
cp#DESKTOP-ESLJ8N0:/mnt/c/Users/cp/source/github/portaudio-listdevices-command/ConsoleApplication1$
Problem
When I try to compile the client application, this is the error I'm getting:
Error LNK2019 unresolved external symbol Pa_GetVersionInfo referenced in function main ConsoleApplication1 C:\Users\cp\source\github\portaudio-listdevices-command\ConsoleApplication1\ConsoleApplication1.obj 1
What I've tried so far:
I've modified the following properties in my project:
Project --> Properties --> Linker --> Input --> Additional Dependencies --> "portaudio_x64.lib"
Project --> Properties --> VC++ Directories --> Library Directories --> c:\Users\cp\source\github\portaudio\build\msvc\x64\Release
Header files were just copied from the portaudio source folder direct to the client application so now I have this:
For what it's worth, in my ConsoleApplication1.cpp file, when I hover over the call to Pa_GetVersion() it does give me contextual help and shows me what the function does. Does this prove that the lib file is working?
Any help would be appreciated.
**DUMPBIN RESULTS **
PS C:\Users\cp\source\github\portaudio\build\msvc\x64\Release> dumpbin /exports portaudio_x64.dll
Microsoft (R) COFF/PE Dumper Version 14.27.29111.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file portaudio_x64.dll
File Type: DLL
Section contains the following exports for portaudio_x64.dll
00000000 characteristics
FFFFFFFF time date stamp
0.00 version
1 ordinal base
68 number of functions
48 number of names
ordinal hint RVA name
52 0 0001CE10 PaUtil_InitializeX86PlainConverters = PaUtil_InitializeX86PlainConverters
55 1 00003110 PaUtil_SetDebugPrintFunction = PaUtil_SetDebugPrintFunction
56 2 0000D100 PaWasapi_GetAudioClient = PaWasapi_GetAudioClient
58 3 0000D140 PaWasapi_GetDeviceCurrentFormat = PaWasapi_GetDeviceCurrentFormat
59 4 0000D1A0 PaWasapi_GetDeviceDefaultFormat = PaWasapi_GetDeviceDefaultFormat
60 5 0000D270 PaWasapi_GetDeviceMixFormat = PaWasapi_GetDeviceMixFormat
61 6 0000D340 PaWasapi_GetDeviceRole = PaWasapi_GetDeviceRole
64 7 0000D3C0 PaWasapi_GetFramesPerHostBuffer = PaWasapi_GetFramesPerHostBuffer
65 8 0000D3F0 PaWasapi_GetJackCount = PaWasapi_GetJackCount
66 9 0000D5D0 PaWasapi_GetJackDescription = PaWasapi_GetJackDescription
67 A 0000DAA0 PaWasapi_SetDefaultInterfaceId = PaWasapi_SetDefaultInterfaceId
68 B 0000DAB0 PaWasapi_SetStreamStateHandler = PaWasapi_SetStreamStateHandler
62 C 0000DAD0 PaWasapi_ThreadPriorityBoost = PaWasapi_ThreadPriorityBoost
63 D 0000DB10 PaWasapi_ThreadPriorityRevert = PaWasapi_ThreadPriorityRevert
23 E 00003520 Pa_AbortStream = Pa_AbortStream
19 F 00003570 Pa_CloseStream = Pa_CloseStream
7 10 000035D0 Pa_GetDefaultHostApi = Pa_GetDefaultHostApi
13 11 00003600 Pa_GetDefaultInputDevice = Pa_GetDefaultInputDevice
14 12 00003630 Pa_GetDefaultOutputDevice = Pa_GetDefaultOutputDevice
12 13 00003660 Pa_GetDeviceCount = Pa_GetDeviceCount
15 14 00003680 Pa_GetDeviceInfo = Pa_GetDeviceInfo
3 15 000036C0 Pa_GetErrorText = Pa_GetErrorText
6 16 00003870 Pa_GetHostApiCount = Pa_GetHostApiCount
8 17 00003890 Pa_GetHostApiInfo = Pa_GetHostApiInfo
11 18 000038C0 Pa_GetLastHostErrorInfo = Pa_GetLastHostErrorInfo
33 19 000038D0 Pa_GetSampleSize = Pa_GetSampleSize
28 1A 00003950 Pa_GetStreamCpuLoad = Pa_GetStreamCpuLoad
26 1B 00003980 Pa_GetStreamInfo = Pa_GetStreamInfo
31 1C 000039B0 Pa_GetStreamReadAvailable = Pa_GetStreamReadAvailable
27 1D 000039E0 Pa_GetStreamTime = Pa_GetStreamTime
32 1E 00003A10 Pa_GetStreamWriteAvailable = Pa_GetStreamWriteAvailable
1 1F 00003A40 Pa_GetVersion = Pa_GetVersion
2 20 00003A60 Pa_GetVersionText = Pa_GetVersionText
10 21 00003A70 Pa_HostApiDeviceIndexToDeviceIndex = Pa_HostApiDeviceIndexToDeviceIndex
9 22 00003AC0 Pa_HostApiTypeIdToHostApiIndex = Pa_HostApiTypeIdToHostApiIndex
4 23 00003B10 Pa_Initialize = Pa_Initialize
16 24 00003B50 Pa_IsFormatSupported = Pa_IsFormatSupported
25 25 00003C80 Pa_IsStreamActive = Pa_IsStreamActive
24 26 00003CB0 Pa_IsStreamStopped = Pa_IsStreamStopped
18 27 00003CE0 Pa_OpenDefaultStream = Pa_OpenDefaultStream
17 28 00003DF0 Pa_OpenStream = Pa_OpenStream
29 29 00003FB0 Pa_ReadStream = Pa_ReadStream
20 2A 00004050 Pa_SetStreamFinishedCallback = Pa_SetStreamFinishedCallback
34 2B 0001C700 Pa_Sleep = Pa_Sleep
21 2C 000040A0 Pa_StartStream = Pa_StartStream
22 2D 000040F0 Pa_StopStream = Pa_StopStream
5 2E 00004140 Pa_Terminate = Pa_Terminate
30 2F 00004180 Pa_WriteStream = Pa_WriteStream
Summary
3000 .data
7000 .pdata
24000 .rdata
1000 .reloc
1000 .rsrc
6B000 .text
1000 _RDATA
Detailed Output from Link.exe
1> C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\link.exe /ERRORREPORT:PROMPT /OUT:"C:\Users\cp\source\github\portaudio-listdevices-command\ConsoleApplication1\x64\Debug\ConsoleApplication1.exe" /INCREMENTAL /NOLOGO portaudio_x64.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG:FASTLINK /PDB:"C:\Users\cp\source\github\portaudio-listdevices-command\ConsoleApplication1\x64\Debug\ConsoleApplication1.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:\Users\cp\source\github\portaudio-listdevices-command\ConsoleApplication1\x64\Debug\ConsoleApplication1.lib" /MACHINE:X64 x64\Debug\ConsoleApplication1.obj
1> Tracking command:
1> C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Tracker.exe /a /d "C:\Program Files (x86)\MSBuild\15.0\FileTracker\FileTracker32.dll" /i C:\Users\cp\source\github\portaudio-listdevices-command\ConsoleApplication1\x64\Debug\ConsoleA.8f735e32.tlog /r C:\USERS\cp\SOURCE\GITHUB\PORTAUDIO-LISTDEVICES-COMMAND\CONSOLEAPPLICATION1\X64\DEBUG\CONSOLEAPPLICATION1.OBJ /b MSBuildConsole_CancelEventca601256d110470b96dcd6bd48d0231f /c "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\link.exe" /ERRORREPORT:PROMPT /OUT:"C:\Users\cp\source\github\portaudio-listdevices-command\ConsoleApplication1\x64\Debug\ConsoleApplication1.exe" /INCREMENTAL /NOLOGO portaudio_x64.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG:FASTLINK /PDB:"C:\Users\cp\source\github\portaudio-listdevices-command\ConsoleApplication1\x64\Debug\ConsoleApplication1.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:\Users\cp\source\github\portaudio-listdevices-command\ConsoleApplication1\x64\Debug\ConsoleApplication1.lib" /MACHINE:X64 x64\Debug\ConsoleApplication1.obj
Additional Lib Path now Defined
Latest Link Errors
1> C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\link.exe /ERRORREPORT:PROMPT /OUT:"C:\Users\cp\source\github\portaudio-listdevices-command\ConsoleApplication1\x64\Debug\ConsoleApplication1.exe" /INCREMENTAL /NOLOGO /LIBPATH:C:\Users\cp\source\github\portaudio\build\msvc\x64\Release /LIBPATH:C:\Users\cp\source\github\portaudio\build\msvc\x64\Release portaudio_x64.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG:FASTLINK /PDB:"C:\Users\cp\source\github\portaudio-listdevices-command\ConsoleApplication1\x64\Debug\ConsoleApplication1.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:\Users\cp\source\github\portaudio-listdevices-command\ConsoleApplication1\x64\Debug\ConsoleApplication1.lib" /MACHINE:X64 x64\Debug\ConsoleApplication1.obj
1> Tracking command:
1> C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Tracker.exe /a /d "C:\Program Files (x86)\MSBuild\15.0\FileTracker\FileTracker32.dll" /i C:\Users\cp\source\github\portaudio-listdevices-command\ConsoleApplication1\x64\Debug\ConsoleA.8f735e32.tlog /r C:\USERS\cp\SOURCE\GITHUB\PORTAUDIO-LISTDEVICES-COMMAND\CONSOLEAPPLICATION1\X64\DEBUG\CONSOLEAPPLICATION1.OBJ /b MSBuildConsole_CancelEventa9f191895925491f926a123cade0b276 /c "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\link.exe" /ERRORREPORT:PROMPT /OUT:"C:\Users\cp\source\github\portaudio-listdevices-command\ConsoleApplication1\x64\Debug\ConsoleApplication1.exe" /INCREMENTAL /NOLOGO /LIBPATH:C:\Users\cp\source\github\portaudio\build\msvc\x64\Release /LIBPATH:C:\Users\cp\source\github\portaudio\build\msvc\x64\Release portaudio_x64.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG:FASTLINK /PDB:"C:\Users\cp\source\github\portaudio-listdevices-command\ConsoleApplication1\x64\Debug\ConsoleApplication1.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:\Users\cp\source\github\portaudio-listdevices-command\ConsoleApplication1\x64\Debug\ConsoleApplication1.lib" /MACHINE:X64 x64\Debug\ConsoleApplication1.obj
1> ConsoleApplication1.obj : error LNK2019: unresolved external symbol Pa_GetVersionInfo referenced in function main
1> C:\Users\cp\source\github\portaudio-listdevices-command\ConsoleApplication1\x64\Debug\ConsoleApplication1.exe : fatal error LNK1120: 1 unresolved externals
1> The command exited with code 1120.
1> Done executing task "Link" -- FAILED.
1>Done building target "Link" in project "ConsoleApplication1.vcxproj" -- FAILED.
1>
1>Done building project "ConsoleApplication1.vcxproj" -- FAILED.
1>
1>Build FAILED.
1>
1>ConsoleApplication1.obj : error LNK2019: unresolved external symbol Pa_GetVersionInfo referenced in function main
1>C:\Users\cp\source\github\portaudio-listdevices-command\ConsoleApplication1\x64\Debug\ConsoleApplication1.exe : fatal error LNK1120: 1 unresolved externals
1> 0 Warning(s)
1> 2 Error(s)

So I can't take credit for this. I'm only posting answer so we can close this question.
But the issue was with the portaudio library itself
The portinfo.def file was not exporting the method that I was trying to call - the method referenced in the example file.
the fix was to add the following line to the portinfo.def file:
Pa_GetVersionInfo # 69
Now my client / console app compiles.
I will submit a patch later today to portaudio repo for the community to consider. But thanks to #HansPassant and πάντα ῥεῖ

Related

When attemping to copy a dir from repo to container in workflow, it's as if COPY command did nothing

My repo:
/
dbt-action/
action.yml
Dockerfile
entrypoint.sh
dbt/
profiles.yml
My workflow step:
- name: Run DBT
uses: ./dbt-action
My Dockerfile:
FROM ghcr.io/dbt-labs/dbt-redshift:1.3.latest
COPY dbt .dbt
COPY entrypoint.sh /entrypoint.sh
My entrypoint:
!/bin/bash
pwd
ls -la
Outputs the following:
drwxr-xr-x 6 1001 123 4096 Jan 7 13:06 .
drwxr-xr-x 6 root root 4096 Jan 7 13:06 ..
drwxr-xr-x 8 1001 123 4096 Jan 7 13:06 .git
drwxr-xr-x 3 1001 123 4096 Jan 7 13:06 .github
drwxr-xr-x 3 1001 123 4096 Jan 7 13:06 blah
-rw-r--r-- 1 1001 123 1744 Jan 7 13:06 README.md
drwxr-xr-x 3 1001 123 4096 Jan 7 13:06 dbt-action
Expected output:
Same as above but with additional directory .dbt coming from COPY dbt .dbt in my Dockerfile.
Why don't I see dir .dbt when I ls -la in my entrypoint?
Seems like you are executing your ‘Docker build’ from the wrong working directory, since the ‘dbt-action’ folder is present, but not it contents. Can you double check the PWD before you build?

cmake error: "cc: error: unrecognized command line option ‘-std=c++20’; did you mean ‘-std=c++2a’?"

I'm attempting to compile a binary from source, but keep running into an error while doing so.
$ cmake --build ./\[binary_dir\]/
[ 0%] Building C object [binary_dir]/CMakeFiles/ZIPLIB.dir/extlibs/bzip2/bcompress.c.o
cc: error: unrecognized command line option ‘-std=c++20’; did you mean ‘-std=c++2a’?
make[2]: *** [[binary_dir]/CMakeFiles/ZIPLIB.dir/build.make:154: [binary_dir]/CMakeFiles/ZIPLIB.dir/extlibs/bzip2/bcompress.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:307: [binary_dir]/CMakeFiles/ZIPLIB.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
Specifically, "cc: error: unrecognized command line option ‘-std=c++20’; did you mean ‘-std=c++2a’?."
I suspect this has to do with using the incorrect version of gcc; I have multiple version installed but believe I need to be using the latest, or at least 11.1.0. I have these versions installed:
$ ls -l /usr/bin/gcc*
lrwxrwxrwx 1 root root 5 Mar 20 2020 /usr/bin/gcc -> gcc-9
lrwxrwxrwx 1 root root 23 May 29 2021 /usr/bin/gcc-10 -> x86_64-linux-gnu-gcc-10
lrwxrwxrwx 1 root root 23 Apr 28 2021 /usr/bin/gcc-11 -> x86_64-linux-gnu-gcc-11
lrwxrwxrwx 1 root root 22 Mar 9 12:57 /usr/bin/gcc-9 -> x86_64-linux-gnu-gcc-9
lrwxrwxrwx 1 root root 8 Mar 20 2020 /usr/bin/gcc-ar -> gcc-ar-9
lrwxrwxrwx 1 root root 26 May 29 2021 /usr/bin/gcc-ar-10 -> x86_64-linux-gnu-gcc-ar-10
lrwxrwxrwx 1 root root 26 Apr 28 2021 /usr/bin/gcc-ar-11 -> x86_64-linux-gnu-gcc-ar-11
lrwxrwxrwx 1 root root 25 Mar 9 12:57 /usr/bin/gcc-ar-9 -> x86_64-linux-gnu-gcc-ar-9
lrwxrwxrwx 1 root root 8 Mar 20 2020 /usr/bin/gcc-nm -> gcc-nm-9
lrwxrwxrwx 1 root root 26 May 29 2021 /usr/bin/gcc-nm-10 -> x86_64-linux-gnu-gcc-nm-10
lrwxrwxrwx 1 root root 26 Apr 28 2021 /usr/bin/gcc-nm-11 -> x86_64-linux-gnu-gcc-nm-11
lrwxrwxrwx 1 root root 25 Mar 9 12:57 /usr/bin/gcc-nm-9 -> x86_64-linux-gnu-gcc-nm-9
lrwxrwxrwx 1 root root 12 Mar 20 2020 /usr/bin/gcc-ranlib -> gcc-ranlib-9
lrwxrwxrwx 1 root root 30 May 29 2021 /usr/bin/gcc-ranlib-10 -> x86_64-linux-gnu-gcc-ranlib-10
lrwxrwxrwx 1 root root 30 Apr 28 2021 /usr/bin/gcc-ranlib-11 -> x86_64-linux-gnu-gcc-ranlib-11
lrwxrwxrwx 1 root root 29 Mar 9 12:57 /usr/bin/gcc-ranlib-9 -> x86_64-linux-gnu-gcc-ranlib-9
If that's the issue, how can I specify which version of gcc to use? Would that happen in the makefile/cmakelist itself, as a path which I need to specify in my environment, or as a flag applied when calling cmake?
Or does the error suggest another solution?
Presuming you are in a build directory:
You can set CMAKE_C_COMPILER when you run the original call to cmake.
cmake -DCMAKE_C_COMPILER=/usr/bin/gcc-11 ..
cmake --build .

g++ cannot find library although it's there

I'm compiling some cpp files with:
$ ​g++ -c --std=c++17 -I/antlr4/runtime/Cpp/runtime/src/ *.cpp
And everything goes fine:
$ ls -l *.cpp *.o
-rw-r--r-- 1 root root 76637 Dec 1 14:33 Java8Lexer.cpp
-rw-r--r-- 1 root root 370768 Dec 1 15:13 Java8Lexer.o
-rw-r--r-- 1 root root 925012 Dec 1 14:33 Java8Parser.cpp
-rw-r--r-- 1 root root 5037896 Dec 1 15:13 Java8Parser.o
-rw-r--r-- 1 root root 113 Dec 1 14:33 Java8ParserBaseListener.cpp
-rw-r--r-- 1 root root 2312 Dec 1 15:13 Java8ParserBaseListener.o
-rw-r--r-- 1 root root 109 Dec 1 14:33 Java8ParserListener.cpp
-rw-r--r-- 1 root root 2304 Dec 1 15:13 Java8ParserListener.o
-rw-r--r-- 1 root root 724 Dec 1 14:36 main.cpp
-rw-r--r-- 1 root root 324360 Dec 1 15:13 main.o
When I try to link with a library, it fails:
$ g++ *.o -l/antlr4/runtime/Cpp/dist/libantlr4-runtime.so.4.9.3
/usr/bin/ld: cannot find -l/antlr4/runtime/Cpp/dist/libantlr4-runtime.so.4.9.3
collect2: error: ld returned 1 exit status
This is weird because the shared library does exist:
$ ls -l /antlr4/runtime/Cpp/dist/libantlr4-runtime.so.4.9.3
-rwxr-xr-x 1 root root 1599624 Dec 1 14:28 /antlr4/runtime/Cpp/dist/libantlr4-runtime.so.4.9.3
You can specify the directory with option -L and the library file with its abbreviated form (no lib prefix, no .so.xxx suffix):
g++ *.o -L /antlr4/runtime/Cpp/dist -lantlr4-runtime

Bash, need to change word order in multiple directories

I have a considerable classical FLAC collection where each album is a directory. I've realized that I have used a sub-optimal structure and need to rename all the directories.
My current naming convention is:
COMPOSER (CONDUCTOR) - NAME OF PIECE
E.g.
"Bach (Celibidache) - Mass in F minor"
I want to change the naming to
COMPOSER - NAME OF PIECE (CONDUCTOR)
I.e.
"Bach - Mass in F minor (Celibidache)"
There are some possible exceptions, the (CONDUCTOR) may be (CONDUCTOR, SOLOIST) and some directories do not have the (CONDUCTOR) part and should be left as is. The NAME OF PIECE can contain all legal letters and symbols.
All albums are located in the same parent directory, so no sub-directories.
What is the easy way to do this?
use perl rename (some distributions have this as rename - Ubuntu and related, some as prename - Fedora and Redhat AFAIK). Check first.
prename -n -- '-d && s/(\(.*\)) - (.*)/- \2 \1/' *
-n don't rename just print the results - remove after you are ok with the results.
-- end of the options, start of the perlexpr and files
-d check that the file is a directory
s/.../.../ - substitution
Example:
[test01#localhost composers]$ ls -la
total 12
drwxrwxr-x 3 test01 test01 4096 Feb 14 12:37 .
drwxrwxr-x. 7 test01 test01 4096 Feb 14 12:23 ..
drwxrwxr-x 2 test01 test01 4096 Feb 14 12:37 'Bach (Celibidache) - Mass in F minor'
-rw-rw-r-- 1 test01 test01 0 Feb 14 12:27 'Bach (Celibidache) - Mass in F minor.flac'
[test01#localhost composers]$ prename -n -- '-d && s/(\(.*\)) - (.*)/- \2 \1/' *
Bach (Celibidache) - Mass in F minor -> Bach - Mass in F minor (Celibidache)
[test01#localhost composers]$ prename -- '-d && s/(\(.*\)) - (.*)/- \2 \1/' *
[test01#localhost composers]$ ls -la
total 12
drwxrwxr-x 3 test01 test01 4096 Feb 14 12:38 .
drwxrwxr-x. 7 test01 test01 4096 Feb 14 12:23 ..
-rw-rw-r-- 1 test01 test01 0 Feb 14 12:27 'Bach (Celibidache) - Mass in F minor.flac'
drwxrwxr-x 2 test01 test01 4096 Feb 14 12:37 'Bach - Mass in F minor (Celibidache)'
Note that without -d both the file and the directory would have been renamed.

install ocsigen-bundle-2.2.2 error

$./configure --prefix ${HOME}/ocsigen OCSIGEN_USER=${USER} OCSIGEN_GROUP=${USER} --with-missing-libs
...
checking for sqlite3_open in -lsqlite3... no
configure: error: SQLite is required. See the --with-sqlite3 configure option.
$uname -r
[FreeBSD[ 9.0-RELEASE-p3
$whereis sqlite3
sqlite3: /usr/local/bin/sqlite3
$ls -l /usr/local/lib/libsqlite*
-rw-r--r-- 1 root wheel 602092 12 3 2011 /usr/local/lib/libsqlite3.a
-rwxr-xr-x 1 root wheel 943 12 3 2011 /usr/local/lib/libsqlite3.la*
lrwx-rw-r--r-- 1 root wheel 602092 12 3 2011 /usr/local/lib/libsqlite3.a
-rwxr-xr-x 1 root wheel 943 12 3 2011 /usr/local/lib/libsqlite3.la*
lrwxr-xr-x 1 root wheel 15 12 3 2011 /usr/local/lib/libsqlite3.so# -> libsqlite3.so.8
-rwxr-xr-x 1 root wheel 617995 12 3 2011 /usr/local/lib/libsqlite3.so.8*
Any suggestion is appreciated!
I think you can use something like
./configure --with-sqlite3=/usr/local/lib
or maybe just /usr/local to tell the ./configure script that sqlite3 is not in the standard directory (/usr/lib).