cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
russellquick
Level 3

Using lm_new.obj in CMake with MinGW

Jump to solution

Hello,

I'm stuck on trying to use the generated lm_new.obj file in Windows with a CMake-based codebase.

I'm generating lm_new with nmake on Windows with:

nmake -f makefile clean all

Then I copy over the lm_new.obj file. In my CMakeLists.txt I include the lm_new.obj file with:

set(REVENERA_OBJS
${CMAKE_CURRENT_SOURCE_DIR}/lm_new.obj
)

add_executable(our_executable ${REVENERA_OBJS} lm_heat_runner.c)

set_source_files_properties(
${REVENERA_OBJS}
PROPERTIES
EXTERNAL_OBJECT TRUE
GENERATED TRUE
)

 

When I run mingw32-make I get:
[100%] Linking C executable ..\..\our_executable.exe
ld.exe: CMakeFiles\heat_licensing_runner.dir/objects.a: member CMakeFiles\heat_licensing_runner.dir/objects.a(lm_new.obj) in archive is not an object
collect2.exe: error: ld returned 1 exit status

If I take out the usage of lm_new.obj in our CMakeLists.txt file I get a lot of undefined references:

(.text.startup+0xa3): undefined reference to `l_n36_buf'

(.text.startup+0xc3): undefined reference to `lc_new_job'

(.text.startup+0xf7): undefined reference to `lc_set_attr'

(.text.startup+0x130): undefined reference to `lc_checkout'

(.text.startup+0x1b9): undefined reference to `lc_checkin'

(.text.startup+0x1c6): undefined reference to `lc_free_job'

(.text.startup+0x1f8): undefined reference to `lc_perror'

(.text.startup+0x205): undefined reference to `lc_get_errno'

So my question is this: How should I be building and linking these? Or is it even possible to build in nmake and link to the output in MinGW?

0 Kudos
(1) Solution
russellquick
Level 3

I was able to get things working by reversing the process and DLL wrapping the library from MinGW for use with a modified build step in the Revenera makefile.

View solution in original post

0 Kudos
(2) Replies
russellquick
Level 3

Specifics:

  • Windows 10
  • CMake 3.17.0
  • Visual Studio 14
  • GNU Make 3.82.90
0 Kudos
russellquick
Level 3

I was able to get things working by reversing the process and DLL wrapping the library from MinGW for use with a modified build step in the Revenera makefile.

0 Kudos