<div dir="ltr">OK, I'm an idiot. It's <b>CMAKE_C_FLAGS</b> not <b>CMAKE_CPP_FLAGS</b>. It works now.<div><br></div><div>However, I am still surprised at the need to hack the <b>configure</b> script to make the test work.</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Feb 14, 2023 at 4:33 PM Simon Eves <<a href="mailto:simon.eves@heavy.ai">simon.eves@heavy.ai</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I recreated the compile/link test that <b>configure</b> is doing, and it also fails outside.<div><br></div><div>I then determined I could make it work by also adding <b>-lm</b> and <b>-lpthread</b> to the link.</div><div><br></div><div>I hacked GDAL <b>configure</b> script to also add those two to <b>$LIBS</b> when it does the OpenJPEG link test, and now that passes, and then <b>configure</b> reports OpenJPEG is enabled.</div><div><br></div><div>However, when I then compile GDAL, it fails in the final huge link of <b><a href="http://libgdal.la" target="_blank">libgdal.la</a></b> with</div><div><br></div><div><b>/usr/bin/ld: /usr/local/mapd-deps/lib/libopenjp2.a(cio.c.o): relocation R_X86_64_PC32 against symbol `opj_stream_write_skip' can not be used when making a shared object; recompile with -fPIC<br>/usr/bin/ld: final link failed: bad value</b><br></div><div><br></div><div>I assume this is because it's trying to make a shared GDAL lib, but including the static OpenJPEG lib.</div><div><br></div><div>I tried adding <b> -DCMAKE_CPP_FLAGS="-fPIC" -DCMAKE_CXX_FLAGS="-fPIC"</b> to the OpenJPEG build CMake invocation, but that made no difference.</div><div><br></div><div>Any help with this would be greatly appreciated, as we're code-freezing end of this week and I'd really like to get this in.</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Feb 12, 2023 at 6:44 PM Simon Eves <<a href="mailto:simon.eves@heavy.ai" target="_blank">simon.eves@heavy.ai</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Is there some trick to enabling this driver with the old non-CMake build env...? :)<div><br></div><div>I am building OpenJPEG 2.5.0 (from source) and it's building and installing fine into the same include/lib tree as everything else, and then GDAL configure (just adding <b>--with-openjpeg</b>, no path, right?) sees it and tests it, but the compile test of <b>opj_setup_decoder()</b> apparently fails, so <b>HAVE_OPENJPEG</b> gets disabled again.</div><div><br></div><div>I see that function in <b>openjpeg.h</b> and (with <b>nm</b>) in <b>libopenjp2.a</b>, so I'm not sure why it's failing.<br clear="all"><div><br></div><div>I tried some other CMake option variations for OpenJPEG but nothing fixed it.</div><div><br></div><div>Ubuntu 20.04, GCC 9.4, GDAL 3.4.1, all-static build</div><div><br></div><div>I have tried GDAL 3.6.2 (and PROJ 9.2.1) building them with CMake and I think the OpenJPEG part is working, then but our dependencies build falls over later with something else that doesn't like the newer PROJ, and I'd rather not bump the GDAL & PROJ and data files versions at this time anyway, as we're very close to a release.</div><div><br></div><div>I just wanna minimally add JPEG2000 to what we have...</div><div><br></div><div>TIA</div></div><div><br></div>-- <br><div dir="ltr"><div dir="ltr">Simon Eves<div>Senior Rendering Engineer</div><div>+1 (415) 902-1996<br><a href="mailto:simon.eves@heavy.ai" target="_blank">simon.eves@heavy.ai</a></div><div><span><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><a href="http://www.heavy.ai" target="_blank"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(17,85,204);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><span style="border:none;display:inline-block;overflow:hidden;width:156px;height:29px"><img src="https://lh4.googleusercontent.com/mzi9GaXA9r6isEqIx5nIYx0oQnpZtzBnF19Pu83MUBPDvp_rpcQXv55z-IZcQrybunkhKf6mXNJjIQinIbkHTigssDxIks_tXAaV1aDQzVT8FpE1wOn3MW0W_iiTnDjVZzMUNgs" width="156" height="29" style="margin-left: 0px; margin-top: 0px;"></span></span></a></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(67,67,67);background-color:transparent;font-weight:700;vertical-align:baseline;white-space:pre-wrap">(formerly OmniSci)</span></p></span></div></div></div></div>
</blockquote></div>
</blockquote></div>